mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-25144 Process variables filters (#10405)
* AAE-25144 Implements process variables filters * update * fix lint
This commit is contained in:
@@ -16,3 +16,4 @@
|
||||
*/
|
||||
|
||||
export * from './interface/index';
|
||||
export * from './date-range-filter/date-range-filter.service';
|
||||
|
@@ -323,7 +323,7 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges {
|
||||
|
||||
private fetchProcessFilterCounter(filter: ProcessFilterCloudModel): Observable<number> {
|
||||
return this.searchMethod === 'POST'
|
||||
? this.processListCloudService.getProcessListCounter(new ProcessFilterCloudAdapter(filter))
|
||||
: this.processListCloudService.getProcessCounter(filter.appName, filter.status)
|
||||
? this.processListCloudService.getProcessListCounter(new ProcessFilterCloudAdapter(filter))
|
||||
: this.processListCloudService.getProcessCounter(filter.appName, filter.status)
|
||||
}
|
||||
}
|
||||
|
@@ -21,6 +21,16 @@ import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
||||
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
||||
import { ComponentSelectionMode } from '../../../types';
|
||||
|
||||
export type ProcessFilterOperators = 'eq' | 'like' | 'gt' | 'gte' | 'lt' | 'lte';
|
||||
|
||||
export interface ProcessVariableFilterModel {
|
||||
processDefinitionKey: string;
|
||||
name: string;
|
||||
type: string;
|
||||
value: string | number;
|
||||
operator: ProcessFilterOperators;
|
||||
}
|
||||
|
||||
export class ProcessFilterCloudModel {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -53,6 +63,8 @@ export class ProcessFilterCloudModel {
|
||||
appVersions: string[] | null;
|
||||
statuses: string[] | null;
|
||||
|
||||
processVariableFilters?: ProcessVariableFilterModel[]
|
||||
|
||||
private dateRangeFilterService = new DateRangeFilterService();
|
||||
private _completedFrom: string;
|
||||
private _completedTo: string;
|
||||
@@ -104,6 +116,7 @@ export class ProcessFilterCloudModel {
|
||||
this.initiators = obj.initiators || null;
|
||||
this.appVersions = obj.appVersions || null;
|
||||
this.statuses = obj.statuses || null;
|
||||
this.processVariableFilters = obj.processVariableFilters ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -63,6 +63,7 @@ import {
|
||||
} from '../../../models/data-column-custom-data';
|
||||
import { VariableMapperService } from '../../../services/variable-mapper.sevice';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ProcessVariableFilterModel } from '../../process-filters/models/process-filter-cloud.model';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||
|
||||
@@ -235,6 +236,13 @@ export class ProcessListCloudComponent
|
||||
@Input()
|
||||
statuses: string[] = [];
|
||||
|
||||
/**
|
||||
* Filter the processes. Display only processes with specific process variables.
|
||||
* This input will be used only if PROCESS_SEARCH_API_METHOD_TOKEN is provided with 'POST' value.
|
||||
*/
|
||||
@Input()
|
||||
processVariables: ProcessVariableFilterModel[]
|
||||
|
||||
/** Emitted when a row in the process list is clicked. */
|
||||
@Output()
|
||||
rowClick: EventEmitter<string> = new EventEmitter<string>();
|
||||
@@ -540,7 +548,8 @@ export class ProcessListCloudComponent
|
||||
completedTo: this.completedTo,
|
||||
suspendedFrom: this.suspendedFrom,
|
||||
suspendedTo: this.suspendedTo,
|
||||
processVariableKeys: this.getVariableDefinitionsRequestModel()
|
||||
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
||||
processVariableFilters: this.processVariables
|
||||
};
|
||||
|
||||
return new ProcessListRequestModel(requestNode);
|
||||
|
@@ -17,74 +17,66 @@
|
||||
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
import { ProcessListCloudSortingModel, ProcessListRequestSortingModel } from './process-list-sorting.model';
|
||||
import { ProcessFilterCloudModel } from '../../process-filters/models/process-filter-cloud.model';
|
||||
import { ProcessFilterCloudModel, ProcessVariableFilterModel } from '../../process-filters/models/process-filter-cloud.model';
|
||||
|
||||
export class ProcessQueryCloudRequestModel {
|
||||
appName: string;
|
||||
appVersion?: number | string;
|
||||
initiator?: null;
|
||||
id?: string;
|
||||
environmentId?: string;
|
||||
name?: string;
|
||||
processDefinitionId?: string;
|
||||
processDefinitionName?: string;
|
||||
processDefinitionKey?: string;
|
||||
status?: string;
|
||||
startDate?: string;
|
||||
businessKey?: string;
|
||||
lastModified?: string;
|
||||
lastModifiedTo?: string;
|
||||
lastModifiedFrom?: string;
|
||||
startFrom?: string;
|
||||
startTo?: string;
|
||||
completedFrom?: string;
|
||||
completedTo?: string;
|
||||
suspendedFrom?: string;
|
||||
suspendedTo?: string;
|
||||
completedDate?: string;
|
||||
maxItems: number;
|
||||
skipCount: number;
|
||||
sorting?: ProcessListCloudSortingModel[];
|
||||
variableKeys?: string[];
|
||||
appName: string;
|
||||
appVersion?: number | string;
|
||||
initiator?: null;
|
||||
id?: string;
|
||||
environmentId?: string;
|
||||
name?: string;
|
||||
processDefinitionId?: string;
|
||||
processDefinitionName?: string;
|
||||
processDefinitionKey?: string;
|
||||
status?: string;
|
||||
startDate?: string;
|
||||
businessKey?: string;
|
||||
lastModified?: string;
|
||||
lastModifiedTo?: string;
|
||||
lastModifiedFrom?: string;
|
||||
startFrom?: string;
|
||||
startTo?: string;
|
||||
completedFrom?: string;
|
||||
completedTo?: string;
|
||||
suspendedFrom?: string;
|
||||
suspendedTo?: string;
|
||||
completedDate?: string;
|
||||
maxItems: number;
|
||||
skipCount: number;
|
||||
sorting?: ProcessListCloudSortingModel[];
|
||||
variableKeys?: string[];
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
this.appName = obj.appName;
|
||||
this.appVersion = obj.appVersion;
|
||||
this.initiator = obj.initiator;
|
||||
this.id = obj.id;
|
||||
this.environmentId = obj.environmentId;
|
||||
this.name = obj.name;
|
||||
this.processDefinitionId = obj.processDefinitionId;
|
||||
this.processDefinitionName = obj.processDefinitionName;
|
||||
this.processDefinitionKey = obj.processDefinitionKey;
|
||||
this.status = obj.status;
|
||||
this.startDate = obj.startDate;
|
||||
this.businessKey = obj.businessKey;
|
||||
this.lastModified = obj.lastModified;
|
||||
this.lastModifiedTo = obj.lastModifiedTo;
|
||||
this.lastModifiedFrom = obj.lastModifiedFrom;
|
||||
this.startFrom = obj.startFrom;
|
||||
this.startTo = obj.startTo;
|
||||
this.completedFrom = obj.completedFrom;
|
||||
this.completedTo = obj.completedTo;
|
||||
this.suspendedFrom = obj.suspendedFrom;
|
||||
this.suspendedTo = obj.suspendedTo;
|
||||
this.completedDate = obj.completedDate;
|
||||
this.maxItems = obj.maxItems;
|
||||
this.skipCount = obj.skipCount;
|
||||
this.sorting = obj.sorting;
|
||||
this.variableKeys = obj.variableKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProcessListRequestProcessVariableFilter {
|
||||
processDefinitionKey?: string;
|
||||
name?: string;
|
||||
type?: string;
|
||||
value?: string;
|
||||
operator?: string;
|
||||
if (obj) {
|
||||
this.appName = obj.appName;
|
||||
this.appVersion = obj.appVersion;
|
||||
this.initiator = obj.initiator;
|
||||
this.id = obj.id;
|
||||
this.environmentId = obj.environmentId;
|
||||
this.name = obj.name;
|
||||
this.processDefinitionId = obj.processDefinitionId;
|
||||
this.processDefinitionName = obj.processDefinitionName;
|
||||
this.processDefinitionKey = obj.processDefinitionKey;
|
||||
this.status = obj.status;
|
||||
this.startDate = obj.startDate;
|
||||
this.businessKey = obj.businessKey;
|
||||
this.lastModified = obj.lastModified;
|
||||
this.lastModifiedTo = obj.lastModifiedTo;
|
||||
this.lastModifiedFrom = obj.lastModifiedFrom;
|
||||
this.startFrom = obj.startFrom;
|
||||
this.startTo = obj.startTo;
|
||||
this.completedFrom = obj.completedFrom;
|
||||
this.completedTo = obj.completedTo;
|
||||
this.suspendedFrom = obj.suspendedFrom;
|
||||
this.suspendedTo = obj.suspendedTo;
|
||||
this.completedDate = obj.completedDate;
|
||||
this.maxItems = obj.maxItems;
|
||||
this.skipCount = obj.skipCount;
|
||||
this.sorting = obj.sorting;
|
||||
this.variableKeys = obj.variableKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ProcessListRequestModel {
|
||||
@@ -105,7 +97,7 @@ export class ProcessListRequestModel {
|
||||
suspendedFrom?: string;
|
||||
suspendedTo?: string;
|
||||
|
||||
processVariableFilters?: ProcessListRequestProcessVariableFilter[];
|
||||
processVariableFilters?: ProcessVariableFilterModel[];
|
||||
processVariableKeys?: string[];
|
||||
|
||||
constructor(obj: Partial<ProcessListRequestModel>) {
|
||||
@@ -130,6 +122,7 @@ export class ProcessListRequestModel {
|
||||
this.suspendedFrom = obj.suspendedFrom;
|
||||
this.suspendedTo = obj.suspendedTo;
|
||||
this.processVariableKeys = obj.processVariableKeys;
|
||||
this.processVariableFilters = obj.processVariableFilters;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +141,7 @@ export class ProcessFilterCloudAdapter extends ProcessListRequestModel {
|
||||
initiator: filter.initiators,
|
||||
appVersion: filter.appVersions,
|
||||
status: filter.statuses,
|
||||
processVariableFilters: filter.processVariableFilters,
|
||||
lastModifiedFrom: filter.lastModifiedFrom?.toISOString(),
|
||||
lasModifiedTo: filter.lastModifiedTo?.toISOString(),
|
||||
startFrom: filter.startFrom,
|
||||
|
@@ -114,7 +114,8 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
completedTo: requestNode.completedTo,
|
||||
suspendedFrom: requestNode.suspendedFrom,
|
||||
suspendedTo: requestNode.suspendedTo,
|
||||
processVariableKeys: requestNode.processVariableKeys
|
||||
processVariableKeys: requestNode.processVariableKeys,
|
||||
processVariableFilters: requestNode.processVariableFilters
|
||||
};
|
||||
|
||||
if (requestNode.sorting) {
|
||||
|
Reference in New Issue
Block a user