mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-40544 Add ability to filter out subprocesses (#11445)
* AAE-40544 Add ability to filter out subprocesses * dont send the value if not false * units
This commit is contained in:
+2
@@ -47,6 +47,7 @@ export class ProcessFilterCloudModel {
|
|||||||
completedDateType: DateCloudFilterType | null;
|
completedDateType: DateCloudFilterType | null;
|
||||||
startedDateType: DateCloudFilterType | null;
|
startedDateType: DateCloudFilterType | null;
|
||||||
suspendedDateType: DateCloudFilterType | null;
|
suspendedDateType: DateCloudFilterType | null;
|
||||||
|
includeSubprocesses: boolean | null;
|
||||||
completedDate: Date | null;
|
completedDate: Date | null;
|
||||||
environmentId: string | null;
|
environmentId: string | null;
|
||||||
showCounter: boolean;
|
showCounter: boolean;
|
||||||
@@ -112,6 +113,7 @@ export class ProcessFilterCloudModel {
|
|||||||
this.completedDate = obj.completedDate || null;
|
this.completedDate = obj.completedDate || null;
|
||||||
this._suspendedFrom = obj._suspendedFrom || null;
|
this._suspendedFrom = obj._suspendedFrom || null;
|
||||||
this._suspendedTo = obj._suspendedTo || null;
|
this._suspendedTo = obj._suspendedTo || null;
|
||||||
|
this.includeSubprocesses = obj.includeSubprocesses || null;
|
||||||
|
|
||||||
this.initArrayProperties(obj);
|
this.initArrayProperties(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
+27
@@ -677,6 +677,33 @@ describe('ProcessListCloudComponent', () => {
|
|||||||
expect(component.processListRequestNode.appVersion.length).toEqual(0);
|
expect(component.processListRequestNode.appVersion.length).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set includeSubprocesses to true in request node when input is true', () => {
|
||||||
|
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||||
|
component.includeSubprocesses = true;
|
||||||
|
component.ngAfterContentInit();
|
||||||
|
component.reload();
|
||||||
|
|
||||||
|
expect(component.processListRequestNode.includeSubprocesses).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set includeSubprocesses to false in request node when input is false', () => {
|
||||||
|
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||||
|
component.includeSubprocesses = false;
|
||||||
|
component.ngAfterContentInit();
|
||||||
|
component.reload();
|
||||||
|
|
||||||
|
expect(component.processListRequestNode.includeSubprocesses).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should omit includeSubprocesses in request node when input is null', () => {
|
||||||
|
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||||
|
component.includeSubprocesses = null;
|
||||||
|
component.ngAfterContentInit();
|
||||||
|
component.reload();
|
||||||
|
|
||||||
|
expect(component.processListRequestNode.includeSubprocesses).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
it('should return the results if an application name is given', (done) => {
|
it('should return the results if an application name is given', (done) => {
|
||||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||||
|
|||||||
+5
@@ -290,6 +290,10 @@ export class ProcessListCloudComponent
|
|||||||
@Input()
|
@Input()
|
||||||
processVariables: ProcessVariableFilterModel[];
|
processVariables: ProcessVariableFilterModel[];
|
||||||
|
|
||||||
|
/** Include subprocesses in the process list. */
|
||||||
|
@Input()
|
||||||
|
includeSubprocesses: boolean | null = null;
|
||||||
|
|
||||||
/** Emitted when a row in the process list is clicked. */
|
/** Emitted when a row in the process list is clicked. */
|
||||||
@Output()
|
@Output()
|
||||||
rowClick: EventEmitter<string> = new EventEmitter<string>();
|
rowClick: EventEmitter<string> = new EventEmitter<string>();
|
||||||
@@ -606,6 +610,7 @@ export class ProcessListCloudComponent
|
|||||||
completedTo: this.completedTo,
|
completedTo: this.completedTo,
|
||||||
suspendedFrom: this.suspendedFrom,
|
suspendedFrom: this.suspendedFrom,
|
||||||
suspendedTo: this.suspendedTo,
|
suspendedTo: this.suspendedTo,
|
||||||
|
includeSubprocesses: this.includeSubprocesses,
|
||||||
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
||||||
processVariableFilters: this.processVariables
|
processVariableFilters: this.processVariables
|
||||||
};
|
};
|
||||||
|
|||||||
+3
@@ -102,6 +102,7 @@ export class ProcessListRequestModel {
|
|||||||
completedTo?: string;
|
completedTo?: string;
|
||||||
suspendedFrom?: string;
|
suspendedFrom?: string;
|
||||||
suspendedTo?: string;
|
suspendedTo?: string;
|
||||||
|
includeSubprocesses?: boolean;
|
||||||
|
|
||||||
processVariableFilters?: ProcessVariableFilterModel[];
|
processVariableFilters?: ProcessVariableFilterModel[];
|
||||||
processVariableKeys?: string[];
|
processVariableKeys?: string[];
|
||||||
@@ -130,6 +131,8 @@ export class ProcessListRequestModel {
|
|||||||
this.completedTo = obj.completedTo;
|
this.completedTo = obj.completedTo;
|
||||||
this.suspendedFrom = obj.suspendedFrom;
|
this.suspendedFrom = obj.suspendedFrom;
|
||||||
this.suspendedTo = obj.suspendedTo;
|
this.suspendedTo = obj.suspendedTo;
|
||||||
|
this.includeSubprocesses = obj.includeSubprocesses;
|
||||||
|
|
||||||
this.processVariableKeys = obj.processVariableKeys;
|
this.processVariableKeys = obj.processVariableKeys;
|
||||||
this.processVariableFilters = obj.processVariableFilters;
|
this.processVariableFilters = obj.processVariableFilters;
|
||||||
}
|
}
|
||||||
|
|||||||
+40
@@ -174,6 +174,46 @@ describe('ProcessListCloudService', () => {
|
|||||||
|
|
||||||
expect(error).toBe('Appname not configured');
|
expect(error).toBe('Appname not configured');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should include includeSubprocesses=true in body', async () => {
|
||||||
|
const processRequest = {
|
||||||
|
appName: 'fakeName',
|
||||||
|
pagination: { skipCount: 0, maxItems: 20 },
|
||||||
|
includeSubprocesses: true
|
||||||
|
} as ProcessListRequestModel;
|
||||||
|
requestSpy.and.callFake(returnCallBody);
|
||||||
|
|
||||||
|
const requestBodyParams = await firstValueFrom(service.fetchProcessList(processRequest));
|
||||||
|
|
||||||
|
expect(requestBodyParams).toEqual({ includeSubprocesses: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include includeSubprocesses=false in body', async () => {
|
||||||
|
const processRequest = {
|
||||||
|
appName: 'fakeName',
|
||||||
|
pagination: { skipCount: 0, maxItems: 20 },
|
||||||
|
includeSubprocesses: false
|
||||||
|
} as ProcessListRequestModel;
|
||||||
|
requestSpy.and.callFake(returnCallBody);
|
||||||
|
|
||||||
|
const requestBodyParams = await firstValueFrom(service.fetchProcessList(processRequest));
|
||||||
|
|
||||||
|
expect(requestBodyParams).toEqual({ includeSubprocesses: false });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should omit includeSubprocesses when null', async () => {
|
||||||
|
const processRequest = {
|
||||||
|
appName: 'fakeName',
|
||||||
|
pagination: { skipCount: 0, maxItems: 20 },
|
||||||
|
includeSubprocesses: null
|
||||||
|
} as unknown as ProcessListRequestModel;
|
||||||
|
requestSpy.and.callFake(returnCallBody);
|
||||||
|
|
||||||
|
const requestBodyParams = await firstValueFrom(service.fetchProcessList(processRequest));
|
||||||
|
|
||||||
|
expect(requestBodyParams).toEqual({});
|
||||||
|
expect(requestBodyParams.includeSubprocesses).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getAdminProcessRequest', () => {
|
describe('getAdminProcessRequest', () => {
|
||||||
|
|||||||
+3
-2
@@ -118,7 +118,8 @@ export class ProcessListCloudService extends BaseCloudService {
|
|||||||
suspendedFrom: requestNode.suspendedFrom,
|
suspendedFrom: requestNode.suspendedFrom,
|
||||||
suspendedTo: requestNode.suspendedTo,
|
suspendedTo: requestNode.suspendedTo,
|
||||||
processVariableKeys: requestNode.processVariableKeys,
|
processVariableKeys: requestNode.processVariableKeys,
|
||||||
processVariableFilters: requestNode.processVariableFilters
|
processVariableFilters: requestNode.processVariableFilters,
|
||||||
|
includeSubprocesses: requestNode.includeSubprocesses
|
||||||
};
|
};
|
||||||
|
|
||||||
if (requestNode.sorting) {
|
if (requestNode.sorting) {
|
||||||
@@ -147,7 +148,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
|||||||
*/
|
*/
|
||||||
Object.keys(queryData).forEach((key) => {
|
Object.keys(queryData).forEach((key) => {
|
||||||
const value = queryData[key];
|
const value = queryData[key];
|
||||||
const isValueEmpty = !value;
|
const isValueEmpty = value === undefined || value === null || value === '';
|
||||||
const isValueArrayWithEmptyValue = Array.isArray(value) && (value.length === 0 || value[0] === null);
|
const isValueArrayWithEmptyValue = Array.isArray(value) && (value.length === 0 || value[0] === null);
|
||||||
if (isValueEmpty || isValueArrayWithEmptyValue) {
|
if (isValueEmpty || isValueArrayWithEmptyValue) {
|
||||||
delete queryData[key];
|
delete queryData[key];
|
||||||
|
|||||||
Reference in New Issue
Block a user