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

This commit is contained in:
Diogo Bastos
2023-04-03 12:32:46 +01:00
parent ba90131e61
commit b55d0f50ec
12 changed files with 67 additions and 3 deletions
@@ -27,6 +27,7 @@ export interface ApplicationInstanceModel {
description?: string;
connectors?: any;
descriptor?: Descriptor;
environmentId?: string;
}
export interface Descriptor {
@@ -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;
@@ -64,6 +64,9 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input()
id: string;
@Input()
environmentId: string;
/** List of process filter properties to display */
@Input()
filterProperties = DEFAULT_PROCESS_FILTER_PROPERTIES;
@@ -76,6 +79,9 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input()
actions = DEFAULT_ACTIONS;
@Input()
environmentList: any[] = [];
/** Toggles editing of process filter actions. */
@Input()
showFilterActions = true;
@@ -118,6 +124,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,12 +410,21 @@ 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 });
if (application.environmentId) {
this.applicationNames.push({ label: `${application.name} (${this.getEnvironmentName(application.environmentId)})`, value: application.name });
} else {
this.applicationNames.push({ label: application.name, value: application.name });
}
});
}
});
}
private getEnvironmentName(environmentId: string) {
return this.environmentList.find((env: any) => env['id'] === environmentId).name;
}
getProcessDefinitions() {
this.processDefinitionNames = [];
@@ -625,6 +644,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',
@@ -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;
@@ -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) {
@@ -67,6 +67,10 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
@Input()
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. */
@Input()
name: string = '';
@@ -455,6 +459,7 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
skipCount: this.skipCount,
initiator: this.initiator,
id: this.id,
environmentId: this.environmentId,
name: this.name,
processDefinitionId: this.processDefinitionId,
processDefinitionName: this.processDefinitionName,
@@ -22,6 +22,7 @@ export class ProcessQueryCloudRequestModel {
appVersion?: number | string;
initiator?: null;
id?: string;
environmentId?: string;
name?: string;
processDefinitionId?: string;
processDefinitionName?: string;
@@ -50,6 +51,7 @@ export class ProcessQueryCloudRequestModel {
this.appVersion = obj.appVersion;
this.initiator = obj.initiator;
this.id = obj.id;
this.environmentId = obj.environmentId;
this.name = obj.name;
this.processDefinitionId = obj.processDefinitionId;
this.processDefinitionName = obj.processDefinitionName;
@@ -67,6 +67,12 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
@Input()
id: string;
@Input()
environmentId: string;
@Input()
environmentList: any[] = [];
/** processInstanceId of the task filter. */
@Input()
processInstanceId: string;
@@ -244,12 +250,20 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
.subscribe((applications) => {
if (applications && applications.length > 0) {
applications.map((application) => {
this.applicationNames.push({ label: application.name, value: application.name });
if (application.environmentId) {
this.applicationNames.push({ label: `${application.name} (${this.getEnvironmentName(application.environmentId)})`, value: application.name });
} else {
this.applicationNames.push({ label: application.name, value: application.name });
}
});
}
});
}
private getEnvironmentName(environmentId: string) {
return this.environmentList.find((env: any) => env['id'] === environmentId).name;
}
getProcessDefinitions() {
this.taskCloudService.getProcessDefinitions(this.appName)
.subscribe((processDefinitions) => {
@@ -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;
@@ -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,
@@ -89,6 +89,9 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
@Input()
name: string = '';
@Input()
environmentId: string;
/** Filter the tasks. Display only tasks with parentTaskId equal to the supplied value. */
@Input()
parentTaskId: string = '';
@@ -190,6 +193,7 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
assignee: this.assignee,
id: this.id,
name: this.name,
environmentId: this.environmentId,
parentTaskId: this.parentTaskId,
processDefinitionName: this.processDefinitionName,
processDefinitionId: this.processDefinitionId,
@@ -20,6 +20,7 @@ import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.mod
export interface ServiceTaskQueryCloudRequestModel {
appName: string;
appVersion?: string;
environmentId?: string;
id?: string;
status?: string;
maxItems: number;