Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-3881] Able to start form with preselected ACS nodes #6700

Merged
merged 5 commits into from Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/process-services/src/lib/form/start-form.component.ts
Expand Up @@ -84,6 +84,12 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
return;
}

const data = changes['data'];
if (data && data.currentValue) {
this.parseForm(this.form.json);
return;
}

const processId = changes['processId'];
if (processId && processId.currentValue) {
this.visibilityService.cleanProcessVariable();
Expand Down
Expand Up @@ -77,11 +77,11 @@
</mat-form-field>

<ng-container *ngIf="!isProcessDefinitionsLoading ; else showStartFormLoadingTemplate">
<ng-container *ngIf="isProcessDefinitionSelected() ; else emptyProcessDefTemplate">
<ng-container *ngIf="isProcessDefinitionSelected() && isMovingNodeDone ; else emptyProcessDefTemplate">
<ng-container *ngIf="hasStartForm(); else noStartFormTemplate">
<adf-start-form
#startForm
[data]="values"
[data]="movedNodeToPS"
[disableStartProcessButton]="processNameInput.invalid"
[processDefinitionId]="selectedProcessDef.id"
(outcomeClick)="onOutcomeClick($event)"
Expand Down
Expand Up @@ -127,6 +127,8 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr

isProcessDefinitionsLoading = true;
isAppsLoading = true;
isMovingNodeDone = true;
movedNodeToPS = {};

private onDestroy$ = new Subject<boolean>();
constructor(private activitiProcess: ProcessService,
Expand Down Expand Up @@ -357,14 +359,18 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
}

moveNodeFromCStoPS(): void {
this.isMovingNodeDone = false;
const accountIdentifier = this.getAlfrescoRepositoryName();

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));
forkJoin(contents).subscribe((res: RelatedContentRepresentation[]) => this.values[key] = [...res] );
forkJoin(contents).subscribe((res: RelatedContentRepresentation[]) => {
this.movedNodeToPS[key] = [...res];
this.isMovingNodeDone = true;
});
}
}
}
Expand Down