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);
|
this.initArrayProperties(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
private initArrayProperties(obj) {
|
private initArrayProperties(obj: ProcessFilterCloudModel) {
|
||||||
if (obj.processDefinitionNames) {
|
if (obj.processDefinitionNames) {
|
||||||
this.processDefinitionNames = obj.processDefinitionNames;
|
this.processDefinitionNames = obj.processDefinitionNames;
|
||||||
} else {
|
} 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) => {
|
it('should return the results if an application name is given', (done) => {
|
||||||
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
spyOn(processListCloudService, 'fetchProcessList').and.returnValue(of(fakeProcessCloudList));
|
||||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
ContentChild,
|
ContentChild,
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Inject,
|
Inject,
|
||||||
|
input,
|
||||||
Input,
|
Input,
|
||||||
OnChanges,
|
OnChanges,
|
||||||
Output,
|
Output,
|
||||||
@@ -65,6 +66,8 @@ import { ProcessVariableFilterModel } from '../../../models/process-variable-fil
|
|||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
import { TranslatePipe } from '@ngx-translate/core';
|
import { TranslatePipe } from '@ngx-translate/core';
|
||||||
import { AsyncPipe, NgIf } from '@angular/common';
|
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';
|
const PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||||
|
|
||||||
@@ -100,6 +103,8 @@ export class ProcessListCloudComponent
|
|||||||
@ContentChild(CustomLoadingContentTemplateDirective)
|
@ContentChild(CustomLoadingContentTemplateDirective)
|
||||||
customLoadingContent: CustomLoadingContentTemplateDirective;
|
customLoadingContent: CustomLoadingContentTemplateDirective;
|
||||||
|
|
||||||
|
processRelatedTo = input<string[] | undefined>();
|
||||||
|
|
||||||
/** The name of the application. */
|
/** The name of the application. */
|
||||||
@Input()
|
@Input()
|
||||||
appName: string = '';
|
appName: string = '';
|
||||||
@@ -331,7 +336,7 @@ export class ProcessListCloudComponent
|
|||||||
|
|
||||||
/** Emitted when the list of process instances has been loaded successfully from the server. */
|
/** Emitted when the list of process instances has been loaded successfully from the server. */
|
||||||
@Output()
|
@Output()
|
||||||
success = new EventEmitter<any>();
|
success = new EventEmitter<PaginatedList<ProcessInstanceCloud>>();
|
||||||
|
|
||||||
pagination: BehaviorSubject<PaginationModel>;
|
pagination: BehaviorSubject<PaginationModel>;
|
||||||
size: number;
|
size: number;
|
||||||
@@ -651,7 +656,8 @@ export class ProcessListCloudComponent
|
|||||||
includeSubprocesses: this.includeSubprocesses,
|
includeSubprocesses: this.includeSubprocesses,
|
||||||
includeUnlinkedProcesses: this.includeUnlinkedProcesses,
|
includeUnlinkedProcesses: this.includeUnlinkedProcesses,
|
||||||
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
processVariableKeys: this.getVariableDefinitionsRequestModel(),
|
||||||
processVariableFilters: this.processVariables
|
processVariableFilters: this.processVariables,
|
||||||
|
processRelatedTo: this.processRelatedTo()
|
||||||
};
|
};
|
||||||
|
|
||||||
return new ProcessListRequestModel(requestNode);
|
return new ProcessListRequestModel(requestNode);
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export class ProcessListRequestModel {
|
|||||||
suspendedTo?: string;
|
suspendedTo?: string;
|
||||||
includeSubprocesses?: boolean;
|
includeSubprocesses?: boolean;
|
||||||
includeUnlinkedProcesses?: boolean;
|
includeUnlinkedProcesses?: boolean;
|
||||||
|
processRelatedTo?: string[];
|
||||||
|
|
||||||
processVariableFilters?: ProcessVariableFilterModel[];
|
processVariableFilters?: ProcessVariableFilterModel[];
|
||||||
processVariableKeys?: string[];
|
processVariableKeys?: string[];
|
||||||
@@ -137,6 +138,8 @@ export class ProcessListRequestModel {
|
|||||||
|
|
||||||
this.processVariableKeys = obj.processVariableKeys;
|
this.processVariableKeys = obj.processVariableKeys;
|
||||||
this.processVariableFilters = obj.processVariableFilters;
|
this.processVariableFilters = obj.processVariableFilters;
|
||||||
|
|
||||||
|
this.processRelatedTo = obj.processRelatedTo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ export class ProcessListCloudService extends BaseCloudService {
|
|||||||
processVariableKeys: requestNode.processVariableKeys,
|
processVariableKeys: requestNode.processVariableKeys,
|
||||||
processVariableFilters: requestNode.processVariableFilters,
|
processVariableFilters: requestNode.processVariableFilters,
|
||||||
includeSubprocesses: requestNode.includeSubprocesses,
|
includeSubprocesses: requestNode.includeSubprocesses,
|
||||||
includeUnlinkedProcesses: requestNode.includeUnlinkedProcesses
|
includeUnlinkedProcesses: requestNode.includeUnlinkedProcesses,
|
||||||
|
processRelatedTo: requestNode.processRelatedTo
|
||||||
};
|
};
|
||||||
|
|
||||||
if (requestNode.sorting) {
|
if (requestNode.sorting) {
|
||||||
|
|||||||
Reference in New Issue
Block a user