#724 correctly handle 'formKey' property

due to some reason Activiti stores/serializes null as a “null” string
rather than value for a ‘formKey’ property; added checks for this case
This commit is contained in:
Denys Vuika 2016-09-12 13:08:05 +01:00
parent 76b5faf63b
commit c36d430fc8
2 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,4 @@
<div *ngIf="!taskDetails">
<div *ngIf="!hasFormKey()">
<template *ngIf="noTaskDetailsTemplateComponent" ngFor [ngForOf]="[data]"
[ngForTemplate]="noTaskDetailsTemplateComponent">
{{ 'TASK_DETAILS.MESSAGES.NONE' | translate }}
@ -7,7 +7,7 @@
{{ 'TASK_DETAILS.MESSAGES.NONE' | translate }}
</div>
</div>
<div *ngIf="taskDetails">
<div *ngIf="hasFormKey()">
<h2 class="mdl-card__title-text">{{taskDetails.name}}</h2>
<activiti-task-header [taskDetails]="taskDetails" #activitiheader></activiti-task-header>
<div class="mdl-grid">
@ -21,7 +21,7 @@
<activiti-checklist [taskId]="taskId" #activitichecklist></activiti-checklist>
</div>
</div>
<activiti-form *ngIf="taskDetails.formKey" [taskId]="taskId"
<activiti-form *ngIf="hasFormKey()" [taskId]="taskId"
[showTitle]="showTitle"
[showRefreshButton]="showRefreshButton"
[showCompleteButton]="showCompleteButton"

View File

@ -117,6 +117,12 @@ export class ActivitiTaskDetails implements OnInit {
this.taskDetails = null;
}
hasFormKey() {
return this.taskDetails
&& this.taskDetails.formKey
&& this.taskDetails.formKey !== 'null';
}
/**
* Load the activiti task details
* @param taskId
@ -130,12 +136,9 @@ export class ActivitiTaskDetails implements OnInit {
this.taskDetails = res;
let endDate: any = res.endDate;
if (endDate && !isNaN(endDate.getTime())) {
this.readOnly = true;
} else {
this.readOnly = false;
}
this.readOnly = !!(endDate && !isNaN(endDate.getTime()));
if (this.hasFormKey()) {
if (this.taskDetails && this.taskDetails.involvedPeople) {
this.taskDetails.involvedPeople.forEach((user) => {
this.taskPeople.push(new User(user.id, user.email, user.firstName, user.lastName));
@ -151,6 +154,7 @@ export class ActivitiTaskDetails implements OnInit {
}
console.log(this.taskDetails);
}
}
);
} else {
this.reset();