diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html index b58ef3af86..3bd65059d7 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -83,10 +83,11 @@
- - + (success)="onStartTaskSuccess($event)" + (cancel)="onCancelStartTask()"> +
@@ -158,7 +159,11 @@
- + +
diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts index 103c02e9ba..ff2db0c614 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -192,6 +192,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit { this.currentTaskId = event.id; } + onCancelStartTask() { + this.currentTaskId = null; + this.reloadTaskFilters(); + } + onSuccessTaskList(event: FilterRepresentationModel) { this.currentTaskId = this.taskList.getCurrentId(); } @@ -248,6 +253,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit { this.resetProcessFilters(); } + onCancelProcessInstance() { + this.currentProcessInstanceId = null; + this.reloadProcessFilters(); + } + isStartProcessMode(): boolean { return this.currentProcessInstanceId === currentProcessIdNew; } @@ -334,11 +344,11 @@ export class ActivitiDemoComponent implements AfterViewInit, OnDestroy, OnInit { } private reloadProcessFilters(): void { - this.activitiprocessfilter.selectFilter(null); + this.activitiprocessfilter.selectFilter(this.activitiprocessfilter.getCurrentFilter()); } private reloadTaskFilters(): void { - this.activitifilter.selectFilter(null); + this.activitifilter.selectFilter(this.activitifilter.getCurrentFilter()); } onRowClick(event): void { diff --git a/ng2-components/ng2-activiti-tasklist/README.md b/ng2-components/ng2-activiti-tasklist/README.md index 9577f1981c..453db9d74a 100644 --- a/ng2-components/ng2-activiti-tasklist/README.md +++ b/ng2-components/ng2-activiti-tasklist/README.md @@ -514,7 +514,7 @@ This component Creates/Starts new task for the specified app | Name | Description | | --- | --- | -| onSuccess | Raised when the task is successfully created | +| success | Raised when the task is successfully created | | cancel | Raised when the cancel button is pressed by the user | | error | Raised if there is an error during task creation | diff --git a/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.spec.ts b/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.spec.ts index 4942b93cf9..58b23835ad 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.spec.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.spec.ts @@ -133,7 +133,7 @@ describe('StartTaskComponent', () => { }); it('should create new task when start is clicked', async(() => { - activitiStartTaskComponent.onSuccess.subscribe((res) => { + activitiStartTaskComponent.success.subscribe((res) => { expect(res).toBeDefined(); }); activitiStartTaskComponent.appId = 'fakeAppId'; @@ -144,8 +144,8 @@ describe('StartTaskComponent', () => { }); })); - it('should send on onSuccess event when the task is started', async(() => { - activitiStartTaskComponent.onSuccess.subscribe((res) => { + it('should send on success event when the task is started', async(() => { + activitiStartTaskComponent.success.subscribe((res) => { expect(res).toBeDefined(); expect(res.id).toBe(91); expect(res.name).toBe('fakeName'); @@ -175,8 +175,8 @@ describe('StartTaskComponent', () => { }); })); - it('should send on onSuccess event when only name is given', async(() => { - activitiStartTaskComponent.onSuccess.subscribe((res) => { + it('should send on success event when only name is given', async(() => { + activitiStartTaskComponent.success.subscribe((res) => { expect(res).toBeDefined(); }); activitiStartTaskComponent.appId = 'fakeAppId'; @@ -191,7 +191,7 @@ describe('StartTaskComponent', () => { })); it('should attach a task when a form id selected', () => { - activitiStartTaskComponent.onSuccess.subscribe((res) => { + activitiStartTaskComponent.success.subscribe((res) => { expect(res).toBeDefined(); expect(res.formKey).toBe('4'); }); @@ -201,13 +201,13 @@ describe('StartTaskComponent', () => { expect(getcreateNewTaskSpy).toHaveBeenCalled(); }); - it('should not emit onSuccess event when data not present', async(() => { - let onSuccessSpy: jasmine.Spy = spyOn(activitiStartTaskComponent.onSuccess, 'emit'); + it('should not emit success event when data not present', async(() => { + let successSpy: jasmine.Spy = spyOn(activitiStartTaskComponent.success, 'emit'); activitiStartTaskComponent.startTaskmodel = new StartTaskModel(null); activitiStartTaskComponent.start(); fixture.detectChanges(); expect(getcreateNewTaskSpy).not.toHaveBeenCalled(); - expect(onSuccessSpy).not.toHaveBeenCalled(); + expect(successSpy).not.toHaveBeenCalled(); })); }); diff --git a/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.ts index fd863a63bf..3f7c41d93e 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/start-task.component.ts @@ -35,7 +35,7 @@ export class StartTaskComponent implements OnInit { appId: string; @Output() - onSuccess: EventEmitter = new EventEmitter(); + success: EventEmitter = new EventEmitter(); @Output() cancel: EventEmitter = new EventEmitter(); @@ -75,7 +75,7 @@ export class StartTaskComponent implements OnInit { this.startTaskmodel.category = this.appId; this.taskService.createNewTask(new TaskDetailsModel(this.startTaskmodel)).subscribe( (res: any) => { - this.onSuccess.emit(res); + this.success.emit(res); this.attachForm(res.id); this.resetForm(); },