mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-9461] Change variable process definition id (#7706)
This commit is contained in:
parent
23a76e0e79
commit
635e62cbd3
@ -18,5 +18,6 @@
|
||||
export const PROCESS_LIST_CUSTOM_VARIABLE_COLUMN = 'process-variable-column';
|
||||
export interface ProcessListDataColumnCustomData {
|
||||
assignedVariableDefinitionIds: string[];
|
||||
variableDefinitionsPayload: string[];
|
||||
columnType: string;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ export class TaskQueryCloudRequestModel {
|
||||
completedFrom?: string;
|
||||
completedTo?: string;
|
||||
candidateGroupId?: string;
|
||||
variableDefinitions?: string[];
|
||||
variableKeys?: string[];
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
@ -84,7 +84,7 @@ export class TaskQueryCloudRequestModel {
|
||||
this.completedTo = obj.completedTo;
|
||||
this.completedDate = obj.completedDate;
|
||||
this.candidateGroupId = obj.candidateGroupId;
|
||||
this.variableDefinitions = obj.variableDefinitions;
|
||||
this.variableKeys = obj.variableKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
getDataColumnMock({
|
||||
id: 'variableColumnId',
|
||||
customData: {
|
||||
variableDefinitionsPayload: ['processKey/variableName'],
|
||||
assignedVariableDefinitionIds: ['variableDefinitionId'],
|
||||
columnType: PROCESS_LIST_CUSTOM_VARIABLE_COLUMN
|
||||
}
|
||||
@ -321,7 +322,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
component.ngAfterContentInit();
|
||||
component.reload();
|
||||
|
||||
expect(component.requestNode.variableDefinitions).not.toBeDefined();
|
||||
expect(component.requestNode.variableKeys).not.toBeDefined();
|
||||
});
|
||||
|
||||
it('should request process variable if column for process variable is displayed', () => {
|
||||
@ -333,7 +334,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
entries: [{
|
||||
entry: {
|
||||
key: ProcessListCloudPreferences.columnsVisibility,
|
||||
value: '{"variableColumnId":true, "2":true}'
|
||||
value: '{"variableColumnId":"id", "2":true}'
|
||||
}
|
||||
}]
|
||||
}
|
||||
@ -342,7 +343,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
component.ngAfterContentInit();
|
||||
component.reload();
|
||||
|
||||
expect(component.requestNode.variableDefinitions).toEqual(['variableDefinitionId']);
|
||||
expect(component.requestNode.variableKeys).toEqual(['processKey/variableName']);
|
||||
});
|
||||
|
||||
it('should reload tasks when reload() is called', (done) => {
|
||||
|
@ -440,7 +440,7 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
|
||||
suspendedTo: this.suspendedTo,
|
||||
completedDate: this.completedDate,
|
||||
sorting: this.sorting,
|
||||
variableDefinitions: this.getRequestNodeVariableIds()
|
||||
variableKeys: this.getVariableDefinitionsRequestModel()
|
||||
};
|
||||
|
||||
return new ProcessQueryCloudRequestModel(requestNode);
|
||||
@ -469,14 +469,17 @@ export class ProcessListCloudComponent extends DataTableSchema<ProcessListDataCo
|
||||
return sorting.length && sorting[0].orderBy && sorting[0].direction;
|
||||
}
|
||||
|
||||
private getRequestNodeVariableIds(): string[] | undefined {
|
||||
private getVariableDefinitionsRequestModel(): string[] | undefined {
|
||||
const displayedVariableColumns = this.columns
|
||||
.filter(column =>
|
||||
column.customData?.columnType === PROCESS_LIST_CUSTOM_VARIABLE_COLUMN &&
|
||||
column.isHidden !== true
|
||||
)
|
||||
.map(column => column.customData.assignedVariableDefinitionIds)
|
||||
.reduce((allIds, ids) => [...ids, ...allIds], []);
|
||||
.map(column => {
|
||||
const variableDefinitionsPayload = column.customData.variableDefinitionsPayload;
|
||||
return variableDefinitionsPayload;
|
||||
})
|
||||
.reduce((variablesPayload, payload) => [...variablesPayload, ...payload], []);
|
||||
|
||||
return displayedVariableColumns.length ? displayedVariableColumns : undefined;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ describe('ProcessListDatatableAdapter', () => {
|
||||
title: 'columnDisplayName1',
|
||||
customData: {
|
||||
assignedVariableDefinitionIds: ['1'],
|
||||
variableDefinitionsPayload: ['processKey/variableName'],
|
||||
columnType: PROCESS_LIST_CUSTOM_VARIABLE_COLUMN
|
||||
}
|
||||
});
|
||||
|
@ -42,7 +42,7 @@ export class ProcessQueryCloudRequestModel {
|
||||
maxItems: number;
|
||||
skipCount: number;
|
||||
sorting?: ProcessListCloudSortingModel[];
|
||||
variableDefinitions?: string[];
|
||||
variableKeys?: string[];
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
@ -70,7 +70,7 @@ export class ProcessQueryCloudRequestModel {
|
||||
this.maxItems = obj.maxItems;
|
||||
this.skipCount = obj.skipCount;
|
||||
this.sorting = obj.sorting;
|
||||
this.variableDefinitions = obj.variableDefinitions;
|
||||
this.variableKeys = obj.variableKeys;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
requestNode: ProcessQueryCloudRequestModel,
|
||||
property: keyof ProcessQueryCloudRequestModel
|
||||
) {
|
||||
if (property === 'variableDefinitions' && requestNode[property]?.length > 0) {
|
||||
if (property === 'variableKeys' && requestNode[property]?.length > 0) {
|
||||
return `${requestNode[property].map(variableId => variableId).join(',')}`;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ describe('VariableMapperService', () => {
|
||||
title: 'column name',
|
||||
key: '',
|
||||
customData: {
|
||||
variableDefinitionsPayload: ['processKey/variableName'],
|
||||
assignedVariableDefinitionIds: [variable.variableDefinitionId],
|
||||
columnType: 'text'
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export class VariableMapperService {
|
||||
return instance;
|
||||
}
|
||||
|
||||
const variablesMap = (instance.variables ?? []).reduce((variableAccumulator, variable) => {
|
||||
const variablesMap = (instance.variables ?? []).reduce<{[columnTitle: string]: ProcessInstanceVariable}>((variableAccumulator, variable) => {
|
||||
const processVariableDefinitionId = variable.variableDefinitionId;
|
||||
|
||||
const column = columnsByVariableId[processVariableDefinitionId];
|
||||
|
@ -214,20 +214,23 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
|
||||
completedTo: this.completedTo,
|
||||
completedDate: this.completedDate,
|
||||
candidateGroupId: this.candidateGroupId,
|
||||
variableDefinitions: this.getRequestNodeVariableIds()
|
||||
variableKeys: this.getRequestNodeVariables()
|
||||
};
|
||||
|
||||
return new TaskQueryCloudRequestModel(requestNode);
|
||||
}
|
||||
|
||||
private getRequestNodeVariableIds(): string[] | undefined {
|
||||
private getRequestNodeVariables(): string[] | undefined {
|
||||
const displayedVariableColumns: string[] = (this.columns ?? [])
|
||||
.filter(column =>
|
||||
column.customData?.columnType === 'process-variable-column' &&
|
||||
column.isHidden !== true
|
||||
)
|
||||
.map(column => column.customData.assignedVariableDefinitionIds)
|
||||
.reduce((allIds, ids) => [...ids, ...allIds], []);
|
||||
.map(column => {
|
||||
const variableDefinitionsPayload = column.customData.variableDefinitionsPayload;
|
||||
return variableDefinitionsPayload;
|
||||
})
|
||||
.reduce((allRequestKeys, requestKeys) => [...requestKeys, ...allRequestKeys], []);
|
||||
|
||||
return displayedVariableColumns.length ? displayedVariableColumns : undefined;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ describe('TasksListDatatableAdapter', () => {
|
||||
title: 'columnDisplayName1',
|
||||
customData: {
|
||||
assignedVariableDefinitionIds: ['variableDefinitionId'],
|
||||
variableDefinitionsPayload: ['processKey/variableName'],
|
||||
columnType: PROCESS_LIST_CUSTOM_VARIABLE_COLUMN
|
||||
}
|
||||
});
|
||||
|
@ -72,8 +72,8 @@ export class TaskListCloudService extends BaseCloudService implements TaskListCl
|
||||
!this.isExcludedField(propertyKey) &&
|
||||
this.isPropertyValueValid(requestNode, propertyKey)
|
||||
) {
|
||||
if (propertyKey === 'variableDefinitions' && requestNode[propertyKey]?.length > 0) {
|
||||
queryParam['variableDefinitions'] = requestNode[propertyKey].join(',');
|
||||
if (propertyKey === 'variableKeys' && requestNode[propertyKey]?.length > 0) {
|
||||
queryParam[propertyKey] = requestNode[propertyKey].join(',');
|
||||
} else {
|
||||
queryParam[propertyKey] = requestNode[propertyKey];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user