AAE-29002 Allow to filter processes by parentId (#10453)

* AAE-29002 Allow to filter processes by parentId

* AAE-29002 Move payload tests under describe Payload

* AAE-29002 Set parentId as optional
This commit is contained in:
Amedeo Lepore 2024-12-03 16:48:46 +01:00 committed by GitHub
parent b3cef95199
commit c92d34f2f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 60 additions and 20 deletions

View File

@ -253,6 +253,7 @@
"SUSPENDED_DATE": "Suspended Date", "SUSPENDED_DATE": "Suspended Date",
"STARTED_BY": "Started by", "STARTED_BY": "Started by",
"COMPLETED_DATE": "Completed Date", "COMPLETED_DATE": "Completed Date",
"MAIN_PROCESS_ID": "Main process id",
"DATE_RANGE": { "DATE_RANGE": {
"NO_DATE": "No Date", "NO_DATE": "No Date",
"TODAY": "Today", "TODAY": "Today",

View File

@ -691,6 +691,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges {
key: 'appVersion', key: 'appVersion',
value: 'appVersion' value: 'appVersion'
}, },
{
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.MAIN_PROCESS_ID',
key: 'parentId',
value: 'parentId'
},
{ {
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID', label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID',
key: 'processInstanceId', key: 'processInstanceId',
@ -767,6 +772,12 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges {
key: 'processInstanceId', key: 'processInstanceId',
value: filterModel.processInstanceId || '' value: filterModel.processInstanceId || ''
}, },
{
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.MAIN_PROCESS_ID',
type: 'text',
key: 'parentId',
value: filterModel.parentId
},
{ {
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME', label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
type: 'text', type: 'text',

View File

@ -30,6 +30,7 @@ export class ProcessFilterCloudModel {
index: number; index: number;
appName: string; appName: string;
appVersion?: number | number[]; appVersion?: number | number[];
parentId?: string;
processName: string; processName: string;
processInstanceId: string; processInstanceId: string;
initiator: string; initiator: string;
@ -81,6 +82,7 @@ export class ProcessFilterCloudModel {
} }
this.processInstanceId = obj.processInstanceId || null; this.processInstanceId = obj.processInstanceId || null;
this.parentId = obj.parentId || '';
this.processName = obj.processName || null; this.processName = obj.processName || null;
this.initiator = obj.initiator || null; this.initiator = obj.initiator || null;
this.status = obj.status || null; this.status = obj.status || null;

View File

@ -152,6 +152,7 @@ describe('ProcessListCloudComponent', () => {
expect(component.rows.length).toEqual(3); expect(component.rows.length).toEqual(3);
}); });
describe('Payload', () => {
it('should the payload contain the appVersion if it is defined', () => { it('should the payload contain the appVersion if it is defined', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = 1; component.appVersion = 1;
@ -179,6 +180,24 @@ describe('ProcessListCloudComponent', () => {
expect(component.requestNode.appVersion).toEqual(''); expect(component.requestNode.appVersion).toEqual('');
}); });
it('should the payload contain the parentId if it is defined', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.parentId = 'fake-parent-id';
component.ngAfterContentInit();
component.reload();
expect(component.requestNode.parentId).toEqual('fake-parent-id');
});
it('should the payload contain an empty parentId if it is NOT defined', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.ngAfterContentInit();
component.reload();
expect(component.requestNode.parentId).toBeUndefined();
});
});
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, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);

View File

@ -109,6 +109,10 @@ export class ProcessListCloudComponent
@Input() @Input()
name: string = ''; name: string = '';
/** Filter the processes to display only the ones with this parentId. */
@Input()
parentId?: string;
/** Filter the processes to display only the ones with this process definition ID. */ /** Filter the processes to display only the ones with this process definition ID. */
@Input() @Input()
processDefinitionId: string = ''; processDefinitionId: string = '';
@ -606,6 +610,7 @@ export class ProcessListCloudComponent
id: this.id, id: this.id,
environmentId: this.environmentId, environmentId: this.environmentId,
name: this.name, name: this.name,
parentId: this.parentId,
processDefinitionId: this.processDefinitionId, processDefinitionId: this.processDefinitionId,
processDefinitionName: this.processDefinitionName, processDefinitionName: this.processDefinitionName,
processDefinitionKey: this.processDefinitionKey, processDefinitionKey: this.processDefinitionKey,

View File

@ -27,6 +27,7 @@ export class ProcessQueryCloudRequestModel {
id?: string; id?: string;
environmentId?: string; environmentId?: string;
name?: string; name?: string;
parentId?: string;
processDefinitionId?: string; processDefinitionId?: string;
processDefinitionName?: string; processDefinitionName?: string;
processDefinitionKey?: string; processDefinitionKey?: string;
@ -56,6 +57,7 @@ export class ProcessQueryCloudRequestModel {
this.id = obj.id; this.id = obj.id;
this.environmentId = obj.environmentId; this.environmentId = obj.environmentId;
this.name = obj.name; this.name = obj.name;
this.parentId = obj.parentId;
this.processDefinitionId = obj.processDefinitionId; this.processDefinitionId = obj.processDefinitionId;
this.processDefinitionName = obj.processDefinitionName; this.processDefinitionName = obj.processDefinitionName;
this.processDefinitionKey = obj.processDefinitionKey; this.processDefinitionKey = obj.processDefinitionKey;