[AAE-12288] Enable Environment Id filtering support (#8360)

* [AAE-12288] Add environment context to process-instances, user-tasks and service-tasks

* [AAE-12288] Add environment type

* [AAE-12288] add unit tests for environment aware logic

* [AAE-12288] remove mock barrel import and remove code duplication

* [AAE-12288] Update docs
This commit is contained in:
Diogo Bastos
2023-04-04 16:12:19 +01:00
committed by GitHub
parent ea90cb17a0
commit 6a9129c931
28 changed files with 280 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
Title: Edit Process Filter Cloud component Title: Edit Process Filter Cloud component
Added: v3.0.0 Added: v3.0.0
Status: Experimental Status: Experimental
Last reviewed: 2019-04-10 Last reviewed: 2023-04-03
--- ---
# [Edit Process Filter Cloud component](../../../lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts "Defined in edit-process-filter-cloud.component.ts") # [Edit Process Filter Cloud component](../../../lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts "Defined in edit-process-filter-cloud.component.ts")
@@ -47,6 +47,8 @@ Shows/edits process filter details.
| appName | `string` | "" | The name of the application. | | appName | `string` | "" | The name of the application. |
| filterProperties | `string[]` | | List of process filter properties to display | | filterProperties | `string[]` | | List of process filter properties to display |
| id | `string` | | Id of the process instance filter. | | id | `string` | | Id of the process instance filter. |
| environmentId | `string` | | Environment Id of the process instance filter. |
| environmentList | `string[]` | | List of environments. |
| role | `string` | "" | roles to filter the apps | | role | `string` | "" | roles to filter the apps |
| showFilterActions | `boolean` | true | Toggles editing of process filter actions. | | showFilterActions | `boolean` | true | Toggles editing of process filter actions. |
| showProcessFilterName | `boolean` | true | Toggles the appearance of the process filter name . | | showProcessFilterName | `boolean` | true | Toggles the appearance of the process filter name . |

View File

@@ -2,7 +2,7 @@
Title: Edit Task Filter Cloud component Title: Edit Task Filter Cloud component
Added: v3.0.0 Added: v3.0.0
Status: Experimental Status: Experimental
Last reviewed: 2019-03-27 Last reviewed: 2023-04-03
--- ---
# [Edit Task Filter Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts "Defined in edit-task-filter-cloud.component.ts") # [Edit Task Filter Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts "Defined in edit-task-filter-cloud.component.ts")
@@ -47,6 +47,8 @@ Edits task filter details.
| appName | `string` | "" | (required) Name of the app. | | appName | `string` | "" | (required) Name of the app. |
| filterProperties | `string[]` | \[] | List of task filter properties to display. | | filterProperties | `string[]` | \[] | List of task filter properties to display. |
| id | `string` | | (required) ID of the task filter. | | id | `string` | | (required) ID of the task filter. |
| environmentId | `string` | | Environment Id of the task filter. |
| environmentList | `string[]` | | List of environments. |
| processInstanceId | `string` | | processInstanceId of the task filter. | | processInstanceId | `string` | | processInstanceId of the task filter. |
| role | `string` | "" | user role. | | role | `string` | "" | user role. |
| showFilterActions | `boolean` | true | Toggles the filter actions. | | showFilterActions | `boolean` | true | Toggles the filter actions. |

View File

@@ -2,7 +2,7 @@
Title: Apps Process Cloud Service Title: Apps Process Cloud Service
Added: v3.0.0 Added: v3.0.0
Status: Experimental Status: Experimental
Last reviewed: 2019-01-09 Last reviewed: 2023-04-03
--- ---
# [Apps Process Cloud Service](../../../lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts "Defined in apps-process-cloud.service.ts") # [Apps Process Cloud Service](../../../lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts "Defined in apps-process-cloud.service.ts")
@@ -24,6 +24,11 @@ Gets details of deployed apps for the current user.
- **loadApps**()<br/> - **loadApps**()<br/>
- **getApplicationLabel**(application: `ApplicationInstanceModel`, environmentList?: `Environment[]`): `string`<br/>
Gets application label.
- application:_ `ApplicationInstanceModel` - Required application
- environmentList:_ `Environment[]` - (Optional) to add environment name in front of application name
- **Returns** `string` - The application label.
## Details ## Details
This service implements some features of the [Apps process service](../../core/services/apps-process.service.md) This service implements some features of the [Apps process service](../../core/services/apps-process.service.md)

View File

@@ -15,6 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { fakeEnvironmentList } from '../../common/mock/environment.mock';
import { ApplicationInstanceModel } from '../models/application-instance.model'; import { ApplicationInstanceModel } from '../models/application-instance.model';
export const fakeApplicationInstance: ApplicationInstanceModel[] = [ export const fakeApplicationInstance: ApplicationInstanceModel[] = [
@@ -22,3 +23,9 @@ export const fakeApplicationInstance: ApplicationInstanceModel[] = [
{ name: 'application-new-2', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending', theme: 'theme-2', icon: 'favorite_border' }, { name: 'application-new-2', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending', theme: 'theme-2', icon: 'favorite_border' },
{ name: 'application-new-3', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending' } { name: 'application-new-3', createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending' }
]; ];
export const fakeApplicationInstanceWithEnvironment: ApplicationInstanceModel[] = [
{ name: 'application-new-1', environmentId: fakeEnvironmentList[0].id, createdAt: '2018-09-21T12:31:39.000Z', status: 'Running', theme: 'theme-2', icon: 'favorite_border' },
{ name: 'application-new-2', environmentId: fakeEnvironmentList[1].id,createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending', theme: 'theme-2', icon: 'favorite_border' },
{ name: 'application-new-3', environmentId: fakeEnvironmentList[2].id,createdAt: '2018-09-21T12:31:39.000Z', status: 'Pending' }
];

View File

@@ -27,6 +27,7 @@ export interface ApplicationInstanceModel {
description?: string; description?: string;
connectors?: any; connectors?: any;
descriptor?: Descriptor; descriptor?: Descriptor;
environmentId?: string;
} }
export interface Descriptor { export interface Descriptor {

View File

@@ -20,9 +20,10 @@ import { throwError } from 'rxjs';
import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core'; import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { AppsProcessCloudService } from './apps-process-cloud.service'; import { AppsProcessCloudService } from './apps-process-cloud.service';
import { fakeApplicationInstance } from '../mock/app-model.mock'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../mock/app-model.mock';
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { fakeEnvironmentList } from '../../common/mock/environment.mock';
describe('AppsProcessCloudService', () => { describe('AppsProcessCloudService', () => {
@@ -103,4 +104,15 @@ describe('AppsProcessCloudService', () => {
} }
); );
}); });
it('should return label with application name', () => {
const applicationLabel = service.getApplicationLabel(fakeApplicationInstance[0]);
expect(applicationLabel).toBe('application-new-1');
});
it('should return label with application name and environment name', () => {
const applicationLabel = service.getApplicationLabel(fakeApplicationInstanceWithEnvironment[0], fakeEnvironmentList);
expect(applicationLabel).toBe('application-new-1 (test-env-name-1)');
});
}); });

