[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; description?: string;
connectors?: any; connectors?: any;
descriptor?: Descriptor; descriptor?: Descriptor;
environmentId?: string;
} }
export interface Descriptor { export interface Descriptor {
@@ -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;
@@ -64,6 +64,9 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input() @Input()
id: string; id: string;
@Input()
environmentId: string;
/** List of process filter properties to display */ /** List of process filter properties to display */
@Input() @Input()
filterProperties = DEFAULT_PROCESS_FILTER_PROPERTIES; filterProperties = DEFAULT_PROCESS_FILTER_PROPERTIES;
@@ -76,6 +79,9 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
@Input() @Input()
actions = DEFAULT_ACTIONS; actions = DEFAULT_ACTIONS;
@Input()
environmentList: any[] = [];
/** Toggles editing of process filter actions. */ /** Toggles editing of process filter actions. */
@Input() @Input()
showFilterActions = true; showFilterActions = true;
@@ -118,6 +124,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,12 +410,21 @@ 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 }); 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() { getProcessDefinitions() {
this.processDefinitionNames = []; this.processDefinitionNames = [];
@@ -625,6 +644,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',
@@ -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;
@@ -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) {
@@ -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,
@@ -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;
@@ -67,6 +67,12 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
@Input() @Input()
id: string; id: string;
@Input()
environmentId: string;
@Input()
environmentList: any[] = [];
/** processInstanceId of the task filter. */ /** processInstanceId of the task filter. */
@Input() @Input()
processInstanceId: string; processInstanceId: string;
@@ -244,12 +250,20 @@ 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 }); 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() { getProcessDefinitions() {
this.taskCloudService.getProcessDefinitions(this.appName) this.taskCloudService.getProcessDefinitions(this.appName)
.subscribe((processDefinitions) => { .subscribe((processDefinitions) => {
@@ -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;
@@ -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,
@@ -89,6 +89,9 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
@Input() @Input()
name: string = ''; name: string = '';
@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 +193,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,
@@ -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;