mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Fix taskId parameter to getTaskComment
This commit is contained in:
parent
d39913491f
commit
6d8cc05f68
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||
import { Comment } from '../models/comment.model';
|
||||
@ -29,9 +29,10 @@ declare let __moduleName: string;
|
||||
selector: 'activiti-process-instance-comments',
|
||||
moduleId: __moduleName,
|
||||
templateUrl: './activiti-comments.component.html',
|
||||
styleUrls: ['./activiti-comments.component.css']
|
||||
styleUrls: ['./activiti-comments.component.css'],
|
||||
providers: [ActivitiProcessService]
|
||||
})
|
||||
export class ActivitiComments implements OnInit {
|
||||
export class ActivitiComments implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
processInstanceId: string;
|
||||
@ -46,6 +47,11 @@ export class ActivitiComments implements OnInit {
|
||||
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param auth
|
||||
* @param translate
|
||||
*/
|
||||
constructor(private translate: AlfrescoTranslationService,
|
||||
private activitiProcess: ActivitiProcessService) {
|
||||
|
||||
@ -61,16 +67,20 @@ export class ActivitiComments implements OnInit {
|
||||
this.comment$.subscribe((comment: Comment) => {
|
||||
this.comments.push(comment);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.processInstanceId) {
|
||||
this.load(this.processInstanceId);
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let processInstanceId = changes['processInstanceId'];
|
||||
if (processInstanceId && processInstanceId.currentValue) {
|
||||
this.getProcessComments(processInstanceId.currentValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public load(taskId: string) {
|
||||
public getProcessComments(processInstanceId: string) {
|
||||
this.comments = [];
|
||||
if (this.processInstanceId) {
|
||||
this.activitiProcess.getProcessInstanceComments(this.processInstanceId).subscribe(
|
||||
if (processInstanceId) {
|
||||
this.activitiProcess.getProcessInstanceComments(processInstanceId).subscribe(
|
||||
(res: Comment[]) => {
|
||||
res.forEach((comment) => {
|
||||
this.commentObserver.next(comment);
|
||||
|
@ -106,9 +106,6 @@ export class ActivitiProcessInstanceDetails implements OnInit, OnChanges {
|
||||
(res: ProcessInstance) => {
|
||||
this.processInstanceDetails = res;
|
||||
if (this.processInstanceDetails) {
|
||||
if (this.commentsList) {
|
||||
this.commentsList.load(this.processInstanceDetails.id);
|
||||
}
|
||||
if (this.tasksList) {
|
||||
this.tasksList.load(this.processInstanceDetails.id);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
@ -32,7 +32,7 @@ declare let __moduleName: string;
|
||||
styleUrls: ['./activiti-checklist.component.css'],
|
||||
providers: [ActivitiTaskListService]
|
||||
})
|
||||
export class ActivitiChecklist implements OnInit {
|
||||
export class ActivitiChecklist implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
taskId: string;
|
||||
@ -66,13 +66,17 @@ export class ActivitiChecklist implements OnInit {
|
||||
this.task$.subscribe((task: TaskDetailsModel) => {
|
||||
this.checklist.push(task);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.taskId) {
|
||||
this.load(this.taskId);
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let taskId = changes['taskId'];
|
||||
if (taskId && taskId.currentValue) {
|
||||
this.getTaskChecklist(taskId.currentValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public load(taskId: string) {
|
||||
public getTaskChecklist(taskId: string) {
|
||||
this.checklist = [];
|
||||
if (this.taskId) {
|
||||
this.activitiTaskList.getTaskChecklist(this.taskId).subscribe(
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
|
||||
import { Comment } from '../models/comment.model';
|
||||
@ -32,7 +32,7 @@ declare let __moduleName: string;
|
||||
styleUrls: ['./activiti-comments.component.css'],
|
||||
providers: [ActivitiTaskListService]
|
||||
})
|
||||
export class ActivitiComments implements OnInit {
|
||||
export class ActivitiComments implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
taskId: string;
|
||||
@ -68,16 +68,20 @@ export class ActivitiComments implements OnInit {
|
||||
this.comment$.subscribe((comment: Comment) => {
|
||||
this.comments.push(comment);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.taskId) {
|
||||
this.load(this.taskId);
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let taskId = changes['taskId'];
|
||||
if (taskId && taskId.currentValue) {
|
||||
this.getTaskComments(taskId.currentValue);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public load(taskId: string) {
|
||||
public getTaskComments(taskId: string) {
|
||||
this.comments = [];
|
||||
if (this.taskId) {
|
||||
this.activitiTaskList.getTaskComments(this.taskId).subscribe(
|
||||
if (taskId) {
|
||||
this.activitiTaskList.getTaskComments(taskId).subscribe(
|
||||
(res: Comment[]) => {
|
||||
res.forEach((comment) => {
|
||||
this.commentObserver.next(comment);
|
||||
|
@ -159,14 +159,6 @@ export class ActivitiTaskDetails implements OnInit, OnChanges {
|
||||
this.taskPeople.push(new User(user));
|
||||
});
|
||||
}
|
||||
if (this.activiticomments) {
|
||||
this.activiticomments.load(this.taskDetails.id);
|
||||
}
|
||||
|
||||
if (this.activitichecklist) {
|
||||
this.activitichecklist.load(this.taskDetails.id);
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user