mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ACA-3683] - implement started date process filter (#6093)
* [ACA-3583] - implement created date process filter * [ACA-3683] - add started date process filter * remove unused property input * rebase * fix unit test Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import { DateRangeFilterService } from './date-range-filter.service';
|
|||||||
import { DateRangeFilter, DateCloudFilterType } from '../../models/date-cloud-filter.model';
|
import { DateRangeFilter, DateCloudFilterType } from '../../models/date-cloud-filter.model';
|
||||||
|
|
||||||
const DEFAULT_DATE_RANGE_OPTIONS = [
|
const DEFAULT_DATE_RANGE_OPTIONS = [
|
||||||
|
DateCloudFilterType.NO_DATE,
|
||||||
DateCloudFilterType.TODAY,
|
DateCloudFilterType.TODAY,
|
||||||
DateCloudFilterType.WEEK,
|
DateCloudFilterType.WEEK,
|
||||||
DateCloudFilterType.MONTH,
|
DateCloudFilterType.MONTH,
|
||||||
|
@@ -31,3 +31,7 @@ export interface DateRangeFilter {
|
|||||||
startDate: Date;
|
startDate: Date;
|
||||||
endDate: Date;
|
endDate: Date;
|
||||||
}
|
}
|
||||||
|
export interface RangeKeys {
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
}
|
||||||
|
@@ -66,6 +66,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<adf-cloud-date-range-filter *ngIf="isDateRangeType(processFilterProperty)"
|
||||||
|
[processFilterProperty]="processFilterProperty"
|
||||||
|
(dateChanged)="onDateRangeFilterChanged($event, processFilterProperty)"></adf-cloud-date-range-filter>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@@ -32,6 +32,7 @@ import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud
|
|||||||
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
||||||
import { ProcessCloudService } from '../../services/process-cloud.service';
|
import { ProcessCloudService } from '../../services/process-cloud.service';
|
||||||
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
||||||
|
import { DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-cloud-edit-process-filter',
|
selector: 'adf-cloud-edit-process-filter',
|
||||||
@@ -164,7 +165,14 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
|
|
||||||
getFormControlsConfig(processFilterProperties: ProcessFilterProperties[]): any {
|
getFormControlsConfig(processFilterProperties: ProcessFilterProperties[]): any {
|
||||||
const properties = processFilterProperties.map((property: ProcessFilterProperties) => {
|
const properties = processFilterProperties.map((property: ProcessFilterProperties) => {
|
||||||
return { [property.key]: property.value };
|
if (!property.rangeKeys) {
|
||||||
|
return { [property.key]: property.value };
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
[property.rangeKeys.from]: property.value[property.rangeKeys.from],
|
||||||
|
[property.rangeKeys.to]: property.value[property.rangeKeys.to]
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return properties.reduce(((result, current) => Object.assign(result, current)), {});
|
return properties.reduce(((result, current) => Object.assign(result, current)), {});
|
||||||
}
|
}
|
||||||
@@ -447,10 +455,23 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
this.toggleFilterActions = false;
|
this.toggleFilterActions = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDateRangeFilterChanged(dateRange: DateRangeFilter, property: ProcessFilterProperties) {
|
||||||
|
this.editProcessFilterForm.get(property.rangeKeys.from).setValue(
|
||||||
|
dateRange.startDate ? dateRange.startDate.toISOString() : null
|
||||||
|
);
|
||||||
|
this.editProcessFilterForm.get(property.rangeKeys.to).setValue(
|
||||||
|
dateRange.endDate ? dateRange.endDate.toISOString() : null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
isDateType(property: ProcessFilterProperties): boolean {
|
isDateType(property: ProcessFilterProperties): boolean {
|
||||||
return property.type === 'date';
|
return property.type === 'date';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDateRangeType(property: ProcessFilterProperties): boolean {
|
||||||
|
return property.type === 'date-range';
|
||||||
|
}
|
||||||
|
|
||||||
isSelectType(property: ProcessFilterProperties): boolean {
|
isSelectType(property: ProcessFilterProperties): boolean {
|
||||||
return property.type === 'select';
|
return property.type === 'select';
|
||||||
}
|
}
|
||||||
@@ -674,8 +695,17 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
|
|||||||
key: 'order',
|
key: 'order',
|
||||||
value: currentProcessFilter.order || this.directions[0].value,
|
value: currentProcessFilter.order || this.directions[0].value,
|
||||||
options: this.directions
|
options: this.directions
|
||||||
|
}),
|
||||||
|
new ProcessFilterProperties({
|
||||||
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.START_DATE',
|
||||||
|
type: 'date-range',
|
||||||
|
key: 'startDateRange',
|
||||||
|
rangeKeys: { from: 'startFrom', to: 'startTo'},
|
||||||
|
values: {
|
||||||
|
from: currentProcessFilter.startFrom || null,
|
||||||
|
to: currentProcessFilter.startTo || null
|
||||||
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { DateCloudFilterType, RangeKeys } from '../../../models/date-cloud-filter.model';
|
||||||
|
|
||||||
export class ProcessFilterCloudModel {
|
export class ProcessFilterCloudModel {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -35,6 +36,9 @@ export class ProcessFilterCloudModel {
|
|||||||
lastModified: Date;
|
lastModified: Date;
|
||||||
lastModifiedTo: Date;
|
lastModifiedTo: Date;
|
||||||
lastModifiedFrom: Date;
|
lastModifiedFrom: Date;
|
||||||
|
startedDate: Date;
|
||||||
|
startFrom: Date;
|
||||||
|
startTo: Date;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
@@ -57,6 +61,9 @@ export class ProcessFilterCloudModel {
|
|||||||
this.lastModified = obj.lastModified || null;
|
this.lastModified = obj.lastModified || null;
|
||||||
this.lastModifiedTo = obj.lastModifiedTo || null;
|
this.lastModifiedTo = obj.lastModifiedTo || null;
|
||||||
this.lastModifiedFrom = obj.lastModifiedFrom || null;
|
this.lastModifiedFrom = obj.lastModifiedFrom || null;
|
||||||
|
this.startedDate = obj.startedDate || null;
|
||||||
|
this.startFrom = obj.startFrom || null;
|
||||||
|
this.startTo = obj.startTo || null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +95,8 @@ export class ProcessFilterProperties {
|
|||||||
value: string;
|
value: string;
|
||||||
key: string;
|
key: string;
|
||||||
options: ProcessFilterOptions[];
|
options: ProcessFilterOptions[];
|
||||||
|
rangeKeys?: RangeKeys;
|
||||||
|
dateFilterOptions?: DateCloudFilterType[];
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
@@ -96,6 +105,8 @@ export class ProcessFilterProperties {
|
|||||||
this.value = obj.value || '';
|
this.value = obj.value || '';
|
||||||
this.key = obj.key || null;
|
this.key = obj.key || null;
|
||||||
this.options = obj.options || null;
|
this.options = obj.options || null;
|
||||||
|
this.rangeKeys = obj.rangeKeys || null;
|
||||||
|
this.dateFilterOptions = obj.dateFilterOptions || [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,10 @@ describe('ProcessFilterCloudService', () => {
|
|||||||
processDefinitionKey: 'processDefKey',
|
processDefinitionKey: 'processDefKey',
|
||||||
lastModified: null,
|
lastModified: null,
|
||||||
lastModifiedTo: null,
|
lastModifiedTo: null,
|
||||||
lastModifiedFrom: null
|
lastModifiedFrom: null,
|
||||||
|
startedDate: null,
|
||||||
|
startFrom: null,
|
||||||
|
startTo: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const fakeProcessCloudFilterEntries = {
|
const fakeProcessCloudFilterEntries = {
|
||||||
|
@@ -91,6 +91,14 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
|||||||
@Input()
|
@Input()
|
||||||
lastModifiedTo: string = '';
|
lastModifiedTo: string = '';
|
||||||
|
|
||||||
|
/** Filter the processes. Display only process with startedDate greater then the supplied date. */
|
||||||
|
@Input()
|
||||||
|
startFrom: string = '';
|
||||||
|
|
||||||
|
/** Filter the processes. Display only process with startedDate less than the supplied date. */
|
||||||
|
@Input()
|
||||||
|
startTo: string = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Row selection mode. Can be "none", "single" or "multiple".
|
* Row selection mode. Can be "none", "single" or "multiple".
|
||||||
* For multiple mode, you can use Cmd (macOS) or Ctrl (Win) modifier
|
* For multiple mode, you can use Cmd (macOS) or Ctrl (Win) modifier
|
||||||
@@ -318,6 +326,8 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
|
|||||||
businessKey: this.businessKey,
|
businessKey: this.businessKey,
|
||||||
lastModifiedFrom: this.lastModifiedFrom,
|
lastModifiedFrom: this.lastModifiedFrom,
|
||||||
lastModifiedTo: this.lastModifiedTo,
|
lastModifiedTo: this.lastModifiedTo,
|
||||||
|
startFrom: this.startFrom,
|
||||||
|
startTo: this.startTo,
|
||||||
sorting: this.sorting
|
sorting: this.sorting
|
||||||
};
|
};
|
||||||
return new ProcessQueryCloudRequestModel(requestNode);
|
return new ProcessQueryCloudRequestModel(requestNode);
|
||||||
|
@@ -32,6 +32,8 @@ export class ProcessQueryCloudRequestModel {
|
|||||||
lastModified?: string;
|
lastModified?: string;
|
||||||
lastModifiedTo?: string;
|
lastModifiedTo?: string;
|
||||||
lastModifiedFrom?: string;
|
lastModifiedFrom?: string;
|
||||||
|
startFrom?: string;
|
||||||
|
startTo?: string;
|
||||||
maxItems: number;
|
maxItems: number;
|
||||||
skipCount: number;
|
skipCount: number;
|
||||||
sorting?: ProcessListCloudSortingModel[];
|
sorting?: ProcessListCloudSortingModel[];
|
||||||
@@ -51,6 +53,8 @@ export class ProcessQueryCloudRequestModel {
|
|||||||
this.lastModified = obj.lastModified;
|
this.lastModified = obj.lastModified;
|
||||||
this.lastModifiedTo = obj.lastModifiedTo;
|
this.lastModifiedTo = obj.lastModifiedTo;
|
||||||
this.lastModifiedFrom = obj.lastModifiedFrom;
|
this.lastModifiedFrom = obj.lastModifiedFrom;
|
||||||
|
this.startFrom = obj.startFrom;
|
||||||
|
this.startTo = obj.startTo;
|
||||||
this.maxItems = obj.maxItems;
|
this.maxItems = obj.maxItems;
|
||||||
this.skipCount = obj.skipCount;
|
this.skipCount = obj.skipCount;
|
||||||
this.sorting = obj.sorting;
|
this.sorting = obj.sorting;
|
||||||
|
@@ -639,6 +639,12 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
key: 'createdDate',
|
key: 'createdDate',
|
||||||
value: ''
|
value: ''
|
||||||
}),
|
}),
|
||||||
|
new TaskFilterProperties({
|
||||||
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
|
||||||
|
type: 'date',
|
||||||
|
key: 'dueDate',
|
||||||
|
value: ''
|
||||||
|
}),
|
||||||
new TaskFilterProperties({
|
new TaskFilterProperties({
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
@@ -662,7 +668,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
new TaskFilterProperties({
|
new TaskFilterProperties({
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
|
||||||
type: 'date-range',
|
type: 'date-range',
|
||||||
key: 'dueDate',
|
key: 'dueDateRange',
|
||||||
rangeKeys: { from: 'dueDateFrom', to: 'dueDateTo'},
|
rangeKeys: { from: 'dueDateFrom', to: 'dueDateTo'},
|
||||||
value: currentTaskFilter.dueDate || false,
|
value: currentTaskFilter.dueDate || false,
|
||||||
dateFilterOptions: [
|
dateFilterOptions: [
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
import { DateCloudFilterType, RangeKeys } from '../../../models/date-cloud-filter.model';
|
||||||
|
|
||||||
export class TaskFilterCloudModel {
|
export class TaskFilterCloudModel {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -112,11 +112,6 @@ export interface FilterOptions {
|
|||||||
value?: string;
|
value?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RangeKeys {
|
|
||||||
from: string;
|
|
||||||
to: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TaskFilterProperties {
|
export class TaskFilterProperties {
|
||||||
label: string;
|
label: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
Reference in New Issue
Block a user