View File

@@ -21,6 +21,7 @@ import { map, catchError } from 'rxjs/operators';
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core'; import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
import { Oauth2Auth } from '@alfresco/js-api'; import { Oauth2Auth } from '@alfresco/js-api';
import { ApplicationInstanceModel } from '../models/application-instance.model'; import { ApplicationInstanceModel } from '../models/application-instance.model';
import { Environment } from '../../common/interface/environment.interface';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class AppsProcessCloudService { export class AppsProcessCloudService {
@@ -58,6 +59,16 @@ export class AppsProcessCloudService {
this.deployedApps = apps; this.deployedApps = apps;
} }
getApplicationLabel(application: ApplicationInstanceModel, environmentList?: Environment[]): string {
const envName = environmentList?.find((env: Environment) => env.id === application.environmentId)?.name;
if (application.environmentId && environmentList && envName) {
return `${application.name} (${envName})`;
} else {
return application.name;
}
}
private getApplicationsByStatus(status: string, role?: string): Observable<ApplicationInstanceModel[]> { private getApplicationsByStatus(status: string, role?: string): Observable<ApplicationInstanceModel[]> {
if (status === '') { if (status === '') {
return of([]); return of([]);

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';

View File

@@ -0,0 +1,21 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Environment {
id: string;
name: string;
}

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './public-api';

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './environment.interface';

View File

@@ -0,0 +1,33 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Environment } from '../interface/environment.interface';
export const fakeEnvironmentList: Environment[] = [
{
id: 'test-env-1',
name: 'test-env-name-1'
},
{
id: 'test-env-2',
name: 'test-env-name-2'
},
{
id: 'test-env-3',
name: 'test-env-name-3'
}
];

View File

@@ -0,0 +1,18 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './interface/index';

View File

@@ -21,6 +21,7 @@ export class TaskQueryCloudRequestModel {
appName: string; appName: string;
appVersion?: string; appVersion?: string;
assignee?: string; assignee?: string;
environmentId?: string;
claimedDate?: string; claimedDate?: string;
createdDate?: Date; createdDate?: Date;
createdFrom?: string; createdFrom?: string;
@@ -56,6 +57,7 @@ export class TaskQueryCloudRequestModel {
this.appName = obj.appName; this.appName = obj.appName;
this.appVersion = obj.appVersion; this.appVersion = obj.appVersion;
this.assignee = obj.assignee; this.assignee = obj.assignee;
this.environmentId = obj.environmentId;
this.claimedDate = obj.claimedDate; this.claimedDate = obj.claimedDate;
this.createdDate = obj.createdDate; this.createdDate = obj.createdDate;
this.createdFrom = obj.createdFrom; this.createdFrom = obj.createdFrom;

View File

@@ -30,7 +30,7 @@ import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model'; import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service'; import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service'; import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
import { fakeApplicationInstance } from './../../../app/mock/app-model.mock'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from './../../../app/mock/app-model.mock';
import moment from 'moment'; import moment from 'moment';
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service'; import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
@@ -41,6 +41,7 @@ import { MatIconTestingModule } from '@angular/material/icon/testing';
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model'; import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
import { mockAppVersions } from '../mock/process-filters-cloud.mock'; import { mockAppVersions } from '../mock/process-filters-cloud.mock';
import { DATE_FORMAT_CLOUD } from '../../../models/date-format-cloud.model'; import { DATE_FORMAT_CLOUD } from '../../../models/date-format-cloud.model';
import { fakeEnvironmentList } from '../../../common/mock/environment.mock';
describe('EditProcessFilterCloudComponent', () => { describe('EditProcessFilterCloudComponent', () => {
let component: EditProcessFilterCloudComponent; let component: EditProcessFilterCloudComponent;
@@ -1161,4 +1162,13 @@ describe('EditProcessFilterCloudComponent', () => {
expect(component.initiatorOptions).toEqual([{ username: 'user1' }, { username: 'user2' }]); expect(component.initiatorOptions).toEqual([{ username: 'user1' }, { username: 'user2' }]);
}); });
}); });
it('should add environment name to each application selector option label', () => {
component.environmentList = fakeEnvironmentList;
component.environmentId = fakeEnvironmentList[0].id;
getRunningApplicationsSpy.and.returnValue(of(fakeApplicationInstanceWithEnvironment));
component.getRunningApplications();
expect(component.applicationNames[0].label).toBe('application-new-1 (test-env-name-1)');
});
}); });

