Add boolean flag to reload()

This commit is contained in:
Will Abson
2016-11-22 13:37:53 +00:00
committed by Mario Romano
parent a6a5400956
commit d416488f85

View File

@@ -109,9 +109,9 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
return changed; return changed;
} }
public reload() { public reload(emit?: boolean) {
this.requestNode = this.createRequestNode(); this.requestNode = this.createRequestNode();
this.load(this.requestNode); this.load(this.requestNode, emit);
} }
/** /**
@@ -125,14 +125,17 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
); );
} }
private load(requestNode: TaskQueryRequestRepresentationModel) { private load(requestNode: TaskQueryRequestRepresentationModel, emit?: boolean) {
emit = emit !== false;
this.processService.getProcessInstances(requestNode) this.processService.getProcessInstances(requestNode)
.subscribe( .subscribe(
(response) => { (response) => {
let instancesRow = this.createDataRow(response); let instancesRow = this.createDataRow(response);
this.renderInstances(instancesRow); this.renderInstances(instancesRow);
this.selectFirst(); this.selectFirst();
this.onSuccess.emit(response); if (emit) {
this.onSuccess.emit(response);
}
}, },
error => { error => {
this.onError.emit(error); this.onError.emit(error);
@@ -206,18 +209,18 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
/** /**
* Optimize name field * Optimize name field
* @param istances * @param instances
* @returns {any[]} * @returns {any[]}
*/ */
private optimizeNames(istances: any[]) { private optimizeNames(instances: any[]) {
istances = istances.map(t => { instances = instances.map(t => {
t.obj.name = t.obj.name || 'No name'; t.obj.name = t.obj.name || 'No name';
if (t.obj.name.length > 50) { if (t.obj.name.length > 50) {
t.obj.name = t.obj.name.substring(0, 50) + '...'; t.obj.name = t.obj.name.substring(0, 50) + '...';
} }
return t; return t;
}); });
return istances; return instances;
} }
private createRequestNode() { private createRequestNode() {