Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAE-29002 Allow to filter processes by parentId #10453

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/process-services-cloud/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
"SUSPENDED_DATE": "Suspended Date",
"STARTED_BY": "Started by",
"COMPLETED_DATE": "Completed Date",
"MAIN_PROCESS_ID": "Main process id",
"DATE_RANGE": {
"NO_DATE": "No Date",
"TODAY": "Today",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges {
key: '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',
key: 'processInstanceId',
Expand Down Expand Up @@ -767,6 +772,12 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges {
key: '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',
type: 'text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class ProcessFilterCloudModel {
index: number;
appName: string;
appVersion?: number | number[];
parentId?: string;
processName: string;
processInstanceId: string;
initiator: string;
Expand Down Expand Up @@ -81,6 +82,7 @@ export class ProcessFilterCloudModel {
}

this.processInstanceId = obj.processInstanceId || null;
this.parentId = obj.parentId || '';
this.processName = obj.processName || null;
this.initiator = obj.initiator || null;
this.status = obj.status || null;
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small improvement suggestion: Group this "it should the payload contain..." tests under a describe("Payload") and refactor the tests, by running this spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList)); in a beforeEach and renaming the tests to "it should contain..." (more readable)

Original file line number Diff line number Diff line change
Expand Up @@ -152,31 +152,50 @@ describe('ProcessListCloudComponent', () => {
expect(component.rows.length).toEqual(3);
});

it('should the payload contain the appVersion if it is defined', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = 1;
component.ngAfterContentInit();
component.reload();
describe('Payload', () => {
it('should the payload contain the appVersion if it is defined', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = 1;
component.ngAfterContentInit();
component.reload();

expect(component.requestNode.appVersion).toEqual('1');
});
expect(component.requestNode.appVersion).toEqual('1');
});

it('should the payload contain all the app versions joined by a comma separator', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = [1, 2, 3];
component.ngAfterContentInit();
component.reload();
it('should the payload contain all the app versions joined by a comma separator', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = [1, 2, 3];
component.ngAfterContentInit();
component.reload();

expect(component.requestNode.appVersion).toEqual('1,2,3');
});
expect(component.requestNode.appVersion).toEqual('1,2,3');
});

it('should the payload NOT contain any app version when appVersion does not have a value', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = undefined;
component.ngAfterContentInit();
component.reload();
it('should the payload NOT contain any app version when appVersion does not have a value', () => {
spyOn(processListCloudService, 'getProcessByRequest').and.returnValue(of(fakeProcessCloudList));
component.appVersion = undefined;
component.ngAfterContentInit();
component.reload();

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) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export class ProcessListCloudComponent
@Input()
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. */
@Input()
processDefinitionId: string = '';
Expand Down Expand Up @@ -606,6 +610,7 @@ export class ProcessListCloudComponent
id: this.id,
environmentId: this.environmentId,
name: this.name,
parentId: this.parentId,
processDefinitionId: this.processDefinitionId,
processDefinitionName: this.processDefinitionName,
processDefinitionKey: this.processDefinitionKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class ProcessQueryCloudRequestModel {
id?: string;
environmentId?: string;
name?: string;
parentId?: string;
processDefinitionId?: string;
processDefinitionName?: string;
processDefinitionKey?: string;
Expand Down Expand Up @@ -56,6 +57,7 @@ export class ProcessQueryCloudRequestModel {
this.id = obj.id;
this.environmentId = obj.environmentId;
this.name = obj.name;
this.parentId = obj.parentId;
this.processDefinitionId = obj.processDefinitionId;
this.processDefinitionName = obj.processDefinitionName;
this.processDefinitionKey = obj.processDefinitionKey;
Expand Down
Loading