View File

@@ -30,6 +30,7 @@ import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud
import { ProcessCloudService } from '../../services/process-cloud.service'; import { ProcessCloudService } from '../../services/process-cloud.service';
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model'; import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
import { IdentityUserModel } from '../../../people/models/identity-user.model'; import { IdentityUserModel } from '../../../people/models/identity-user.model';
import { Environment } from '../../../common/interface/environment.interface';
export const PROCESS_FILTER_ACTION_SAVE = 'save'; export const PROCESS_FILTER_ACTION_SAVE = 'save';
export const PROCESS_FILTER_ACTION_SAVE_AS = 'saveAs'; export const PROCESS_FILTER_ACTION_SAVE_AS = 'saveAs';
@@ -76,6 +77,14 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input() @Input()
actions = DEFAULT_ACTIONS; actions = DEFAULT_ACTIONS;
/** Environment ID of the application. */
@Input()
environmentId: string;
/** List of environments. */
@Input()
environmentList: Environment[] = [];
/** Toggles editing of process filter actions. */ /** Toggles editing of process filter actions. */
@Input() @Input()
showFilterActions = true; showFilterActions = true;
@@ -118,6 +127,10 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
this.id = value.id; this.id = value.id;
} }
if (value?.environmentId) {
this.environmentId = value.environmentId;
}
this.processFilterProperties = this.createAndFilterProperties(); this.processFilterProperties = this.createAndFilterProperties();
this.processFilterActions = this.createAndFilterActions(); this.processFilterActions = this.createAndFilterActions();
@@ -400,7 +413,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
.subscribe((applications) => { .subscribe((applications) => {
if (applications && applications.length > 0) { if (applications && applications.length > 0) {
applications.map((application) => { applications.map((application) => {
this.applicationNames.push({ label: application.name, value: application.name }); this.applicationNames.push({ label: this.appsProcessCloudService.getApplicationLabel(application, this.environmentList), value: application.name });
}); });
} }
}); });
@@ -625,6 +638,11 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
key: 'id', key: 'id',
value: 'id' value: 'id'
}, },
{
label: 'EnvironmentId',
key: 'environmentId',
value: 'environmentId'
},
{ {
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME', label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
key: 'name', key: 'name',

View File

@@ -46,6 +46,7 @@ export class ProcessFilterCloudModel {
startedDateType: DateCloudFilterType; startedDateType: DateCloudFilterType;
suspendedDateType: DateCloudFilterType; suspendedDateType: DateCloudFilterType;
completedDate: Date; completedDate: Date;
environmentId?: string;
private dateRangeFilterService = new DateRangeFilterService(); private dateRangeFilterService = new DateRangeFilterService();
private _completedFrom: string; private _completedFrom: string;
@@ -60,6 +61,7 @@ export class ProcessFilterCloudModel {
this.id = obj.id || Math.random().toString(36).substring(2, 9); this.id = obj.id || Math.random().toString(36).substring(2, 9);
this.name = obj.name || null; this.name = obj.name || null;
this.key = obj.key || null; this.key = obj.key || null;
this.environmentId = obj.environmentId;
this.icon = obj.icon || null; this.icon = obj.icon || null;
this.index = obj.index || null; this.index = obj.index || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null; this.appName = obj.appName || obj.appName === '' ? obj.appName : null;

View File

@@ -61,7 +61,12 @@ export class ProcessFilterCloudService {
value = value || {}; value = value || {};
const result = { const result = {
appName: appName || value['appName'], appName: appName || value['appName'],
id: id || value['id'] id: id || value['id'],
...(
value['environmentId'] && {
environmentId: value['environmentId']
}
)
}; };
for (const prop of filterProperties) { for (const prop of filterProperties) {

View File

@@ -67,6 +67,10 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
@Input() @Input()
id: string = ''; id: string = '';
/** Filter the processes to display only the ones with this environment ID. */
@Input()
environmentId: string = '';
/** Filter the processes to display only the ones with this name. */ /** Filter the processes to display only the ones with this name. */
@Input() @Input()
name: string = ''; name: string = '';
@@ -455,6 +459,7 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
skipCount: this.skipCount, skipCount: this.skipCount,
initiator: this.initiator, initiator: this.initiator,
id: this.id, id: this.id,
environmentId: this.environmentId,
name: this.name, name: this.name,
processDefinitionId: this.processDefinitionId, processDefinitionId: this.processDefinitionId,
processDefinitionName: this.processDefinitionName, processDefinitionName: this.processDefinitionName,

View File

@@ -22,6 +22,7 @@ export class ProcessQueryCloudRequestModel {
appVersion?: number | string; appVersion?: number | string;
initiator?: null; initiator?: null;
id?: string; id?: string;
environmentId?: string;
name?: string; name?: string;
processDefinitionId?: string; processDefinitionId?: string;
processDefinitionName?: string; processDefinitionName?: string;
@@ -50,6 +51,7 @@ export class ProcessQueryCloudRequestModel {
this.appVersion = obj.appVersion; this.appVersion = obj.appVersion;
this.initiator = obj.initiator; this.initiator = obj.initiator;
this.id = obj.id; this.id = obj.id;
this.environmentId = obj.environmentId;
this.name = obj.name; this.name = obj.name;
this.processDefinitionId = obj.processDefinitionId; this.processDefinitionId = obj.processDefinitionId;
this.processDefinitionName = obj.processDefinitionName; this.processDefinitionName = obj.processDefinitionName;

View File

@@ -31,6 +31,7 @@ import { MatDialog } from '@angular/material/dialog';
import { IdentityUserModel } from '../../../../people/models/identity-user.model'; import { IdentityUserModel } from '../../../../people/models/identity-user.model';
import { IdentityGroupModel } from '../../../../group/models/identity-group.model'; import { IdentityGroupModel } from '../../../../group/models/identity-group.model';
import { MatSelectChange } from '@angular/material/select'; import { MatSelectChange } from '@angular/material/select';
import { Environment } from '../../../../common/interface/environment.interface';
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/naming-convention */
@@ -67,6 +68,10 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
@Input() @Input()
id: string; id: string;
/** List of environments. */
@Input()
environmentList: Environment[] = [];
/** processInstanceId of the task filter. */ /** processInstanceId of the task filter. */
@Input() @Input()
processInstanceId: string; processInstanceId: string;
@@ -99,14 +104,6 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
@Input() @Input()
sortProperties: string[] = []; sortProperties: string[] = [];
/** Task Filter to use*/
@Input()
taskFilter: T;
/** Emitted when a task filter property changes. */
@Output()
filterChange = new EventEmitter<T>();
/** Emitted when a filter action occurs (i.e Save, Save As, Delete). */ /** Emitted when a filter action occurs (i.e Save, Save As, Delete). */
@Output() @Output()
action = new EventEmitter<TaskFilterAction>(); action = new EventEmitter<TaskFilterAction>();
@@ -129,8 +126,15 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ALL' label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ALL'
}; };
@Input()
taskFilter: T;
changedTaskFilter: T; changedTaskFilter: T;
/** Emitted when a task filter property changes. */
@Output()
filterChange = new EventEmitter<T>();
protected onDestroy$ = new Subject<boolean>(); protected onDestroy$ = new Subject<boolean>();
isLoading: boolean = false; isLoading: boolean = false;
@@ -244,7 +248,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
.subscribe((applications) => { .subscribe((applications) => {
if (applications && applications.length > 0) { if (applications && applications.length > 0) {
applications.map((application) => { applications.map((application) => {
this.applicationNames.push({ label: application.name, value: application.name }); this.applicationNames.push({ label: this.appsProcessCloudService.getApplicationLabel(application, this.environmentList), value: application.name });
}); });
} }
}); });

View File

@@ -26,7 +26,7 @@ import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.ser
import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service';
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service'; import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
import { fakeApplicationInstance } from '../../../../app/mock/app-model.mock'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../../../../app/mock/app-model.mock';
import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { TaskFiltersCloudModule } from '../../task-filters-cloud.module';
import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service';
import { TaskCloudService } from '../../../services/task-cloud.service'; import { TaskCloudService } from '../../../services/task-cloud.service';
@@ -36,6 +36,8 @@ import { EditServiceTaskFilterCloudComponent } from './edit-service-task-filter-
import { MatIconTestingModule } from '@angular/material/icon/testing'; import { MatIconTestingModule } from '@angular/material/icon/testing';
import { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model'; import { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model';
import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component'; import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component';
import { fakeEnvironmentList } from '../../../../common/mock/environment.mock';
import { mockApplicationTaskFilterProperties } from '../../mock/edit-task-filter-cloud.mock';
describe('EditServiceTaskFilterCloudComponent', () => { describe('EditServiceTaskFilterCloudComponent', () => {
let component: EditServiceTaskFilterCloudComponent; let component: EditServiceTaskFilterCloudComponent;
@@ -750,4 +752,15 @@ describe('EditServiceTaskFilterCloudComponent', () => {
expect(restoreDefaultFiltersSpy).not.toHaveBeenCalled(); expect(restoreDefaultFiltersSpy).not.toHaveBeenCalled();
}); });
}); });
it('should add environment name to each application selector option label', () => {
component.appName = fakeApplicationInstance[0].name;
component.environmentList = fakeEnvironmentList;
getRunningApplicationsSpy.and.returnValue(of(fakeApplicationInstanceWithEnvironment));
spyOn(component, 'createTaskFilterProperties').and.returnValue(mockApplicationTaskFilterProperties);
const filteredProperties = component.createAndFilterProperties();
expect(filteredProperties[0].options[0].label).toBe('application-new-1 (test-env-name-1)');
});
}); });

View File

@@ -108,3 +108,28 @@ export const mockCreatedDateFilter = {
to: '_createdTo' to: '_createdTo'
} }
}; };
export const mockApplicationsSelectorOptions = [
{
label: 'application-new-1 (test-env-name-1)',
value: 'application-new-1'
},
{
label: 'application-new-1 (test-env-name-1)',
value: 'application-new-1'
},
{
label: 'application-new-1 (test-env-name-1)',
value: 'application-new-1'
}
];
export const mockApplicationTaskFilterProperties = [
{
label: 'test-label',
type: 'select',
key: 'appName',
value: mockApplicationsSelectorOptions[0].value,
options: mockApplicationsSelectorOptions
}
];

