[AAE-2020] Add release version filter for process instances (#5581)

* [AAE-2020] Add release version filter for process instances

* Updated unit tests

* Updated unit test case

* Added translation key
This commit is contained in:
Mercy Chrysolite 2020-04-27 04:40:48 +05:30 committed by GitHub
parent 8f68899ce0
commit f03592f230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 6 deletions

View File

@ -19,7 +19,8 @@
"PROCESS_NAME": "Process Name",
"PARENT_TASK_ID": "Parent Task Id",
"PROCESS_DEF_ID": "Process Definition Id",
"PROCESS_DEF_KEY": "Process Definition Key"
"PROCESS_DEF_KEY": "Process Definition Key",
"APP_VERSION": "App Release Version"
},
"ADF_CLOUD_START_PROCESS": {
"BUTTON": "Start Process",
@ -159,7 +160,8 @@
"LAST_MODIFIED": "LastModified",
"LAST_MODIFIED_DATE_FORM": "LastModifiedFrom",
"LAST_MODIFIED_TO": "LastModifiedTo",
"PROCESS_NAME": "ProcessName"
"PROCESS_NAME": "ProcessName",
"APP_VERSION": "AppReleaseVersion"
},
"ERROR": {
"DATE": "Date format DD/MM/YYYY"

View File

@ -41,6 +41,13 @@
placeholder="{{processFilterProperty.label | translate}}"
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
</mat-form-field>
<mat-form-field fxFlex="23%" *ngIf="isNumberType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
<input matInput
[formControlName]="processFilterProperty.key"
type="number" min="0"
placeholder="{{processFilterProperty.label | translate}}"
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key"/>
</mat-form-field>
<mat-form-field fxFlex="23%" *ngIf="isDateType(processFilterProperty)" [attr.data-automation-id]="processFilterProperty.key">
<mat-label>{{processFilterProperty.label | translate}}</mat-label>
<input

View File

@ -50,6 +50,7 @@ describe('EditProcessFilterCloudComponent', () => {
id: 'mock-process-filter-id',
status: 'RUNNING',
appName: 'mock-app-name',
appVersion: 1,
processDefinitionId: 'process-def-id',
order: 'ASC',
sort: 'id'
@ -345,6 +346,25 @@ describe('EditProcessFilterCloudComponent', () => {
});
}));
it('should fetch applications when appName and appVersion input is set', async(() => {
fixture.detectChanges();
component.filterProperties = ['appName', 'processName', 'appVersion'];
fixture.detectChanges();
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
component.ngOnChanges({ 'id': processFilterIdChange });
fixture.detectChanges();
const appController = component.editProcessFilterForm.get('appName');
const appVersionController = component.editProcessFilterForm.get('appVersion');
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(getRunningApplicationsSpy).toHaveBeenCalled();
expect(appController).toBeDefined();
expect(appController.value).toEqual('mock-app-name');
expect(appVersionController).toBeDefined();
expect(appVersionController.value).toEqual(1);
});
}));
it('should display default sort properties', async(() => {
const processFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
component.ngOnChanges({ 'id': processFilterIdChange });

View File

@ -428,6 +428,10 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
return property.type === 'text';
}
isNumberType(property: ProcessFilterProperties): boolean {
return property.type === 'number';
}
hasFormChanged(action: any): boolean {
if (action.actionType === EditProcessFilterCloudComponent.ACTION_SAVE) {
return !this.formHasBeenChanged;
@ -500,6 +504,12 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
value: currentProcessFilter.appName || '',
options: this.applicationNames
}),
new ProcessFilterProperties({
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.APP_VERSION',
type: 'number',
key: 'appVersion',
value: currentProcessFilter.appVersion
}),
new ProcessFilterProperties({
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_INS_ID',
type: 'text',

View File

@ -22,6 +22,7 @@ export class ProcessFilterCloudModel {
icon: string;
index: number;
appName: string;
appVersion?: number;
processName: string;
processInstanceId: string;
initiator: string;
@ -42,6 +43,7 @@ export class ProcessFilterCloudModel {
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
this.appVersion = obj.appVersion || null;
this.processInstanceId = obj.processInstanceId || null;
this.processName = obj.processName || null;
this.initiator = obj.initiator || null;

View File

@ -180,7 +180,7 @@ describe('ProcessListCloudComponent', () => {
expect(component.rows).toBeDefined();
expect(component.rows.length).toEqual(3);
expect(component.rows[0].entry['appName']).toBe('easy-peasy-japanesey');
expect(component.rows[0].entry['appVersion']).toBe('');
expect(component.rows[0].entry['appVersion']).toBe(1);
expect(component.rows[0].entry['id']).toBe('69eddfa7-d781-11e8-ae24-0a58646001fa');
expect(component.rows[0].entry['name']).toEqual('starring');
expect(component.rows[0].entry['processDefinitionId']).toBe('BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa');

View File

@ -46,6 +46,10 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
@Input()
appName: string = '';
/** The release version of the application. */
@Input()
appVersion: number;
/** Name of the initiator of the process. */
@Input()
initiator: string = '';
@ -267,6 +271,7 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnChan
private createRequestNode(): ProcessQueryCloudRequestModel {
const requestNode = {
appName: this.appName,
appVersion: this.appVersion,
maxItems: this.size,
skipCount: this.skipCount,
initiator: this.initiator,

View File

@ -23,7 +23,7 @@ export const fakeProcessCloudList = {
{
entry: {
appName: 'easy-peasy-japanesey',
appVersion: '',
appVersion: 1,
id: '69eddfa7-d781-11e8-ae24-0a58646001fa',
name: 'starring',
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
@ -40,7 +40,7 @@ export const fakeProcessCloudList = {
{
entry: {
appName: 'easy-peasy-japanesey',
appVersion: '',
appVersion: 1,
id: '8b3f625f-d781-11e8-ae24-0a58646001fa',
name: null,
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
@ -57,7 +57,7 @@ export const fakeProcessCloudList = {
{
entry: {
appName: 'easy-peasy-japanesey',
appVersion: '',
appVersion: 2,
id: '87c12637-d783-11e8-ae24-0a58646001fa',
name: null,
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',

View File

@ -19,6 +19,7 @@ import { ProcessListCloudSortingModel } from './process-list-sorting.model';
export class ProcessQueryCloudRequestModel {
appName: string;
appVersion?: number;
initiator?: null;
id?: string;
name?: string;
@ -36,6 +37,7 @@ export class ProcessQueryCloudRequestModel {
constructor(obj?: any) {
if (obj) {
this.appName = obj.appName;
this.appVersion = obj.appVersion;
this.initiator = obj.initiator;
this.id = obj.id;
this.name = obj.name;