diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts index 7303d583f8..e25ee1e82c 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts @@ -84,9 +84,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { static COMPLETE_OUTCOME_ID: string = '$complete'; static CUSTOM_OUTCOME_ID: string = '$custom'; - @Input() - processId: string; - @Input() taskId: string; @@ -196,11 +193,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { } ngOnInit() { - if (this.processId) { - this.loadStartForm(this.processId); - return; - } - if (this.nodeId) { this.loadFormForEcmNode(); } else { @@ -230,12 +222,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { this.getFormDefinitionByFormName(formName.currentValue); return; } - - let processId = changes['processId']; - if (processId && processId.currentValue) { - this.loadStartForm(processId.currentValue); - return; - } } /** @@ -330,21 +316,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { ); } - loadStartForm(processId: string) { - this.formService - .getStartFormInstance(processId) - .subscribe( - form => { - this.formName = form.name; - this.form = this.parseForm(form); - this.formLoaded.emit(this.form); - }, - (error) => { - this.handleError(error); - } - ); - } - getFormDefinitionByFormId(formId: string) { this.formService .getFormDefinitionById(formId) diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-start-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-start-form.component.ts index 4a165f2c06..ae5cedbf9e 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-start-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-start-form.component.ts @@ -57,9 +57,15 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView @Input() processDefinitionId: string; + @Input() + processId: string; + @Input() showOutcomeButtons: boolean = false; + @Input() + showRefreshButton: boolean = true; + @ViewChild('outcomesContainer', {}) outcomesContainer: ElementRef = null; @@ -70,7 +76,11 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView } ngOnInit() { - this.loadForm(); + if (this.processId) { + this.loadStartForm(this.processId); + }else { + this.loadForm(); + } if (this.translate) { this.translate.addTranslationFolder('node_modules/ng2-activiti-form/src'); @@ -78,9 +88,15 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView } ngOnChanges(changes: SimpleChanges) { - let processId = changes['processDefinitionId']; - if (processId && processId.currentValue) { - this.getStartFormDefinition(processId.currentValue); + let processDefinitionId = changes['processDefinitionId']; + if (processDefinitionId && processDefinitionId.currentValue) { + this.getStartFormDefinition(processDefinitionId.currentValue); + return; + } + + let processId = changes['processId']; + if (processId && processId.currentValue) { + this.loadStartForm(processId.currentValue); return; } } @@ -92,6 +108,23 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView } } + loadStartForm(processId: string) { + this.formService + .getStartFormInstance(processId) + .subscribe( + form => { + this.formName = form.name; + form.processDefinitionId = this.processDefinitionId; + this.form = this.parseForm(form); + // this.form.processDefinitionId = this.processDefinitionId; + this.formLoaded.emit(this.form); + }, + (error) => { + this.handleError(error); + } + ); + } + getStartFormDefinition(processId: string) { this.formService .getStartFormDefinition(processId) diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts b/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts index 821e383f28..003b2cfc62 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts +++ b/ng2-components/ng2-activiti-form/src/components/widgets/core/form.model.ts @@ -34,7 +34,7 @@ export class FormModel { readonly name: string; readonly taskId: string; readonly taskName: string = FormModel.UNSET_TASK_NAME; - readonly processDefinitionId: string; + processDefinitionId: string; private _isValid: boolean = true; get isValid(): boolean { diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.html b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.html index 143dff4835..fa5991dfe1 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.html +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.html @@ -38,7 +38,8 @@ assignment {{ 'DETAILS.LABELS.START_FORM'|translate }} - + {{ 'DETAILS.LABELS.TASK_SUBTITLE' | translate:{user: + getUserFullName(processInstanceDetails.startedBy), created: getFormatDate(processInstanceDetails.started, 'mediumDate') } }} @@ -80,9 +81,9 @@ {{ 'DETAILS.LABELS.START_FORM'|translate }} - - + + {{ 'DETAILS.TASKS.TASK_CLOSE' | translate }}