View File

@@ -29,6 +29,7 @@ export class TaskFilterCloudModel {
id: string; id: string;
name: string; name: string;
key: string; key: string;
environmentId?: string;
icon: string; icon: string;
index: number; index: number;
appName: string; appName: string;
@@ -72,6 +73,7 @@ export class TaskFilterCloudModel {
this.id = obj.id || Math.random().toString(36).substr(2, 9); this.id = obj.id || Math.random().toString(36).substr(2, 9);
this.name = obj.name || null; this.name = obj.name || null;
this.key = obj.key || null; this.key = obj.key || null;
this.environmentId = obj.environmentId || null;
this.icon = obj.icon || null; this.icon = obj.icon || null;
this.index = obj.index || null; this.index = obj.index || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null; this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
@@ -191,6 +193,7 @@ export class TaskFilterCloudModel {
export interface ServiceTaskFilterCloudModel { export interface ServiceTaskFilterCloudModel {
id?: string; id?: string;
name?: string; name?: string;
environmentId?: string;
key?: string; key?: string;
icon?: string; icon?: string;
index?: number; index?: number;

View File

@@ -81,6 +81,7 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
skipCount: this.skipCount, skipCount: this.skipCount,
sorting: this.sorting, sorting: this.sorting,
id: this.queryParams?.serviceTaskId, id: this.queryParams?.serviceTaskId,
environmentId: this.queryParams?.environmentId,
activityName: this.queryParams?.activityName, activityName: this.queryParams?.activityName,
activityType: this.queryParams?.activityType, activityType: this.queryParams?.activityType,
completedDate: this.queryParams?.completedDate, completedDate: this.queryParams?.completedDate,

View File

@@ -89,6 +89,10 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
@Input() @Input()
name: string = ''; name: string = '';
/** Filter the tasks to display only the ones with this environment ID. */
@Input()
environmentId: string;
/** Filter the tasks. Display only tasks with parentTaskId equal to the supplied value. */ /** Filter the tasks. Display only tasks with parentTaskId equal to the supplied value. */
@Input() @Input()
parentTaskId: string = ''; parentTaskId: string = '';
@@ -190,6 +194,7 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
assignee: this.assignee, assignee: this.assignee,
id: this.id, id: this.id,
name: this.name, name: this.name,
environmentId: this.environmentId,
parentTaskId: this.parentTaskId, parentTaskId: this.parentTaskId,
processDefinitionName: this.processDefinitionName, processDefinitionName: this.processDefinitionName,
processDefinitionId: this.processDefinitionId, processDefinitionId: this.processDefinitionId,

View File

@@ -20,6 +20,7 @@ import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.mod
export interface ServiceTaskQueryCloudRequestModel { export interface ServiceTaskQueryCloudRequestModel {
appName: string; appName: string;
appVersion?: string; appVersion?: string;
environmentId?: string;
id?: string; id?: string;
status?: string; status?: string;
maxItems: number; maxItems: number;

View File

@@ -26,6 +26,7 @@ export * from './lib/services/public-api';
export * from './lib/rich-text-editor/public-api'; export * from './lib/rich-text-editor/public-api';
export * from './lib/types'; export * from './lib/types';
export * from './lib/common/index';
export * from './lib/pipes/process-name-cloud.pipe'; export * from './lib/pipes/process-name-cloud.pipe';
export * from './lib/pipes/process-services-cloud-pipe.module'; export * from './lib/pipes/process-services-cloud-pipe.module';
export * from './lib/models/process-definition-cloud.model'; export * from './lib/models/process-definition-cloud.model';