mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-04-16 22:24:49 +00:00
AAE-41742 Add processRelatedTo payload for processes list (#11632)
* AAE-41742 Add processRelatedTo payload for processes list * units * units
This commit is contained in:
@@ -120,7 +120,7 @@ export class ProcessFilterCloudModel {
|
||||
this.initArrayProperties(obj);
|
||||
}
|
||||
|
||||
private initArrayProperties(obj) {
|
||||
private initArrayProperties(obj: ProcessFilterCloudModel) {
|
||||
if (obj.processDefinitionNames) {
|
||||
this.processDefinitionNames = obj.processDefinitionNames;
|
||||
} else {
|
||||
|
||||
@@ -735,6 +735,35 @@ describe('ProcessListCloudComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('processRelatedTo', () => {
|
||||
it('should include processRelatedTo in request node when values are provided', () => {
|
||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||
const relatedProcessIds = ['process-id-1', 'process-id-2'];
|
||||
fixture.componentRef.setInput('processRelatedTo', relatedProcessIds);
|
||||
component.ngAfterContentInit();
|
||||
component.reload();
|
||||
|
||||
expect(component.processListRequestNode.processRelatedTo).toEqual(relatedProcessIds);
|
||||
});
|
||||
|
||||
it('should include empty array in request node when no values are provided', () => {
|
||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||
fixture.componentRef.setInput('processRelatedTo', []);
|
||||
component.ngAfterContentInit();
|
||||
component.reload();
|
||||
|
||||
expect(component.processListRequestNode.processRelatedTo).toEqual([]);
|
||||
});
|
||||
|
||||
it('should omit processRelatedTo in request node when values are not provided', () => {
|
||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||
component.ngAfterContentInit();
|
||||
component.reload();
|
||||
|
||||
expect(component.processListRequestNode.processRelatedTo).toEqual(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return the results if an application name is given', (done) => {
|
||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
ContentChild,
|
||||
EventEmitter,
|
||||
Inject,
|
||||
input,
|
||||
Input,
|
||||
OnChanges,
|
||||
Output,
|
||||
@@ -65,6 +66,8 @@ import { ProcessVariableFilterModel } from '../../../models/process-variable-fil
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { AsyncPipe, NgIf } from '@angular/common';
|
||||
import { PaginatedList } from '@alfresco/js-api';
|
||||
import { ProcessInstanceCloud } from '../../start-process/models/process-instance-cloud.model';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||
|
||||
@@ -100,6 +103,8 @@ export class ProcessListCloudComponent
|
||||
@ContentChild(CustomLoadingContentTemplateDirective)
|
||||
customLoadingContent: CustomLoadingContentTemplateDirective;
|
||||
|
||||
processRelatedTo = input<string[] | undefined>();
|
||||
|
||||
/** The name of the application. */
|
||||
@Input()
|
||||
appName: string = '';
|
||||
@@ -331,7 +336,7 @@ export class ProcessListCloudComponent
|
||||
|
||||
/** Emitted when the list of process instances has been loaded successfully from the server. */
|
||||
@Output()
|
||||
success = new EventEmitter<any>();
|
||||
success = new EventEmitter<PaginatedList<ProcessInstanceCloud>>();
|
||||
|
||||
pagination: BehaviorSubject<PaginationModel>;
|
||||
size: number;
|
||||
@@ -651,7 +656,8 @@ export class ProcessListCloudComponent
|
||||
includeSubprocesses: this.includeSubprocesses,
|
||||
includeUnlinkedProcesses: this.includeUnlinkedProcesses,
|
||||
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
||||
processVariableFilters: this.processVariables
|
||||
processVariableFilters: this.processVariables,
|
||||
processRelatedTo: this.processRelatedTo()
|
||||
};
|
||||
|
||||
return new ProcessListRequestModel(requestNode);
|
||||
|
||||
@@ -104,6 +104,7 @@ export class ProcessListRequestModel {
|
||||
suspendedTo?: string;
|
||||
includeSubprocesses?: boolean;
|
||||
includeUnlinkedProcesses?: boolean;
|
||||
processRelatedTo?: string[];
|
||||
|
||||
processVariableFilters?: ProcessVariableFilterModel[];
|
||||
processVariableKeys?: string[];
|
||||
@@ -137,6 +138,8 @@ export class ProcessListRequestModel {
|
||||
|
||||
this.processVariableKeys = obj.processVariableKeys;
|
||||
this.processVariableFilters = obj.processVariableFilters;
|
||||
|
||||
this.processRelatedTo = obj.processRelatedTo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ export class ProcessListCloudService extends BaseCloudService {
|
||||
processVariableKeys: requestNode.processVariableKeys,
|
||||
processVariableFilters: requestNode.processVariableFilters,
|
||||
includeSubprocesses: requestNode.includeSubprocesses,
|
||||
includeUnlinkedProcesses: requestNode.includeUnlinkedProcesses
|
||||
includeUnlinkedProcesses: requestNode.includeUnlinkedProcesses,
|
||||
processRelatedTo: requestNode.processRelatedTo
|
||||
};
|
||||
|
||||
if (requestNode.sorting) {
|
||||
|
||||
Reference in New Issue
Block a user