mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Fix hasForm problem
This commit is contained in:
@@ -15,13 +15,13 @@
|
||||
<activiti-people [people]="taskPeople"></activiti-people>
|
||||
</div>
|
||||
<div class="mdl-cell mdl-cell--4-col">
|
||||
<activiti-comments [taskId]="taskId" #activiticomments></activiti-comments>
|
||||
<activiti-comments [taskId]="taskDetails.id" #activiticomments></activiti-comments>
|
||||
</div>
|
||||
<div class="mdl-cell mdl-cell--4-col">
|
||||
<activiti-checklist [taskId]="taskId" #activitichecklist></activiti-checklist>
|
||||
<activiti-checklist [taskId]="taskDetails.id" #activitichecklist></activiti-checklist>
|
||||
</div>
|
||||
</div>
|
||||
<activiti-form *ngIf="hasFormKey()" [taskId]="taskId"
|
||||
<activiti-form *ngIf="hasFormKey()" [taskId]="taskDetails.id"
|
||||
[showTitle]="showTitle"
|
||||
[showRefreshButton]="showRefreshButton"
|
||||
[showCompleteButton]="showCompleteButton"
|
||||
|
@@ -10,9 +10,5 @@
|
||||
{{taskDetails?.dueDate ? taskDetails.dueDate : ('TASK_DETAILS.DUE.NONE' |translate) }}
|
||||
|
||||
</div>
|
||||
<div class="mdl-cell mdl-cell--4-col">
|
||||
<span class="activiti-label">{{ 'TASK_DETAILS.LABELS.FORM' | translate }}</span>:
|
||||
{{taskForm?.name ? taskForm.name : ('TASK_DETAILS.FORM.NONE' | translate) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -15,10 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { AlfrescoTranslationService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { FormModel, FormService } from 'ng2-activiti-form';
|
||||
|
||||
declare let componentHandler: any;
|
||||
declare let __moduleName: string;
|
||||
@@ -27,23 +26,19 @@ declare let __moduleName: string;
|
||||
selector: 'activiti-task-header',
|
||||
moduleId: __moduleName,
|
||||
templateUrl: './activiti-task-header.component.html',
|
||||
styleUrls: ['./activiti-task-header.component.css'],
|
||||
providers: [ FormService ]
|
||||
styleUrls: ['./activiti-task-header.component.css']
|
||||
})
|
||||
export class ActivitiTaskHeader implements OnInit, OnChanges {
|
||||
export class ActivitiTaskHeader implements OnInit {
|
||||
|
||||
@Input()
|
||||
taskDetails: TaskDetailsModel;
|
||||
|
||||
taskForm: FormModel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param auth
|
||||
* @param translate
|
||||
*/
|
||||
constructor(private auth: AlfrescoAuthenticationService,
|
||||
private activitiForm: FormService,
|
||||
private translate: AlfrescoTranslationService) {
|
||||
|
||||
if (translate) {
|
||||
@@ -52,29 +47,7 @@ export class ActivitiTaskHeader implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.taskDetails && this.taskDetails.formKey) {
|
||||
this.load(this.taskDetails.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngOnChanges(change) {
|
||||
if (this.taskDetails && this.taskDetails.formKey) {
|
||||
this.load(this.taskDetails.id);
|
||||
} else {
|
||||
this.taskForm = null;
|
||||
}
|
||||
}
|
||||
|
||||
public load(taskId: string) {
|
||||
if (taskId) {
|
||||
this.activitiForm.getTaskForm(taskId).subscribe(
|
||||
(response) => {
|
||||
this.taskForm = response;
|
||||
},
|
||||
(err) => {
|
||||
console.error(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user