mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[ADF-4409] ADF for Activiti Community - Be able to claim/release/complete task (#4677)
* Be able to claim/release/complete task for community Be able to start a task/process Fix unsubscribe on destroy * Fix the construnctor
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core';
|
||||
import { Component, Input, OnInit, EventEmitter, Output, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
CardViewDateItemModel,
|
||||
CardViewItem,
|
||||
@@ -29,13 +29,14 @@ import {
|
||||
import { TaskDetailsCloudModel, TaskStatusEnum } from '../../start-task/models/task-details-cloud.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-task-header',
|
||||
templateUrl: './task-header-cloud.component.html',
|
||||
styleUrls: ['./task-header-cloud.component.scss']
|
||||
})
|
||||
export class TaskHeaderCloudComponent implements OnInit {
|
||||
export class TaskHeaderCloudComponent implements OnInit, OnDestroy {
|
||||
|
||||
/** (Required) The name of the application. */
|
||||
@Input()
|
||||
@@ -58,6 +59,8 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
inEdit: boolean = false;
|
||||
parentTaskName: string;
|
||||
|
||||
private subscriptions: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
private taskCloudService: TaskCloudService,
|
||||
private translationService: TranslationService,
|
||||
@@ -71,11 +74,11 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
this.loadTaskDetailsById(this.appName, this.taskId);
|
||||
}
|
||||
|
||||
this.cardViewUpdateService.itemUpdated$.subscribe(this.updateTaskDetails.bind(this));
|
||||
this.subscriptions.push(this.cardViewUpdateService.itemUpdated$.subscribe(this.updateTaskDetails.bind(this)));
|
||||
}
|
||||
|
||||
loadTaskDetailsById(appName: string, taskId: string): any {
|
||||
this.taskCloudService.getTaskById(appName, taskId).subscribe(
|
||||
this.subscriptions.push(this.taskCloudService.getTaskById(appName, taskId).subscribe(
|
||||
(taskDetails) => {
|
||||
this.taskDetails = taskDetails;
|
||||
if (this.taskDetails.parentTaskId) {
|
||||
@@ -83,7 +86,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
} else {
|
||||
this.refreshData();
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private initDefaultProperties() {
|
||||
@@ -244,4 +247,9 @@ export class TaskHeaderCloudComponent implements OnInit {
|
||||
onCompletedTask(event: any) {
|
||||
this.goBack();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach((subscription) => subscription.unsubscribe());
|
||||
this.subscriptions = [];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user