mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
#1143 - fix multiple call to the load service
This commit is contained in:
parent
3f98ef146d
commit
8e94e67779
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, ViewChild, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { Component, Input, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||
import { ActivitiProcessInstanceHeader } from './activiti-process-instance-header.component';
|
||||
@ -31,7 +31,7 @@ declare let componentHandler: any;
|
||||
templateUrl: './activiti-process-instance-details.component.html',
|
||||
styleUrls: ['./activiti-process-instance-details.component.css']
|
||||
})
|
||||
export class ActivitiProcessInstanceDetails implements OnInit, OnChanges {
|
||||
export class ActivitiProcessInstanceDetails implements OnChanges {
|
||||
|
||||
@Input()
|
||||
processInstanceId: string;
|
||||
@ -72,12 +72,6 @@ export class ActivitiProcessInstanceDetails implements OnInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.processInstanceId) {
|
||||
this.load(this.processInstanceId);
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let processInstanceId = changes['processInstanceId'];
|
||||
if (processInstanceId && !processInstanceId.currentValue) {
|
||||
@ -102,11 +96,6 @@ export class ActivitiProcessInstanceDetails implements OnInit, OnChanges {
|
||||
this.activitiProcess.getProcess(processId).subscribe(
|
||||
(res: ProcessInstance) => {
|
||||
this.processInstanceDetails = res;
|
||||
if (this.processInstanceDetails) {
|
||||
if (this.tasksList) {
|
||||
this.tasksList.load(this.processInstanceDetails.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, ViewChild, Output, EventEmitter } from '@angular/core';
|
||||
import { Component, Input, OnInit, ViewChild, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||
import { TaskDetailsModel } from 'ng2-activiti-tasklist';
|
||||
@ -32,7 +32,7 @@ declare let dialogPolyfill: any;
|
||||
templateUrl: './activiti-process-instance-tasks.component.html',
|
||||
styleUrls: ['./activiti-process-instance-tasks.component.css']
|
||||
})
|
||||
export class ActivitiProcessInstanceTasks implements OnInit {
|
||||
export class ActivitiProcessInstanceTasks implements OnInit, OnChanges {
|
||||
|
||||
@Input()
|
||||
processInstanceDetails: ProcessInstance;
|
||||
@ -84,9 +84,12 @@ export class ActivitiProcessInstanceTasks implements OnInit {
|
||||
this.completedTask$.subscribe((task: TaskDetailsModel) => {
|
||||
this.completedTasks.push(task);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.processInstanceDetails && this.processInstanceDetails.id) {
|
||||
this.load(this.processInstanceDetails.id);
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let processInstanceDetails = changes['processInstanceDetails'];
|
||||
if (processInstanceDetails && processInstanceDetails.currentValue) {
|
||||
this.load(processInstanceDetails.currentValue.id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,7 +154,6 @@ export class ActivitiProcessInstanceTasks implements OnInit {
|
||||
|
||||
public clickTask($event: any, task: TaskDetailsModel) {
|
||||
this.selectedTaskId = task.id;
|
||||
this.taskdetails.loadDetails(task.id);
|
||||
this.showDialog();
|
||||
}
|
||||
|
||||
@ -189,6 +191,7 @@ export class ActivitiProcessInstanceTasks implements OnInit {
|
||||
if (this.dialog) {
|
||||
this.dialog.nativeElement.close();
|
||||
}
|
||||
this.selectedTaskId = null;
|
||||
}
|
||||
|
||||
public onTaskFormCompleted() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user