[ACA-3942] Enable assignee edit button only when userTask shared among the candidates (#6113)

* [ACA-3942] Enable assignee edit button only when user task shared among the candidates

* * Moved logic to service level
This commit is contained in:
siva kumar
2020-09-10 22:56:43 +05:30
committed by GitHub
parent 26172f3a6f
commit 14f08f2178
4 changed files with 37 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ import {
CardViewDatetimeItemModel,
CardViewArrayItem
} from '@alfresco/adf-core';
import { TaskDetailsCloudModel, TaskStatus } from '../../start-task/models/task-details-cloud.model';
import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model';
import { TaskCloudService } from '../../services/task-cloud.service';
import { NumericFieldValidator } from '../../../validators/numeric-field.validator';
@@ -141,7 +141,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.ASSIGNEE',
value: this.taskDetails.assignee,
key: 'assignee',
clickable: this.isClickable(),
clickable: this.isAssigneePropertyClickable(),
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.ASSIGNEE_DEFAULT'),
icon: 'create'
}
@@ -318,9 +318,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
return this.taskCloudService.isTaskEditable(this.taskDetails);
}
isClickable(): boolean {
const states: TaskStatus[] = ['ASSIGNED', 'CREATED'];
return states.includes(this.taskDetails.status);
isAssigneePropertyClickable(): boolean {
return this.taskCloudService.isAssigneePropertyClickable(this.taskDetails, this.candidateUsers, this.candidateGroups);
}
private isValidSelection(filteredProperties: string[], cardItem: CardViewBaseItemModel): boolean {