From 6a9129c931335d67e017e16b82e4727cba1f9a8a Mon Sep 17 00:00:00 2001
From: Diogo Bastos <50139916+DiogoABastos@users.noreply.github.com>
Date: Tue, 4 Apr 2023 16:12:19 +0100
Subject: [PATCH] [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
---
.../edit-process-filter-cloud.component.md | 4 ++-
.../edit-task-filter-cloud.component.md | 4 ++-
.../services/apps-process-cloud.service.md | 7 +++-
.../src/lib/app/mock/app-model.mock.ts | 7 ++++
.../app/models/application-instance.model.ts | 1 +
.../apps-process-cloud.service.spec.ts | 14 +++++++-
.../services/apps-process-cloud.service.ts | 11 +++++++
.../src/lib/common/index.ts | 18 ++++++++++
.../common/interface/environment.interface.ts | 21 ++++++++++++
.../src/lib/common/interface/index.ts | 18 ++++++++++
.../src/lib/common/interface/public-api.ts | 18 ++++++++++
.../src/lib/common/mock/environment.mock.ts | 33 +++++++++++++++++++
.../src/lib/common/public-api.ts | 18 ++++++++++
.../src/lib/models/filter-cloud-model.ts | 2 ++
...dit-process-filter-cloud.component.spec.ts | 12 ++++++-
.../edit-process-filter-cloud.component.ts | 20 ++++++++++-
.../models/process-filter-cloud.model.ts | 2 ++
.../services/process-filter-cloud.service.ts | 7 +++-
.../process-list-cloud.component.ts | 5 +++
.../process-cloud-query-request.model.ts | 2 ++
.../base-edit-task-filter-cloud.component.ts | 22 ++++++++-----
...ervice-task-filter-cloud.component.spec.ts | 15 ++++++++-
.../mock/edit-task-filter-cloud.mock.ts | 25 ++++++++++++++
.../task-filters/models/filter-cloud.model.ts | 3 ++
.../service-task-list-cloud.component.ts | 1 +
.../components/task-list-cloud.component.ts | 5 +++
.../models/service-task-cloud.model.ts | 1 +
lib/process-services-cloud/src/public-api.ts | 1 +
28 files changed, 280 insertions(+), 17 deletions(-)
create mode 100644 lib/process-services-cloud/src/lib/common/index.ts
create mode 100644 lib/process-services-cloud/src/lib/common/interface/environment.interface.ts
create mode 100644 lib/process-services-cloud/src/lib/common/interface/index.ts
create mode 100644 lib/process-services-cloud/src/lib/common/interface/public-api.ts
create mode 100644 lib/process-services-cloud/src/lib/common/mock/environment.mock.ts
create mode 100644 lib/process-services-cloud/src/lib/common/public-api.ts
diff --git a/docs/process-services-cloud/components/edit-process-filter-cloud.component.md b/docs/process-services-cloud/components/edit-process-filter-cloud.component.md
index 71a6b887b3..05c89b47dd 100644
--- a/docs/process-services-cloud/components/edit-process-filter-cloud.component.md
+++ b/docs/process-services-cloud/components/edit-process-filter-cloud.component.md
@@ -2,7 +2,7 @@
Title: Edit Process Filter Cloud component
Added: v3.0.0
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")
@@ -47,6 +47,8 @@ Shows/edits process filter details.
| appName | `string` | "" | The name of the application. |
| filterProperties | `string[]` | | List of process filter properties to display |
| 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 |
| showFilterActions | `boolean` | true | Toggles editing of process filter actions. |
| showProcessFilterName | `boolean` | true | Toggles the appearance of the process filter name . |
diff --git a/docs/process-services-cloud/components/edit-task-filter-cloud.component.md b/docs/process-services-cloud/components/edit-task-filter-cloud.component.md
index d3bf0e0dee..3427307ba7 100644
--- a/docs/process-services-cloud/components/edit-task-filter-cloud.component.md
+++ b/docs/process-services-cloud/components/edit-task-filter-cloud.component.md
@@ -2,7 +2,7 @@
Title: Edit Task Filter Cloud component
Added: v3.0.0
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")
@@ -47,6 +47,8 @@ Edits task filter details.
| appName | `string` | "" | (required) Name of the app. |
| filterProperties | `string[]` | \[] | List of task filter properties to display. |
| 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. |
| role | `string` | "" | user role. |
| showFilterActions | `boolean` | true | Toggles the filter actions. |
diff --git a/docs/process-services-cloud/services/apps-process-cloud.service.md b/docs/process-services-cloud/services/apps-process-cloud.service.md
index e87ccf8863..e7312b4e13 100644
--- a/docs/process-services-cloud/services/apps-process-cloud.service.md
+++ b/docs/process-services-cloud/services/apps-process-cloud.service.md
@@ -2,7 +2,7 @@
Title: Apps Process Cloud Service
Added: v3.0.0
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")
@@ -24,6 +24,11 @@ Gets details of deployed apps for the current user.
- **loadApps**()
+- **getApplicationLabel**(application: `ApplicationInstanceModel`, environmentList?: `Environment[]`): `string`
+ 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
This service implements some features of the [Apps process service](../../core/services/apps-process.service.md)
diff --git a/lib/process-services-cloud/src/lib/app/mock/app-model.mock.ts b/lib/process-services-cloud/src/lib/app/mock/app-model.mock.ts
index 9ddbc061c9..36a961e6c4 100644
--- a/lib/process-services-cloud/src/lib/app/mock/app-model.mock.ts
+++ b/lib/process-services-cloud/src/lib/app/mock/app-model.mock.ts
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+import { fakeEnvironmentList } from '../../common/mock/environment.mock';
import { ApplicationInstanceModel } from '../models/application-instance.model';
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-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' }
+];
diff --git a/lib/process-services-cloud/src/lib/app/models/application-instance.model.ts b/lib/process-services-cloud/src/lib/app/models/application-instance.model.ts
index 5de2774af9..0bae77a415 100644
--- a/lib/process-services-cloud/src/lib/app/models/application-instance.model.ts
+++ b/lib/process-services-cloud/src/lib/app/models/application-instance.model.ts
@@ -27,6 +27,7 @@ export interface ApplicationInstanceModel {
description?: string;
connectors?: any;
descriptor?: Descriptor;
+ environmentId?: string;
}
export interface Descriptor {
diff --git a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts
index c56b8fdf0c..f8611005dc 100644
--- a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts
+++ b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts
@@ -20,9 +20,10 @@ import { throwError } from 'rxjs';
import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core';
import { HttpErrorResponse } from '@angular/common/http';
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 { TranslateModule } from '@ngx-translate/core';
+import { fakeEnvironmentList } from '../../common/mock/environment.mock';
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)');
+ });
});
diff --git a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts
index 42b70509cc..1dab9a978f 100644
--- a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts
+++ b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.ts
@@ -21,6 +21,7 @@ import { map, catchError } from 'rxjs/operators';
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
import { Oauth2Auth } from '@alfresco/js-api';
import { ApplicationInstanceModel } from '../models/application-instance.model';
+import { Environment } from '../../common/interface/environment.interface';
@Injectable({ providedIn: 'root' })
export class AppsProcessCloudService {
@@ -58,6 +59,16 @@ export class AppsProcessCloudService {
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 {
if (status === '') {
return of([]);
diff --git a/lib/process-services-cloud/src/lib/common/index.ts b/lib/process-services-cloud/src/lib/common/index.ts
new file mode 100644
index 0000000000..a7e30cc675
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/index.ts
@@ -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';
diff --git a/lib/process-services-cloud/src/lib/common/interface/environment.interface.ts b/lib/process-services-cloud/src/lib/common/interface/environment.interface.ts
new file mode 100644
index 0000000000..16ccb343b4
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/interface/environment.interface.ts
@@ -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;
+}
diff --git a/lib/process-services-cloud/src/lib/common/interface/index.ts b/lib/process-services-cloud/src/lib/common/interface/index.ts
new file mode 100644
index 0000000000..a7e30cc675
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/interface/index.ts
@@ -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';
diff --git a/lib/process-services-cloud/src/lib/common/interface/public-api.ts b/lib/process-services-cloud/src/lib/common/interface/public-api.ts
new file mode 100644
index 0000000000..300a896f68
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/interface/public-api.ts
@@ -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';
diff --git a/lib/process-services-cloud/src/lib/common/mock/environment.mock.ts b/lib/process-services-cloud/src/lib/common/mock/environment.mock.ts
new file mode 100644
index 0000000000..ae41997810
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/mock/environment.mock.ts
@@ -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'
+ }
+];
diff --git a/lib/process-services-cloud/src/lib/common/public-api.ts b/lib/process-services-cloud/src/lib/common/public-api.ts
new file mode 100644
index 0000000000..b4c2a300e2
--- /dev/null
+++ b/lib/process-services-cloud/src/lib/common/public-api.ts
@@ -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';
diff --git a/lib/process-services-cloud/src/lib/models/filter-cloud-model.ts b/lib/process-services-cloud/src/lib/models/filter-cloud-model.ts
index c8be4ebc56..6ff968956c 100644
--- a/lib/process-services-cloud/src/lib/models/filter-cloud-model.ts
+++ b/lib/process-services-cloud/src/lib/models/filter-cloud-model.ts
@@ -21,6 +21,7 @@ export class TaskQueryCloudRequestModel {
appName: string;
appVersion?: string;
assignee?: string;
+ environmentId?: string;
claimedDate?: string;
createdDate?: Date;
createdFrom?: string;
@@ -56,6 +57,7 @@ export class TaskQueryCloudRequestModel {
this.appName = obj.appName;
this.appVersion = obj.appVersion;
this.assignee = obj.assignee;
+ this.environmentId = obj.environmentId;
this.claimedDate = obj.claimedDate;
this.createdDate = obj.createdDate;
this.createdFrom = obj.createdFrom;
diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts
index ceaa62362d..fe41f9ce1d 100644
--- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts
+++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts
@@ -30,7 +30,7 @@ import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
import { ProcessFilterCloudService } from '../services/process-filter-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 { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.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 { mockAppVersions } from '../mock/process-filters-cloud.mock';
import { DATE_FORMAT_CLOUD } from '../../../models/date-format-cloud.model';
+import { fakeEnvironmentList } from '../../../common/mock/environment.mock';
describe('EditProcessFilterCloudComponent', () => {
let component: EditProcessFilterCloudComponent;
@@ -1161,4 +1162,13 @@ describe('EditProcessFilterCloudComponent', () => {
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)');
+ });
});
diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts
index f3a8290d56..5c888609c9 100644
--- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts
@@ -30,6 +30,7 @@ import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud
import { ProcessCloudService } from '../../services/process-cloud.service';
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.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_AS = 'saveAs';
@@ -76,6 +77,14 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input()
actions = DEFAULT_ACTIONS;
+ /** Environment ID of the application. */
+ @Input()
+ environmentId: string;
+
+ /** List of environments. */
+ @Input()
+ environmentList: Environment[] = [];
+
/** Toggles editing of process filter actions. */
@Input()
showFilterActions = true;
@@ -118,6 +127,10 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
this.id = value.id;
}
+ if (value?.environmentId) {
+ this.environmentId = value.environmentId;
+ }
+
this.processFilterProperties = this.createAndFilterProperties();
this.processFilterActions = this.createAndFilterActions();
@@ -400,7 +413,7 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
.subscribe((applications) => {
if (applications && applications.length > 0) {
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',
value: 'id'
},
+ {
+ label: 'EnvironmentId',
+ key: 'environmentId',
+ value: 'environmentId'
+ },
{
label: 'ADF_CLOUD_EDIT_PROCESS_FILTER.LABEL.PROCESS_NAME',
key: 'name',
diff --git a/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts b/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts
index e55fb6747d..2aaaba1377 100644
--- a/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts
+++ b/lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts
@@ -46,6 +46,7 @@ export class ProcessFilterCloudModel {
startedDateType: DateCloudFilterType;
suspendedDateType: DateCloudFilterType;
completedDate: Date;
+ environmentId?: string;
private dateRangeFilterService = new DateRangeFilterService();
private _completedFrom: string;
@@ -60,6 +61,7 @@ export class ProcessFilterCloudModel {
this.id = obj.id || Math.random().toString(36).substring(2, 9);
this.name = obj.name || null;
this.key = obj.key || null;
+ this.environmentId = obj.environmentId;
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
diff --git a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts
index d58090fc9c..7f8e2015d1 100644
--- a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts
+++ b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts
@@ -61,7 +61,12 @@ export class ProcessFilterCloudService {
value = value || {};
const result = {
appName: appName || value['appName'],
- id: id || value['id']
+ id: id || value['id'],
+ ...(
+ value['environmentId'] && {
+ environmentId: value['environmentId']
+ }
+ )
};
for (const prop of filterProperties) {
diff --git a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts
index 56407de188..325dea897d 100644
--- a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts
@@ -67,6 +67,10 @@ export class ProcessListCloudComponent extends DataTableSchema implements OnInit, OnC
@Input()
id: string;
+ /** List of environments. */
+ @Input()
+ environmentList: Environment[] = [];
+
/** processInstanceId of the task filter. */
@Input()
processInstanceId: string;
@@ -99,14 +104,6 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnC
@Input()
sortProperties: string[] = [];
- /** Task Filter to use*/
- @Input()
- taskFilter: T;
-
- /** Emitted when a task filter property changes. */
- @Output()
- filterChange = new EventEmitter();
-
/** Emitted when a filter action occurs (i.e Save, Save As, Delete). */
@Output()
action = new EventEmitter();
@@ -129,8 +126,15 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnC
label: 'ADF_CLOUD_TASK_FILTERS.STATUS.ALL'
};
+ @Input()
+ taskFilter: T;
+
changedTaskFilter: T;
+ /** Emitted when a task filter property changes. */
+ @Output()
+ filterChange = new EventEmitter();
+
protected onDestroy$ = new Subject();
isLoading: boolean = false;
@@ -244,7 +248,7 @@ export abstract class BaseEditTaskFilterCloudComponent implements OnInit, OnC
.subscribe((applications) => {
if (applications && applications.length > 0) {
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 });
});
}
});
diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts
index 1ed8964ca0..c34664fe2c 100644
--- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts
+++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts
@@ -26,7 +26,7 @@ import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.ser
import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service';
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
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 { ServiceTaskFilterCloudService } from '../../services/service-task-filter-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 { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model';
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', () => {
let component: EditServiceTaskFilterCloudComponent;
@@ -750,4 +752,15 @@ describe('EditServiceTaskFilterCloudComponent', () => {
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)');
+ });
});
diff --git a/lib/process-services-cloud/src/lib/task/task-filters/mock/edit-task-filter-cloud.mock.ts b/lib/process-services-cloud/src/lib/task/task-filters/mock/edit-task-filter-cloud.mock.ts
index 7e99f02afd..9b02864948 100644
--- a/lib/process-services-cloud/src/lib/task/task-filters/mock/edit-task-filter-cloud.mock.ts
+++ b/lib/process-services-cloud/src/lib/task/task-filters/mock/edit-task-filter-cloud.mock.ts
@@ -108,3 +108,28 @@ export const mockCreatedDateFilter = {
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
+ }
+];
diff --git a/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts b/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts
index 6e59caf8b3..05514ac0ae 100644
--- a/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts
+++ b/lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts
@@ -29,6 +29,7 @@ export class TaskFilterCloudModel {
id: string;
name: string;
key: string;
+ environmentId?: string;
icon: string;
index: number;
appName: string;
@@ -72,6 +73,7 @@ export class TaskFilterCloudModel {
this.id = obj.id || Math.random().toString(36).substr(2, 9);
this.name = obj.name || null;
this.key = obj.key || null;
+ this.environmentId = obj.environmentId || null;
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || obj.appName === '' ? obj.appName : null;
@@ -191,6 +193,7 @@ export class TaskFilterCloudModel {
export interface ServiceTaskFilterCloudModel {
id?: string;
name?: string;
+ environmentId?: string;
key?: string;
icon?: string;
index?: number;
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
index 21951ce113..b862bb0b28 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts
@@ -81,6 +81,7 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
skipCount: this.skipCount,
sorting: this.sorting,
id: this.queryParams?.serviceTaskId,
+ environmentId: this.queryParams?.environmentId,
activityName: this.queryParams?.activityName,
activityType: this.queryParams?.activityType,
completedDate: this.queryParams?.completedDate,
diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
index fad4fa2e92..4c068c75fa 100644
--- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
+++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts
@@ -89,6 +89,10 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent