New start-form component to display process start forms

Refs #730
This commit is contained in:
Will Abson
2016-10-31 09:56:16 +00:00
parent de1bac458b
commit a4cde396dd
8 changed files with 205 additions and 3 deletions

View File

@@ -15,8 +15,9 @@
* limitations under the License.
*/
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { Component, Input, OnInit, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
import { ActivitiStartForm } from 'ng2-activiti-form';
import { ActivitiProcessService } from './../services/activiti-process.service';
declare let componentHandler: any;
@@ -27,7 +28,7 @@ declare let componentHandler: any;
templateUrl: './activiti-start-process.component.html',
styleUrls: ['./activiti-start-process.component.css']
})
export class ActivitiStartProcessButton implements OnInit {
export class ActivitiStartProcessButton implements OnInit, OnChanges {
@Input()
appId: string;
@@ -35,6 +36,9 @@ export class ActivitiStartProcessButton implements OnInit {
@ViewChild('dialog')
dialog: any;
@ViewChild('startForm')
startForm: ActivitiStartForm;
processDefinitions: any[] = [];
name: string;
@@ -52,6 +56,10 @@ export class ActivitiStartProcessButton implements OnInit {
this.load(this.appId);
}
ngOnChanges(changes: SimpleChanges) {
console.log('changes', changes);
}
public load(appId: string) {
this.activitiProcess.getProcessDefinitions(this.appId).subscribe(
(res: any[]) => {
@@ -87,4 +95,31 @@ export class ActivitiStartProcessButton implements OnInit {
this.dialog.nativeElement.close();
}
}
hasFormKey() {
return true;
}
onFormSaved($event: Event) {
$event.preventDefault();
console.log('form saved');
}
onFormCompleted($event: Event) {
$event.preventDefault();
console.log('form saved');
}
onExecuteOutcome($event: Event) {
$event.preventDefault();
console.log('form outcome executed');
}
onFormLoaded($event: Event) {
console.log('form loaded', $event);
}
onFormError($event: Event) {
console.log('form error', $event);
}
}