From f828e8e8472c86ecc31630c43c18cd7dd65a69ef Mon Sep 17 00:00:00 2001 From: siva kumar Date: Thu, 15 Feb 2018 15:48:41 +0530 Subject: [PATCH] [ADF-2118] Process Initiator should be able to complete a task (#2951) * [ADF-2118] Process Initiator should be able to complete a task. * Fixed Process Initiator should be able to complete a task. * * Fixed Process Initiator should be able to complete a task. * * Removed extra space --- .../process-service/process-service.component.ts | 6 ++++++ .../components/task-details.component.html | 4 ++-- .../components/task-details.component.ts | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/demo-shell/src/app/components/process-service/process-service.component.ts b/demo-shell/src/app/components/process-service/process-service.component.ts index 77be55e6eb..e4fbe79505 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.ts +++ b/demo-shell/src/app/components/process-service/process-service.component.ts @@ -369,12 +369,18 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit this.taskPage = this.taskListPagination.current - 1; if (this.taskList) { this.taskList.reload(); + } else { + this.navigateToProcess(); } if (this.processList) { this.processList.reload(); } } + navigateToProcess(): void { + this.router.navigate([`/activiti/apps/${this.appId}/processes/`]); + } + onContentClick(content: any): void { this.fileShowed = true; this.content = content.contentBlob; diff --git a/lib/process-services/task-list/components/task-details.component.html b/lib/process-services/task-list/components/task-details.component.html index 0b26e70845..fbb59c934a 100644 --- a/lib/process-services/task-list/components/task-details.component.html +++ b/lib/process-services/task-list/components/task-details.component.html @@ -28,8 +28,8 @@ [showTitle]="showFormTitle" [showRefreshButton]="showFormRefreshButton" [showCompleteButton]="showFormCompleteButton" - [disableCompleteButton]="!isAssignedToMe()" - [showSaveButton]="showFormSaveButton" + [disableCompleteButton]="!isCompleteButtonVisible()" + [showSaveButton]="isSaveButtonVisible()" [readOnly]="readOnlyForm" [fieldValidators]="fieldValidators" (formSaved)='onFormSaved($event)' diff --git a/lib/process-services/task-list/components/task-details.component.ts b/lib/process-services/task-list/components/task-details.component.ts index 0fc8b8718c..b1ed92a6e7 100644 --- a/lib/process-services/task-list/components/task-details.component.ts +++ b/lib/process-services/task-list/components/task-details.component.ts @@ -284,6 +284,22 @@ export class TaskDetailsComponent implements OnInit, OnChanges { return this.taskDetails.assignee.email === this.authService.getBpmUsername(); } + isCompleteButtonVisible(): boolean { + return this.isAssignedToMe() || this.canInitiatorComplete(); + } + + canInitiatorComplete(): boolean { + return this.taskDetails.initiatorCanCompleteTask; + } + + isSaveButtonVisible(): boolean { + return this.hasSaveButton() && (!this.canInitiatorComplete() || this.isAssignedToMe()); + } + + hasSaveButton(): boolean { + return this.showFormSaveButton; + } + /** * Retrieve the next open task * @param processInstanceId