[ACS-5839] migrate to latest JS-API types (#8859)

* [ci:force] migrate Minimal Node to Node

* [ci:force] remove js-api wrappers and use real types

* [ci:force] remove js-api wrappers and use real types

* [ci:force] fix linting errors

* [ci:force] fix linting errors

* [ci:force] security fixes

* [ci:force] sonarcloud bug fixes

* [ci:force] dead code elimination, sonar suggested fixes
This commit is contained in:
Denys Vuika
2023-08-29 20:56:40 +01:00
committed by GitHub
parent a5b05b3e5f
commit 3b4ce3b857
51 changed files with 1337 additions and 1984 deletions

View File

@@ -18,12 +18,7 @@
import { AlfrescoApiService, LogService, ExternalContent, ExternalContentLink } from '@alfresco/adf-core';
import { SitesService } from '@alfresco/adf-content-services';
import { Injectable } from '@angular/core';
import {
IntegrationAlfrescoOnPremiseApi,
MinimalNode,
RelatedContentRepresentation,
ActivitiContentApi
} from '@alfresco/js-api';
import { IntegrationAlfrescoOnPremiseApi, Node, RelatedContentRepresentation, ActivitiContentApi } from '@alfresco/js-api';
import { Observable, from, throwError } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
@@ -31,13 +26,13 @@ import { map, catchError } from 'rxjs/operators';
providedIn: 'root'
})
export class ActivitiContentService {
static UNKNOWN_ERROR_MESSAGE: string = 'Unknown error';
static GENERIC_ERROR_MESSAGE: string = 'Server error';
private _integrationAlfrescoOnPremiseApi: IntegrationAlfrescoOnPremiseApi;
get integrationAlfrescoOnPremiseApi(): IntegrationAlfrescoOnPremiseApi {
this._integrationAlfrescoOnPremiseApi = this._integrationAlfrescoOnPremiseApi ?? new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
this._integrationAlfrescoOnPremiseApi =
this._integrationAlfrescoOnPremiseApi ?? new IntegrationAlfrescoOnPremiseApi(this.apiService.getInstance());
return this._integrationAlfrescoOnPremiseApi;
}
@@ -47,10 +42,7 @@ export class ActivitiContentService {
return this._contentApi;
}
constructor(private apiService: AlfrescoApiService,
private logService: LogService,
private sitesService: SitesService) {
}
constructor(private apiService: AlfrescoApiService, private logService: LogService, private sitesService: SitesService) {}
/**
* Returns a list of child nodes below the specified folder
@@ -60,11 +52,10 @@ export class ActivitiContentService {
*/
getAlfrescoNodes(accountId: string, folderId: string): Observable<[ExternalContent]> {
const accountShortId = accountId.replace('alfresco-', '');
return from(this.integrationAlfrescoOnPremiseApi.getContentInFolder(accountShortId, folderId))
.pipe(
map(this.toJsonArray),
catchError((err) => this.handleError(err))
);
return from(this.integrationAlfrescoOnPremiseApi.getContentInFolder(accountShortId, folderId)).pipe(
map(this.toJsonArray),
catchError((err) => this.handleError(err))
);
}
/**
@@ -78,11 +69,10 @@ export class ActivitiContentService {
tenantId,
includeAccounts: includeAccount ? includeAccount : true
};
return from(this.integrationAlfrescoOnPremiseApi.getRepositories(opts))
.pipe(
map(this.toJsonArray),
catchError((err) => this.handleError(err))
);
return from(this.integrationAlfrescoOnPremiseApi.getRepositories(opts)).pipe(
map(this.toJsonArray),
catchError((err) => this.handleError(err))
);
}
/**
@@ -93,20 +83,21 @@ export class ActivitiContentService {
* @param siteId
*/
linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable<ExternalContentLink> {
return from(this.contentApi.createTemporaryRelatedContent({
link: true,
name: node.title,
simpleType: node.simpleType,
source: accountId,
sourceId: node.id + '@' + siteId
}))
.pipe(
map(this.toJson),
catchError((err) => this.handleError(err))
);
return from(
this.contentApi.createTemporaryRelatedContent({
link: true,
name: node.title,
simpleType: node.simpleType,
source: accountId,
sourceId: node.id + '@' + siteId
})
).pipe(
map(this.toJson),
catchError((err) => this.handleError(err))
);
}
applyAlfrescoNode(node: MinimalNode, siteId: string, accountId: string) {
applyAlfrescoNode(node: Node, siteId: string, accountId: string) {
const currentSideId = siteId ? siteId : this.sitesService.getSiteNameFromNodePath(node);
const params: RelatedContentRepresentation = {
source: accountId,
@@ -115,11 +106,10 @@ export class ActivitiContentService {
name: node.name,
link: node.isLink
};
return from(this.contentApi.createTemporaryRelatedContent(params))
.pipe(
map(this.toJson),
catchError((err) => this.handleError(err))
);
return from(this.contentApi.createTemporaryRelatedContent(params)).pipe(
map(this.toJson),
catchError((err) => this.handleError(err))
);
}
toJson(res: any) {
@@ -139,8 +129,11 @@ export class ActivitiContentService {
handleError(error: any): Observable<any> {
let errMsg = ActivitiContentService.UNKNOWN_ERROR_MESSAGE;
if (error) {
errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : ActivitiContentService.GENERIC_ERROR_MESSAGE;
errMsg = error.message
? error.message
: error.status
? `${error.status} - ${error.statusText}`
: ActivitiContentService.GENERIC_ERROR_MESSAGE;
}
this.logService.error(errMsg);
return throwError(errMsg);

View File

@@ -18,14 +18,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { AttachFileWidgetComponent } from './attach-file-widget.component';
import {
FormFieldModel,
FormModel,
FormFieldTypes,
FormService,
FormFieldMetadata,
DownloadService
} from '@alfresco/adf-core';
import { FormFieldModel, FormModel, FormFieldTypes, FormService, FormFieldMetadata, DownloadService } from '@alfresco/adf-core';
import { ContentNodeDialogService, ContentModule } from '@alfresco/adf-content-services';
import { of } from 'rxjs';
import { Node } from '@alfresco/js-api';
@@ -101,7 +94,7 @@ const externalDefinedSourceParams = {
}
} as FormFieldMetadata;
const fakeMinimalNode: Node = {
const fakeNode = {
id: 'fake',
name: 'fake-name',
content: {
@@ -140,7 +133,6 @@ const fakePngAnswer: any = {
};
describe('AttachFileWidgetComponent', () => {
let widget: AttachFileWidgetComponent;
let fixture: ComponentFixture<AttachFileWidgetComponent>;
let element: HTMLInputElement;
@@ -153,11 +145,7 @@ describe('AttachFileWidgetComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
ProcessTestingModule,
ContentModule.forRoot()
]
imports: [TranslateModule.forRoot(), ProcessTestingModule, ContentModule.forRoot()]
});
fixture = TestBed.createComponent(AttachFileWidgetComponent);
widget = fixture.componentInstance;
@@ -218,7 +206,7 @@ describe('AttachFileWidgetComponent', () => {
expect(fakeRepoOption2[0]).not.toBeNull();
});
it ('should show only remote repos when just link to files is true', async () => {
it('should show only remote repos when just link to files is true', async () => {
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
@@ -252,7 +240,7 @@ describe('AttachFileWidgetComponent', () => {
it('should isLink property of the selected node become true when the widget has link enabled', async () => {
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
const applyAlfrescoNodeSpy = spyOn(activitiContentService, 'applyAlfrescoNode');
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeNode]));
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
@@ -271,13 +259,13 @@ describe('AttachFileWidgetComponent', () => {
await fixture.whenStable();
fixture.debugElement.query(By.css('#attach-SHAREME')).nativeElement.click();
expect(applyAlfrescoNodeSpy).toHaveBeenCalledWith({ ...fakeMinimalNode, isLink: true }, undefined, 'alfresco-1000-SHAREME');
expect(applyAlfrescoNodeSpy).toHaveBeenCalledWith({ ...fakeNode, isLink: true }, undefined, 'alfresco-1000-SHAREME');
});
it('should isLink property of the selected node become false when the widget has link disabled', async () => {
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
const applyAlfrescoNodeSpy = spyOn(activitiContentService, 'applyAlfrescoNode');
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeNode]));
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
@@ -296,13 +284,13 @@ describe('AttachFileWidgetComponent', () => {
await fixture.whenStable();
fixture.debugElement.query(By.css('#attach-SHAREME')).nativeElement.click();
expect(applyAlfrescoNodeSpy).toHaveBeenCalledWith({ ...fakeMinimalNode, isLink: false }, undefined, 'alfresco-1000-SHAREME');
expect(applyAlfrescoNodeSpy).toHaveBeenCalledWith({ ...fakeNode, isLink: false }, undefined, 'alfresco-1000-SHAREME');
});
it('should be able to upload files coming from content node selector', async () => {
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(of(fakePngAnswer));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeNode]));
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
@@ -337,7 +325,7 @@ describe('AttachFileWidgetComponent', () => {
};
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValues(of(fakePngAnswer), of(fakePngUpload));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByDefaultLocation').and.returnValue(of([fakeNode]));
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
value: []
@@ -374,7 +362,7 @@ describe('AttachFileWidgetComponent', () => {
widget.field.params = definedSourceParams;
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(of(fakePngAnswer));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByFolderId').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFileBrowseDialogByFolderId').and.returnValue(of([fakeNode]));
fixture.detectChanges();
await fixture.whenStable();
@@ -430,7 +418,6 @@ describe('AttachFileWidgetComponent', () => {
});
describe('when a file is uploaded', () => {
beforeEach(async () => {
widget.field = new FormFieldModel(new FormModel(), {
type: FormFieldTypes.UPLOAD,
@@ -557,7 +544,6 @@ describe('AttachFileWidgetComponent', () => {
await fixture.whenStable();
const downloadOption = fixture.debugElement.query(By.css('#file-1155-download-file')).nativeElement as HTMLButtonElement;
expect(downloadOption.disabled).toBeFalsy();
});
it('should not display the show button file when there is no contentAvailable', async () => {
@@ -572,7 +558,7 @@ describe('AttachFileWidgetComponent', () => {
const showOption = fixture.debugElement.query(By.css('#file-1155-show-file')).nativeElement as HTMLButtonElement;
expect(showOption.disabled).toBeTruthy();
});
});
});
it('should be able to upload files when a defined folder from external content service', async () => {
widget.field = new FormFieldModel(new FormModel(), { type: FormFieldTypes.UPLOAD, value: [] });
@@ -580,7 +566,7 @@ describe('AttachFileWidgetComponent', () => {
widget.field.params = externalDefinedSourceParams;
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(of(fakePngAnswer));
spyOn(attachFileWidgetDialogService, 'openLogin').and.returnValue(of([fakeMinimalNode]));
spyOn(attachFileWidgetDialogService, 'openLogin').and.returnValue(of([fakeNode]));
fixture.detectChanges();
await fixture.whenStable();
@@ -605,7 +591,7 @@ describe('AttachFileWidgetComponent', () => {
widget.field.params = externalDefinedSourceParams;
spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of(fakeRepositoryListAnswer));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(of(fakePngAnswer));
const openLoginSpy = spyOn(attachFileWidgetDialogService, 'openLogin').and.returnValue(of([fakeMinimalNode]));
const openLoginSpy = spyOn(attachFileWidgetDialogService, 'openLogin').and.returnValue(of([fakeNode]));
fixture.detectChanges();
await fixture.whenStable();

View File

@@ -25,13 +25,13 @@ import { Node } from '@alfresco/js-api';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { TranslateModule } from '@ngx-translate/core';
const fakeMinimalNode: Node = {
const fakeNode = {
id: 'fake',
name: 'fake-name'
} as Node;
const definedSourceParams = {
folderSource : {
folderSource: {
serviceId: 'goofy-sources',
name: 'pippo-baudo',
selectedFolder: {
@@ -42,7 +42,6 @@ const definedSourceParams = {
};
describe('AttachFolderWidgetComponent', () => {
let widget: AttachFolderWidgetComponent;
let fixture: ComponentFixture<AttachFolderWidgetComponent>;
let element: HTMLInputElement;
@@ -51,10 +50,7 @@ describe('AttachFolderWidgetComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
ProcessTestingModule
]
imports: [TranslateModule.forRoot(), ProcessTestingModule]
});
fixture = TestBed.createComponent(AttachFolderWidgetComponent);
widget = fixture.componentInstance;
@@ -80,7 +76,7 @@ describe('AttachFolderWidgetComponent', () => {
});
it('should show the folder selected by content node', async () => {
spyOn(contentNodeDialogService, 'openFolderBrowseDialogBySite').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFolderBrowseDialogBySite').and.returnValue(of([fakeNode]));
expect(widget).not.toBeNull();
widget.field = new FormFieldModel(new FormModel(), {
type: 'select-folder',
@@ -99,7 +95,7 @@ describe('AttachFolderWidgetComponent', () => {
});
it('should show the folder selected by content node opening on a configured folder', async () => {
spyOn(contentNodeDialogService, 'openFolderBrowseDialogByFolderId').and.returnValue(of([fakeMinimalNode]));
spyOn(contentNodeDialogService, 'openFolderBrowseDialogByFolderId').and.returnValue(of([fakeNode]));
expect(widget).not.toBeNull();
widget.field = new FormFieldModel(new FormModel(), {
type: 'select-folder',
@@ -120,7 +116,7 @@ describe('AttachFolderWidgetComponent', () => {
});
it('should retrieve the node information on init', async () => {
spyOn(nodeService, 'getNode').and.returnValue(of(fakeMinimalNode));
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNode));
expect(widget).not.toBeNull();
widget.field = new FormFieldModel(new FormModel(), {
type: 'select-folder',
@@ -136,7 +132,7 @@ describe('AttachFolderWidgetComponent', () => {
});
it('should remove the folder via the remove button', async () => {
spyOn(nodeService, 'getNode').and.returnValue(of(fakeMinimalNode));
spyOn(nodeService, 'getNode').and.returnValue(of(fakeNode));
expect(widget).not.toBeNull();
widget.field = new FormFieldModel(new FormModel(), {
type: 'select-folder',

View File

@@ -18,28 +18,6 @@
/* spell-checker: disable */
import { ProcessInstance } from '../../process-list/models/process-instance.model';
export class ProcessList {
data: ProcessInstance[];
size: number;
start: number;
total: number;
constructor(data?: ProcessInstance[]) {
this.data = data || [];
}
}
export class SingleProcessList extends ProcessList {
constructor(name?: string) {
const instance = new ProcessInstance({
id: '123',
name
});
super([instance]);
}
}
export const exampleProcess = new ProcessInstance({
id: '123',
name: 'Process 123',
@@ -90,86 +68,3 @@ export const exampleProcessNoName = new ProcessInstance({
},
processDefinitionName: 'My Process'
});
export const fakeProcessInstances = {
size: 2,
total: 2,
start: 0,
data: [
{
id: '340124',
name: 'James Franklin EMEA Onboarding',
businessKey: null,
processDefinitionId: 'HROnboarding:60:338704',
tenantId: 'tenant_1',
started: new Date('2017-10-09T12:19:44.560+0000'),
ended: null,
startedBy: {
id: 4004,
firstName: 'Integration',
lastName: 'Test',
email: 'srintegrationtest@test.com'
},
processDefinitionName: 'HROnboarding',
processDefinitionDescription: 'HR Onboarding Workflow',
processDefinitionKey: 'fakeProcessDefinitionKey1',
processDefinitionCategory: 'http://www.activiti.org/processdef',
processDefinitionVersion: 60,
processDefinitionDeploymentId: '338695',
graphicalNotationDefined: true,
startFormDefined: false,
suspended: false,
variables: []
},
{
id: '340063',
name: 'Mary Franklin AMERICAS Onboarding',
businessKey: null,
processDefinitionId: 'HROnboarding:60:338704',
tenantId: 'tenant_1',
started: '2017-10-09T12:18:07.484+0000',
ended: null,
startedBy: {
id: 4004,
firstName: 'Integration',
lastName: 'Test',
email: 'srintegrationtest@test.com'
},
processDefinitionName: 'HROnboarding',
processDefinitionDescription: 'HR Onboarding Workflow',
processDefinitionKey: 'HROnboarding',
processDefinitionCategory: 'http://www.activiti.org/processdef',
processDefinitionVersion: 60,
processDefinitionDeploymentId: '338695',
graphicalNotationDefined: true,
startFormDefined: false,
suspended: false,
variables: []
},
{
id: '337604',
name: 'John Jacobs AMERICAS Onboarding',
businessKey: null,
processDefinitionId: 'HROnboarding:49:303243',
tenantId: 'tenant_1',
started: '2017-09-25T10:02:23.522+0000',
ended: null,
startedBy: {
id: 4004,
firstName: 'Integration',
lastName: 'Test',
email: 'srintegrationtest@test.com'
},
processDefinitionName: 'HROnboarding',
processDefinitionDescription: 'HR Onboarding Workflow',
processDefinitionKey: 'fakeProcessDefinitionKey2',
processDefinitionCategory: 'http://www.activiti.org/processdef',
processDefinitionVersion: 49,
processDefinitionDeploymentId: '303234',
graphicalNotationDefined: true,
startFormDefined: false,
suspended: false,
variables: []
}
]
};

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AppDefinitionRepresentationModel, TaskDetailsModel } from '../../task-list';
import { TaskDetailsModel } from '../../task-list';
import { ProcessDefinitionRepresentation } from '../../process-list/models/process-definition.model';
export const mockError = {
@@ -23,38 +23,21 @@ export const mockError = {
messageKey: 'GENERAL.ERROR.FORBIDDEN'
};
export const fakeApp1 = new AppDefinitionRepresentationModel({
deploymentId: 26,
name: 'HR processes',
icon: 'glyphicon-cloud',
description: null,
theme: 'theme-6',
modelId: 4,
id: 1
});
export const fakeApp2 = new AppDefinitionRepresentationModel({
deploymentId: 2501,
name: 'Sales onboarding',
icon: 'glyphicon-asterisk',
description: null,
theme: 'theme-1',
modelId: 1002,
id: 1000
});
export const fakeTasksList = {
data: [new TaskDetailsModel({
id: 1,
name: 'Task 1',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
}), new TaskDetailsModel({
id: 2,
name: 'Task 2',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
})]
data: [
new TaskDetailsModel({
id: 1,
name: 'Task 1',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
}),
new TaskDetailsModel({
id: 2,
name: 'Task 2',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
})
]
};
export const fakeProcessDef = new ProcessDefinitionRepresentation({

View File

@@ -21,9 +21,7 @@ export * from './process/start-process.component.mock';
export * from './process/process.model.mock';
export * from './process/process-comments.mock';
export * from './task/start-task.mock';
export * from './task/task-details.mock';
export * from './task/task-details.component.mock';
export * from './task/task-list.mock';
export * from './task/tasklist-service.mock';
export * from './process/process-filters.mock';

View File

@@ -1,25 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const startTaskMock = {
name: 'fakeName',
description: 'fakeDescription',
assignee: null,
dueDate: '2017-11-03T15:25:42.749+0000',
formKey: null,
category: 'fakeAppId'
};

View File

@@ -1,20 +0,0 @@
/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const mockTaskDetailsComponent = {
noTaskDetailsTemplateComponent: null
};

View File

@@ -18,46 +18,6 @@
import { UserRepresentation } from '@alfresco/js-api';
import { TaskDetailsModel } from '../../task-list/models/task-details.model';
export const standaloneTaskWithForm = new TaskDetailsModel({
id: '100',
name: 'Standalone Task With Form',
description: null,
category: null,
assignee: {
id: 1001,
firstName: 'Wilbur',
lastName: 'Adams',
email: 'wilbur@app.activiti.com'
},
created: '2016-11-03T15:25:42.749+0000',
dueDate: null,
endDate: null,
duration: null,
priority: 50,
parentTaskId: null,
parentTaskName: null,
processInstanceId: null,
processInstanceName: null,
processDefinitionId: null,
processDefinitionName: null,
processDefinitionDescription: null,
processDefinitionKey: null,
processDefinitionCategory: null,
processDefinitionVersion: null,
processDefinitionDeploymentId: null,
formKey: '222',
processInstanceStartUserId: null,
initiatorCanCompleteTask: false,
adhocTaskCanBeReassigned: false,
taskDefinitionKey: 'sid-DDECD9E4-0299-433F-9193-C3D905C3EEBE',
executionId: '86',
involvedGroups: [],
involvedPeople: [],
memberOfCandidateUsers: false,
managerOfCandidateGroup: false,
memberOfCandidateGroup: false
});
export const standaloneTaskWithoutForm = new TaskDetailsModel({
id: '200',
name: 'Standalone Task Without Form',
@@ -546,7 +506,7 @@ export const taskDetailsWithOutFormMock = new TaskDetailsModel({
name: 'Request translation',
description: 'fake description',
category: null,
assignee: {id: 1001, firstName: 'Admin', lastName: 'Paul', email: 'fake-email@gmail.com' },
assignee: { id: 1001, firstName: 'Admin', lastName: 'Paul', email: 'fake-email@gmail.com' },
created: '2016-11-03T15:25:42.749+0000',
dueDate: '2016-11-03T15:25:42.749+0000',
endDate: null,
@@ -576,260 +536,260 @@ export const taskDetailsWithOutFormMock = new TaskDetailsModel({
});
export const taskFormMock = {
id: 4,
name: 'Translation request',
processDefinitionId: 'TranslationProcess:2:8',
processDefinitionName: 'Translation Process',
processDefinitionKey: 'TranslationProcess',
taskId: '91',
taskDefinitionKey: 'sid-DDECD9E4-0299-433F-9193-C3D905C3EEBE',
tabs: [],
fields: [
{
fieldType: 'ContainerRepresentation',
id: '1582747048995',
name: 'Label',
type: 'container',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
dateDisplayFormat: null,
layout: null,
sizeX: 2,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null,
numberOfColumns: 2,
fields: {
1: [
{
fieldType: 'FormFieldRepresentation',
id: 'text1',
name: 'Text1',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 2 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
],
2: [
{
fieldType: 'FormFieldRepresentation',
id: 'text2',
name: 'Text2',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 1 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
]
}
},
{
fieldType: 'ContainerRepresentation',
id: '1582747052793',
name: 'Label',
type: 'container',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
dateDisplayFormat: null,
layout: null,
sizeX: 2,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null,
numberOfColumns: 2,
fields: {
1: [
{
fieldType: 'FormFieldRepresentation',
id: 'text3',
name: 'Text3',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 2 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: {
leftFormFieldId: 'text1',
leftRestResponseId: null,
operator: '==',
rightValue: '',
rightType: null,
rightFormFieldId: 'text2',
rightRestResponseId: '',
nextConditionOperator: '',
nextCondition: null
}
}
],
2: [
{
fieldType: 'FormFieldRepresentation',
id: 'numberField',
name: 'numberField',
type: 'integer',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: {
existingColspan: 1,
maxColspan: 1
},
dateDisplayFormat: null,
layout: {
row: -1,
column: -1,
colspan: 1
},
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
]
}
}
],
outcomes: [],
javascriptEvents: [],
className: '',
style: '',
customFieldTemplates: {},
metadata: {},
variables: [],
customFieldsValueInfo: {},
gridsterForm: false,
globalDateFormat: 'D-M-YYYY'
};
id: 4,
name: 'Translation request',
processDefinitionId: 'TranslationProcess:2:8',
processDefinitionName: 'Translation Process',
processDefinitionKey: 'TranslationProcess',
taskId: '91',
taskDefinitionKey: 'sid-DDECD9E4-0299-433F-9193-C3D905C3EEBE',
tabs: [],
fields: [
{
fieldType: 'ContainerRepresentation',
id: '1582747048995',
name: 'Label',
type: 'container',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
dateDisplayFormat: null,
layout: null,
sizeX: 2,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null,
numberOfColumns: 2,
fields: {
1: [
{
fieldType: 'FormFieldRepresentation',
id: 'text1',
name: 'Text1',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 2 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
],
2: [
{
fieldType: 'FormFieldRepresentation',
id: 'text2',
name: 'Text2',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 1 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
]
}
},
{
fieldType: 'ContainerRepresentation',
id: '1582747052793',
name: 'Label',
type: 'container',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
dateDisplayFormat: null,
layout: null,
sizeX: 2,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null,
numberOfColumns: 2,
fields: {
1: [
{
fieldType: 'FormFieldRepresentation',
id: 'text3',
name: 'Text3',
type: 'text',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: { existingColspan: 1, maxColspan: 2 },
dateDisplayFormat: null,
layout: { row: -1, column: -1, colspan: 1 },
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: {
leftFormFieldId: 'text1',
leftRestResponseId: null,
operator: '==',
rightValue: '',
rightType: null,
rightFormFieldId: 'text2',
rightRestResponseId: '',
nextConditionOperator: '',
nextCondition: null
}
}
],
2: [
{
fieldType: 'FormFieldRepresentation',
id: 'numberField',
name: 'numberField',
type: 'integer',
value: null,
required: false,
readOnly: false,
overrideId: false,
colspan: 1,
placeholder: null,
minLength: 0,
maxLength: 0,
minValue: null,
maxValue: null,
regexPattern: null,
optionType: null,
hasEmptyValue: null,
options: null,
restUrl: null,
restResponsePath: null,
restIdProperty: null,
restLabelProperty: null,
tab: null,
className: null,
params: {
existingColspan: 1,
maxColspan: 1
},
dateDisplayFormat: null,
layout: {
row: -1,
column: -1,
colspan: 1
},
sizeX: 1,
sizeY: 1,
row: -1,
col: -1,
visibilityCondition: null
}
]
}
}
],
outcomes: [],
javascriptEvents: [],
className: '',
style: '',
customFieldTemplates: {},
metadata: {},
variables: [],
customFieldsValueInfo: {},
gridsterForm: false,
globalDateFormat: 'D-M-YYYY'
};
export const tasksMock = [new TaskDetailsModel(taskDetailsMock)];

View File

@@ -18,176 +18,159 @@
import { TaskListModel } from '../../task-list/models/task-list.model';
import { fakeAppFilter } from './task-filters.mock';
export const fakeApps = {
size: 2, total: 2, start: 0,
data: [
{
id: 1, defaultAppId: null, name: 'Sales-Fakes-App', description: 'desc-fake1', modelId: 22,
theme: 'theme-1-fake', icon: 'glyphicon-asterisk', deploymentId: '111', tenantId: null
},
{
id: 2, defaultAppId: null, name: 'health-care-Fake', description: 'desc-fake2', modelId: 33,
theme: 'theme-2-fake', icon: 'glyphicon-asterisk', deploymentId: '444', tenantId: null
}
]
};
export const fakeUser1 = { id: 1, email: 'fake-email@dom.com', firstName: 'firstName', lastName: 'lastName' };
export const fakeUser2 = { id: 1001, email: 'some-one@somegroup.com', firstName: 'some', lastName: 'one' };
export const fakeTaskList = new TaskListModel({
size: 1, total: 1, start: 0,
size: 1,
total: 1,
start: 0,
data: [
{
id: '1', name: 'FakeNameTask', description: null, category: null,
id: '1',
name: 'FakeNameTask',
description: null,
category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
});
export const fakeTaskListDifferentProcessDefinitionKey = {
size: 2, total: 1, start: 0,
data: [
{
id: '1', name: 'FakeNameTask', description: null, category: null,
assignee: fakeUser1,
processDefinitionKey: '1',
created: '2016-07-15T11:19:17.440+0000'
},
{
id: '2', name: 'FakeNameTask2', description: null, category: null,
assignee: fakeUser1,
processDefinitionKey: '2',
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export const secondFakeTaskList = {
size: 1, total: 1, start: 0,
size: 1,
total: 1,
start: 0,
data: [
{
id: '200', name: 'FakeNameTask', description: null, category: null,
id: '200',
name: 'FakeNameTask',
description: null,
category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export const mockErrorTaskList = {
error: 'wrong request'
};
export const fakeTaskDetails = { id: '999', name: 'fake-task-name', formKey: '99', assignee: fakeUser1 };
export const fakeTasksComment = {
size: 2, total: 2, start: 0,
data: [
{
id: 1, message: 'fake-message-1', created: '', createdBy: fakeUser1
},
{
id: 2, message: 'fake-message-2', created: '', createdBy: fakeUser1
}
]
};
export const fakeTasksChecklist = {
size: 1, total: 1, start: 0,
size: 1,
total: 1,
start: 0,
data: [
{
id: 1, name: 'FakeCheckTask1', description: null, category: null,
id: 1,
name: 'FakeCheckTask1',
description: null,
category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
},
{
id: 2, name: 'FakeCheckTask2', description: null, category: null,
id: 2,
name: 'FakeCheckTask2',
description: null,
category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export const fakeAppPromise = new Promise((resolve) => {
resolve(fakeAppFilter);
});
export const fakeAppPromise = Promise.resolve(fakeAppFilter);
export const fakeFormList = {
size: 2,
total: 2,
start: 0,
data: [{
id: 1,
name: 'form with all widgets',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1491400951205,
latestVersion: true,
version: 4,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
}, {
id: 2,
name: 'uppy',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1490951054477,
latestVersion: true,
version: 2,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
}]
data: [
{
id: 1,
name: 'form with all widgets',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1491400951205,
latestVersion: true,
version: 4,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
},
{
id: 2,
name: 'uppy',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1490951054477,
latestVersion: true,
version: 2,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
}
]
};
export const fakeTaskOpen1 = {
id: '1', name: 'FakeOpenTask1', description: null, category: null,
assignee: fakeUser1,
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
id: '1',
name: 'FakeOpenTask1',
description: null,
category: null,
assignee: fakeUser1,
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
export const fakeTaskOpen2 = {
id: '1', name: 'FakeOpenTask2', description: null, category: null,
assignee: { id: 1, email: 'fake-open-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
id: '1',
name: 'FakeOpenTask2',
description: null,
category: null,
assignee: { id: 1, email: 'fake-open-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
export const fakeTaskCompleted1 = {
id: '1', name: 'FakeCompletedTaskName1', description: null, category: null,
assignee: { id: 1, email: 'fake-completed-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2016-07-15T11:19:17.440+0000',
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
id: '1',
name: 'FakeCompletedTaskName1',
description: null,
category: null,
assignee: { id: 1, email: 'fake-completed-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2016-07-15T11:19:17.440+0000',
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
export const fakeTaskCompleted2 = {
id: '1', name: 'FakeCompletedTaskName2', description: null, category: null,
assignee: fakeUser1,
created: null,
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
id: '1',
name: 'FakeCompletedTaskName2',
description: null,
category: null,
assignee: fakeUser1,
created: null,
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
export const fakeOpenTaskList = new TaskListModel({
size: 2,

View File

@@ -15,15 +15,8 @@
* limitations under the License.
*/
import {
Component, EventEmitter, Input, OnChanges, OnInit,
Output, SimpleChanges, ViewChild, ViewEncapsulation, OnDestroy
} from '@angular/core';
import {
AppConfigService,
AppConfigValues,
FormValues
} from '@alfresco/adf-core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation, OnDestroy } from '@angular/core';
import { AppConfigService, AppConfigValues, FormValues } from '@alfresco/adf-core';
import { AppsProcessService } from '../../app-list/services/apps-process.service';
import { ProcessInstanceVariable } from '../models/process-instance-variable.model';
import { ProcessDefinitionRepresentation } from './../models/process-definition.model';
@@ -35,7 +28,7 @@ import { map, takeUntil } from 'rxjs/operators';
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
import { MatSelectChange } from '@angular/material/select';
import { StartFormComponent } from '../../form';
import { MinimalNode, RelatedContentRepresentation } from '@alfresco/js-api';
import { Node, RelatedContentRepresentation } from '@alfresco/js-api';
import { AppDefinitionRepresentationModel } from '../../task-list';
import { ProcessNamePipe } from '../../pipes/process-name.pipe';
import { ActivitiContentService } from '../../form/services/activiti-alfresco.service';
@@ -48,7 +41,6 @@ const MAX_LENGTH = 255;
encapsulation: ViewEncapsulation.None
})
export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestroy {
/** (optional) Limit the list of processes that can be started to those
* contained in the specified app.
*/
@@ -130,24 +122,28 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
movedNodeToPS: FormValues;
private onDestroy$ = new Subject<boolean>();
constructor(private activitiProcess: ProcessService,
private activitiContentService: ActivitiContentService,
private appsProcessService: AppsProcessService,
private appConfig: AppConfigService,
private processNamePipe: ProcessNamePipe) {
}
constructor(
private activitiProcess: ProcessService,
private activitiContentService: ActivitiContentService,
private appsProcessService: AppsProcessService,
private appConfig: AppConfigService,
private processNamePipe: ProcessNamePipe
) {}
ngOnInit() {
this.processNameInput = new UntypedFormControl('', [Validators.required, Validators.maxLength(this.maxProcessNameLength), Validators.pattern('^[^\\s]+(\\s+[^\\s]+)*$')]);
this.processNameInput = new UntypedFormControl('', [
Validators.required,
Validators.maxLength(this.maxProcessNameLength),
Validators.pattern('^[^\\s]+(\\s+[^\\s]+)*$')
]);
this.processDefinitionInput = new UntypedFormControl();
this.load();
this.filteredProcessesDefinitions$ = this.processDefinitionInput.valueChanges
.pipe(
map((value) => this._filter(value)),
takeUntil(this.onDestroy$)
);
this.filteredProcessesDefinitions$ = this.processDefinitionInput.valueChanges.pipe(
map((value) => this._filter(value)),
takeUntil(this.onDestroy$)
);
this.activitiContentService.getAlfrescoRepositories().subscribe((repoList) => {
if (repoList && repoList[0]) {
@@ -199,34 +195,40 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
this.isProcessDefinitionsLoading = true;
this.resetSelectedProcessDefinition();
this.activitiProcess.getProcessDefinitions(appId).pipe(
map((processDefinitionRepresentations: ProcessDefinitionRepresentation[]) => {
let currentProcessDef: ProcessDefinitionRepresentation;
this.activitiProcess
.getProcessDefinitions(appId)
.pipe(
map((processDefinitionRepresentations: ProcessDefinitionRepresentation[]) => {
let currentProcessDef: ProcessDefinitionRepresentation;
if (processDefinitionRepresentations.length === 1) {
currentProcessDef = processDefinitionRepresentations[0];
}
if (this.processDefinitionName) {
const filteredProcessDefinition = processDefinitionRepresentations.find((processDefinition) => processDefinition.name === this.processDefinitionName);
if (filteredProcessDefinition) {
currentProcessDef = filteredProcessDefinition;
if (processDefinitionRepresentations.length === 1) {
currentProcessDef = processDefinitionRepresentations[0];
}
}
return { currentProcessDef, processDefinitionRepresentations };
})
).subscribe(
(filteredProcessDefinitions) => {
this.processDefinitions = filteredProcessDefinitions.processDefinitionRepresentations;
this.processDefinitionSelectionChanged(filteredProcessDefinitions.currentProcessDef);
this.processDefinitionInput.setValue(this.selectedProcessDef ? this.selectedProcessDef.name : '');
this.isProcessDefinitionsLoading = false;
},
(error) => {
this.isProcessDefinitionsLoading = false;
this.error.emit(error);
});
if (this.processDefinitionName) {
const filteredProcessDefinition = processDefinitionRepresentations.find(
(processDefinition) => processDefinition.name === this.processDefinitionName
);
if (filteredProcessDefinition) {
currentProcessDef = filteredProcessDefinition;
}
}
return { currentProcessDef, processDefinitionRepresentations };
})
)
.subscribe(
(filteredProcessDefinitions) => {
this.processDefinitions = filteredProcessDefinitions.processDefinitionRepresentations;
this.processDefinitionSelectionChanged(filteredProcessDefinitions.currentProcessDef);
this.processDefinitionInput.setValue(this.selectedProcessDef ? this.selectedProcessDef.name : '');
this.isProcessDefinitionsLoading = false;
},
(error) => {
this.isProcessDefinitionsLoading = false;
this.error.emit(error);
}
);
}
filterProcessDefinitionByName() {
@@ -244,7 +246,8 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
this.isAppsLoading = true;
this.appsProcessService
.getDeployedApplications()
.pipe(map((response: AppDefinitionRepresentationModel[]) => {
.pipe(
map((response: AppDefinitionRepresentationModel[]) => {
const applications = this.removeDefaultApps(response);
let currentApplication: AppDefinitionRepresentationModel;
@@ -252,7 +255,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
currentApplication = applications[0];
}
const filteredApp = applications.find( app => app.id === +this.appId );
const filteredApp = applications.find((app) => app.id === +this.appId);
if (filteredApp) {
currentApplication = filteredApp;
@@ -261,7 +264,8 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
return { currentApplication, applications };
})
)
.subscribe((filteredApps) => {
.subscribe(
(filteredApps) => {
this.applications = filteredApps.applications;
this.selectedApplication = filteredApps.currentApplication;
this.applicationSelection.emit(this.selectedApplication);
@@ -274,7 +278,6 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
this.error.emit(err);
}
);
}
loadProcessDefinitionsBasedOnSelectedApp() {
@@ -328,10 +331,11 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
for (const key in this.values) {
if (this.values.hasOwnProperty(key)) {
const currentValue = Array.isArray(this.values[key]) ? this.values[key] : [this.values[key]];
const contents = currentValue.filter((value: any) => value && value.isFile)
.map((content: MinimalNode) => this.activitiContentService.applyAlfrescoNode(content, null, accountIdentifier));
const contents = currentValue
.filter((value: any) => value && value.isFile)
.map((content: Node) => this.activitiContentService.applyAlfrescoNode(content, null, accountIdentifier));
forkJoin(contents).subscribe((res: RelatedContentRepresentation[]) => {
this.movedNodeToPS = { [key]: [...res]};
this.movedNodeToPS = { [key]: [...res] };
});
}
}
@@ -435,7 +439,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
return !!(this.selectedApplication && this.selectedApplication.id);
}
private removeDefaultApps(apps: AppDefinitionRepresentationModel []): AppDefinitionRepresentationModel[] {
private removeDefaultApps(apps: AppDefinitionRepresentationModel[]): AppDefinitionRepresentationModel[] {
return apps.filter((app) => app.id);
}
@@ -466,8 +470,11 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
}
private isProcessDefinitionChanged(changes: SimpleChanges) {
return changes['processDefinitionName'] && changes['processDefinitionName'].currentValue &&
changes['processDefinitionName'].currentValue !== changes['processDefinitionName'].previousValue;
return (
changes['processDefinitionName'] &&
changes['processDefinitionName'].currentValue &&
changes['processDefinitionName'].currentValue !== changes['processDefinitionName'].previousValue
);
}
private _filter(value: string): ProcessDefinitionRepresentation[] {