mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[ADF-4128] ProcessCloud - add complete task directive (#4364)
* [ADF-4128] ProcessCloud - add complete task directive * [ADF-4128] ProcessCloud - fix completion functionality and add documentation * [ADF-4128] ProcessCloud - PR changes * [ADF-4128] ProcessCloud - lint * [ADF-4148] ProcessServicesCloud - change layout * [ADF-4128] fix PR changes * [ADF-4128] - refractor complete task directive * [ADF-4128] - fix lint * [ADF-4128] - PR changes * [ADF-4128] - replace isCompleted method from service with model method * [ADF-4128] fix unit tests * [ADF-4128] - change travis yml * [ADF-4128] - fix travis.yml * [ADF-4128] - travis lint
This commit is contained in:
committed by
Eugenio Romano
parent
e586ee17d5
commit
791051edee
@@ -25,10 +25,10 @@ import {
|
||||
AppConfigService,
|
||||
UpdateNotification,
|
||||
CardViewUpdateService,
|
||||
StorageService
|
||||
IdentityUserService
|
||||
} from '@alfresco/adf-core';
|
||||
import { TaskHeaderCloudService } from '../services/task-header-cloud.service';
|
||||
import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model';
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-task-header',
|
||||
@@ -64,11 +64,11 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
private currentUser: string;
|
||||
|
||||
constructor(
|
||||
private taskHeaderCloudService: TaskHeaderCloudService,
|
||||
private taskCloudService: TaskCloudService,
|
||||
private translationService: TranslationService,
|
||||
private appConfig: AppConfigService,
|
||||
private cardViewUpdateService: CardViewUpdateService,
|
||||
private storage: StorageService
|
||||
private identityUserService: IdentityUserService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
@@ -79,12 +79,13 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
|
||||
this.cardViewUpdateService.itemUpdated$.subscribe(this.updateTaskDetails.bind(this));
|
||||
}
|
||||
|
||||
loadCurrentBpmUserId(): any {
|
||||
this.currentUser = this.storage.getItem('USERNAME');
|
||||
this.currentUser = this.identityUserService.getCurrentUserInfo().username;
|
||||
}
|
||||
|
||||
loadTaskDetailsById(appName: string, taskId: string): any {
|
||||
this.taskHeaderCloudService.getTaskById(appName, taskId).subscribe(
|
||||
this.taskCloudService.getTaskById(appName, taskId).subscribe(
|
||||
(taskDetails) => {
|
||||
this.taskDetails = taskDetails;
|
||||
if (this.taskDetails.parentTaskId) {
|
||||
@@ -204,7 +205,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
* @param updateNotification
|
||||
*/
|
||||
private updateTaskDetails(updateNotification: UpdateNotification) {
|
||||
this.taskHeaderCloudService.updateTask(this.appName, this.taskId, updateNotification.changed)
|
||||
this.taskCloudService.updateTask(this.appName, this.taskId, updateNotification.changed)
|
||||
.subscribe(
|
||||
(taskDetails) => {
|
||||
this.taskDetails = taskDetails;
|
||||
@@ -214,7 +215,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
}
|
||||
|
||||
private loadParentName(taskId) {
|
||||
this.taskHeaderCloudService.getTaskById(this.appName, taskId)
|
||||
this.taskCloudService.getTaskById(this.appName, taskId)
|
||||
.subscribe(
|
||||
(taskDetails) => {
|
||||
this.parentTaskName = taskDetails.name;
|
||||
@@ -223,10 +224,6 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
isCompleted() {
|
||||
return this.taskDetails && this.taskDetails.status === 'completed';
|
||||
}
|
||||
|
||||
isTaskClaimable(): boolean {
|
||||
return !this.hasAssignee() && this.isCandidateMember();
|
||||
}
|
||||
@@ -240,7 +237,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
}
|
||||
|
||||
isTaskClaimedByCandidateMember(): boolean {
|
||||
return this.isCandidateMember() && this.isAssignedToCurrentUser() && !this.isCompleted();
|
||||
return this.isCandidateMember() && this.isAssignedToCurrentUser() && !this.taskDetails.isCompleted();
|
||||
}
|
||||
|
||||
isAssignedToCurrentUser(): boolean {
|
||||
@@ -260,7 +257,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
}
|
||||
|
||||
claimTask() {
|
||||
this.taskHeaderCloudService.claimTask(this.appName, this.taskId, this.currentUser).subscribe(
|
||||
this.taskCloudService.claimTask(this.appName, this.taskId, this.currentUser).subscribe(
|
||||
(res: any) => {
|
||||
this.loadTaskDetailsById(this.appName, this.taskId);
|
||||
this.claim.emit(this.taskId);
|
||||
@@ -268,7 +265,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
}
|
||||
|
||||
unclaimTask() {
|
||||
this.taskHeaderCloudService.unclaimTask(this.appName, this.taskId).subscribe(
|
||||
this.taskCloudService.unclaimTask(this.appName, this.taskId).subscribe(
|
||||
() => {
|
||||
this.loadTaskDetailsById(this.appName, this.taskId);
|
||||
this.unclaim.emit(this.taskId);
|
||||
|
Reference in New Issue
Block a user