mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -58,7 +58,7 @@
|
|||||||
<div class="mdl-grid">
|
<div class="mdl-grid">
|
||||||
<div class="mdl-cell mdl-cell--2-col task-column">
|
<div class="mdl-cell mdl-cell--2-col task-column">
|
||||||
<span>Process Filters</span>
|
<span>Process Filters</span>
|
||||||
<activiti-start-process-instance [appId]="appId"></activiti-start-process-instance>
|
<activiti-start-process-instance [appId]="appId" (start)="onStartProcessInstance($event)"></activiti-start-process-instance>
|
||||||
<activiti-process-instance-filters [appId]="appId"
|
<activiti-process-instance-filters [appId]="appId"
|
||||||
(filterClick)="onProcessFilterClick($event)" (onSuccess)="onSuccessProcessFilterList($event)"
|
(filterClick)="onProcessFilterClick($event)" (onSuccess)="onSuccessProcessFilterList($event)"
|
||||||
#activitiprocessfilter></activiti-process-instance-filters>
|
#activitiprocessfilter></activiti-process-instance-filters>
|
||||||
|
@@ -22,6 +22,7 @@ import {
|
|||||||
ActivitiApps,
|
ActivitiApps,
|
||||||
ActivitiTaskList
|
ActivitiTaskList
|
||||||
} from 'ng2-activiti-tasklist';
|
} from 'ng2-activiti-tasklist';
|
||||||
|
import { ActivitiProcessInstanceListComponent } from 'ng2-activiti-processlist';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs/Rx';
|
import { Subscription } from 'rxjs/Rx';
|
||||||
import {
|
import {
|
||||||
@@ -49,14 +50,14 @@ export class ActivitiDemoComponent implements AfterViewChecked {
|
|||||||
@ViewChild('activitidetails')
|
@ViewChild('activitidetails')
|
||||||
activitidetails: any;
|
activitidetails: any;
|
||||||
|
|
||||||
@ViewChild('activititasklist')
|
@ViewChild(ActivitiTaskList)
|
||||||
activititasklist: ActivitiTaskList;
|
activititasklist: ActivitiTaskList;
|
||||||
|
|
||||||
@ViewChild('activitiprocessfilter')
|
@ViewChild('activitiprocessfilter')
|
||||||
activitiprocessfilter: any;
|
activitiprocessfilter: any;
|
||||||
|
|
||||||
@ViewChild('activitiprocesslist')
|
@ViewChild(ActivitiProcessInstanceListComponent)
|
||||||
activitiprocesslist: any;
|
activitiprocesslist: ActivitiProcessInstanceListComponent;
|
||||||
|
|
||||||
@ViewChild('activitiprocessdetails')
|
@ViewChild('activitiprocessdetails')
|
||||||
activitiprocessdetails: any;
|
activitiprocessdetails: any;
|
||||||
@@ -176,6 +177,10 @@ export class ActivitiDemoComponent implements AfterViewChecked {
|
|||||||
this.currentProcessInstanceId = processInstanceId;
|
this.currentProcessInstanceId = processInstanceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onStartProcessInstance() {
|
||||||
|
this.activitiprocesslist.reload();
|
||||||
|
}
|
||||||
|
|
||||||
processCancelled(data: any) {
|
processCancelled(data: any) {
|
||||||
this.currentProcessInstanceId = null;
|
this.currentProcessInstanceId = null;
|
||||||
this.activitiprocesslist.reload();
|
this.activitiprocesslist.reload();
|
||||||
|
@@ -111,6 +111,13 @@ export class ActivitiProcessInstanceListComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public reload() {
|
||||||
|
if (this.filter) {
|
||||||
|
let requestNode = this.convertProcessInstanceToTaskQuery(this.filter);
|
||||||
|
this.load(requestNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an array of ObjectDataRow
|
* Create an array of ObjectDataRow
|
||||||
* @param processes
|
* @param processes
|
||||||
|
@@ -37,6 +37,11 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
let startProcessSpy: jasmine.Spy;
|
let startProcessSpy: jasmine.Spy;
|
||||||
let debugElement: DebugElement;
|
let debugElement: DebugElement;
|
||||||
|
|
||||||
|
let newProcess = {
|
||||||
|
id: '32323',
|
||||||
|
name: 'Process'
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [ CoreModule, ActivitiFormModule ],
|
imports: [ CoreModule, ActivitiFormModule ],
|
||||||
@@ -66,10 +71,7 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
id: 'my:process2',
|
id: 'my:process2',
|
||||||
name: 'My Process 2'
|
name: 'My Process 2'
|
||||||
}]));
|
}]));
|
||||||
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(Observable.of({
|
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(Observable.of(newProcess));
|
||||||
id: '32323',
|
|
||||||
name: 'Process'
|
|
||||||
}));
|
|
||||||
|
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||||
'upgradeAllRegistered',
|
'upgradeAllRegistered',
|
||||||
@@ -128,6 +130,19 @@ describe('ActivitiStartProcessButton', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should output start event when process started successfully', (done) => {
|
||||||
|
let emitSpy = spyOn(component.start, 'emit');
|
||||||
|
component.name = 'My new process';
|
||||||
|
component.processDefinitionId = 'my:process1';
|
||||||
|
component.showDialog();
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.startProcess();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(emitSpy).toHaveBeenCalledWith(newProcess);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should indicate start form is missing when process does not have a start form', (done) => {
|
it('should indicate start form is missing when process does not have a start form', (done) => {
|
||||||
component.name = 'My new process';
|
component.name = 'My new process';
|
||||||
component.processDefinitionId = 'my:process1';
|
component.processDefinitionId = 'my:process1';
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnInit, ViewChild, DebugElement, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, Output, OnInit, ViewChild, DebugElement, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslationService } from 'ng2-alfresco-core';
|
||||||
import { ActivitiStartForm } from 'ng2-activiti-form';
|
import { ActivitiStartForm } from 'ng2-activiti-form';
|
||||||
import { ActivitiProcessService } from './../services/activiti-process.service';
|
import { ActivitiProcessService } from './../services/activiti-process.service';
|
||||||
@@ -34,6 +34,9 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
|
|||||||
@Input()
|
@Input()
|
||||||
appId: string;
|
appId: string;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
start: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
@ViewChild('dialog')
|
@ViewChild('dialog')
|
||||||
dialog: DebugElement;
|
dialog: DebugElement;
|
||||||
|
|
||||||
@@ -54,18 +57,18 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.load(this.appId);
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
let appId = changes['appId'];
|
let appId = changes['appId'];
|
||||||
if (appId && (appId.currentValue || appId.currentValue === null)) {
|
if (appId && (appId.currentValue || appId.currentValue === null)) {
|
||||||
this.load(appId.currentValue);
|
this.load();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public load(appId: string) {
|
public load() {
|
||||||
this.activitiProcess.getProcessDefinitions(this.appId).subscribe(
|
this.activitiProcess.getProcessDefinitions(this.appId).subscribe(
|
||||||
(res: any[]) => {
|
(res: any[]) => {
|
||||||
this.processDefinitions = res;
|
this.processDefinitions = res;
|
||||||
@@ -90,6 +93,7 @@ export class ActivitiStartProcessButton implements OnInit, OnChanges {
|
|||||||
(res: any) => {
|
(res: any) => {
|
||||||
this.name = '';
|
this.name = '';
|
||||||
this.processDefinitionId = '';
|
this.processDefinitionId = '';
|
||||||
|
this.start.emit(res);
|
||||||
this.cancel();
|
this.cancel();
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
Reference in New Issue
Block a user