mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Dev mromano improveprocess (#1334)
* fix overload activiti * fix reload tasklist * fix process variables * fix default filter * improve process list * fix tests process * fix tests * Fix test for form * fix tests * fix tests * #fix activiti bug * #fix activiti bug (reverted from commit c966395ed1087e1dedaf0af0923a89ba99d6ab9f) * fix tests * #fix header test bug * fix tests * fix process * fix tests
This commit is contained in:
@@ -13,3 +13,7 @@
|
||||
.mdl-tooltip {
|
||||
will-change: unset;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@@ -13,3 +13,7 @@
|
||||
.mdl-tooltip {
|
||||
will-change: unset;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@@ -48,6 +48,9 @@ describe('ActivitiFilters', () => {
|
||||
|
||||
it('should return the filter task list', (done) => {
|
||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||
const appId = '1';
|
||||
let change = new SimpleChange(null, appId);
|
||||
filterList.ngOnChanges({ 'appId': change });
|
||||
|
||||
filterList.onSuccess.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -70,7 +73,8 @@ describe('ActivitiFilters', () => {
|
||||
spyOn(filterList.activiti, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeDeployedApplicationsPromise));
|
||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
|
||||
|
||||
filterList.appName = 'test';
|
||||
let change = new SimpleChange(null, 'test');
|
||||
filterList.ngOnChanges({ 'appName': change });
|
||||
|
||||
filterList.onSuccess.subscribe((res) => {
|
||||
let deployApp: any = filterList.activiti.getDeployedApplications;
|
||||
@@ -83,9 +87,12 @@ describe('ActivitiFilters', () => {
|
||||
});
|
||||
|
||||
it('should emit an error with a bad response', (done) => {
|
||||
filterList.appId = '1';
|
||||
spyOn(filterList.activiti, 'getTaskListFilters').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
||||
|
||||
const appId = '1';
|
||||
let change = new SimpleChange(null, appId);
|
||||
filterList.ngOnChanges({ 'appId': change });
|
||||
|
||||
filterList.onError.subscribe((err) => {
|
||||
expect(err).toBeDefined();
|
||||
done();
|
||||
@@ -95,9 +102,12 @@ describe('ActivitiFilters', () => {
|
||||
});
|
||||
|
||||
it('should emit an error with a bad response', (done) => {
|
||||
filterList.appName = 'fake-app';
|
||||
spyOn(filterList.activiti, 'getDeployedApplications').and.returnValue(Observable.fromPromise(fakeErrorFilterPromise));
|
||||
|
||||
const appId = 'fake-app';
|
||||
let change = new SimpleChange(null, appId);
|
||||
filterList.ngOnChanges({ 'appName': change });
|
||||
|
||||
filterList.onError.subscribe((err) => {
|
||||
expect(err).toBeDefined();
|
||||
done();
|
||||
@@ -156,4 +166,12 @@ describe('ActivitiFilters', () => {
|
||||
expect(filterList.getCurrentFilter()).toBe(filter);
|
||||
});
|
||||
|
||||
it('should load Default list when no appid or taskid are provided', () => {
|
||||
spyOn(filterList, 'getFiltersByAppId').and.stub();
|
||||
|
||||
let change = new SimpleChange(null, null);
|
||||
filterList.ngOnChanges({ 'appName': change });
|
||||
|
||||
expect(filterList.getFiltersByAppId).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -75,8 +75,6 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
||||
this.filter$.subscribe((filter: FilterRepresentationModel) => {
|
||||
this.filters.push(filter);
|
||||
});
|
||||
|
||||
this.getFilters(this.appId, this.appName);
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
@@ -86,10 +84,12 @@ export class ActivitiFilters implements OnInit, OnChanges {
|
||||
return;
|
||||
}
|
||||
let appName = changes['appName'];
|
||||
if (appName && appName.currentValue) {
|
||||
if (appName && appName !== null && appName.currentValue) {
|
||||
this.getFiltersByAppName(appName.currentValue);
|
||||
return;
|
||||
}
|
||||
|
||||
this.getFiltersByAppId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,3 +17,7 @@
|
||||
.mdl-tooltip {
|
||||
will-change: unset;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@@ -3,9 +3,13 @@
|
||||
}
|
||||
|
||||
.activiti-task-header__label {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.activiti-task-header__value {
|
||||
color: rgb(68,138,255);
|
||||
color: rgb(68, 138, 255);
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ describe('ActivitiTaskList', () => {
|
||||
ActivitiTaskList
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
||||
{provide: AlfrescoTranslationService, useClass: TranslationMock},
|
||||
ActivitiTaskListService
|
||||
]
|
||||
}).compileComponents();
|
||||
@@ -115,10 +115,12 @@ describe('ActivitiTaskList', () => {
|
||||
it('should return the filtered task list when the input parameters are passed', (done) => {
|
||||
spyOn(component.activiti, 'getTotalTasks').and.returnValue(Observable.of(fakeGlobalTotalTasks));
|
||||
spyOn(component.activiti, 'getTasks').and.returnValue(Observable.of(fakeGlobalTask));
|
||||
component.state = 'open';
|
||||
component.processDefinitionKey = null;
|
||||
component.assignment = 'fake-assignee';
|
||||
component.onSuccess.subscribe( (res) => {
|
||||
|
||||
let state = new SimpleChange(null, 'open');
|
||||
let processDefinitionKey = new SimpleChange(null, null);
|
||||
let assignment = new SimpleChange(null, 'fake-assignee');
|
||||
|
||||
component.onSuccess.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.data).toBeDefined();
|
||||
expect(component.isListEmpty()).not.toBeTruthy();
|
||||
@@ -127,15 +129,19 @@ describe('ActivitiTaskList', () => {
|
||||
done();
|
||||
});
|
||||
component.ngOnInit();
|
||||
component.ngOnChanges({'state': state, 'processDefinitionKey': processDefinitionKey, 'assignment': assignment});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should return the filtered task list by processDefinitionKey', (done) => {
|
||||
spyOn(component.activiti, 'getTotalTasks').and.returnValue(Observable.of(fakeGlobalTotalTasks));
|
||||
spyOn(component.activiti, 'getTasks').and.returnValue(Observable.of(fakeGlobalTask));
|
||||
component.state = 'open';
|
||||
component.processDefinitionKey = 'fakeprocess';
|
||||
component.assignment = 'fake-assignee';
|
||||
component.onSuccess.subscribe( (res) => {
|
||||
|
||||
let state = new SimpleChange(null, 'open');
|
||||
let processDefinitionKey = new SimpleChange(null, 'fakeprocess');
|
||||
let assignment = new SimpleChange(null, 'fake-assignee');
|
||||
|
||||
component.onSuccess.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.data).toBeDefined();
|
||||
expect(component.isListEmpty()).not.toBeTruthy();
|
||||
@@ -143,7 +149,10 @@ describe('ActivitiTaskList', () => {
|
||||
expect(component.data.getRows()[0].getValue('name')).toEqual('No name');
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnInit();
|
||||
component.ngOnChanges({'state': state, 'processDefinitionKey': processDefinitionKey, 'assignment': assignment});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should return a currentId null when the taskList is empty', () => {
|
||||
@@ -153,15 +162,19 @@ describe('ActivitiTaskList', () => {
|
||||
|
||||
it('should throw an exception when the response is wrong', (done) => {
|
||||
spyOn(component.activiti, 'getTotalTasks').and.returnValue(Observable.throw(fakeErrorTaskList));
|
||||
component.state = 'open';
|
||||
component.assignment = 'fake-assignee';
|
||||
component.onError.subscribe( (err) => {
|
||||
|
||||
let state = new SimpleChange(null, 'open');
|
||||
let assignment = new SimpleChange(null, 'fake-assignee');
|
||||
|
||||
component.onError.subscribe((err) => {
|
||||
expect(err).toBeDefined();
|
||||
expect(err.error).toBe('wrong request');
|
||||
done();
|
||||
});
|
||||
|
||||
component.ngOnInit();
|
||||
component.ngOnChanges({'state': state, 'assignment': assignment});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should reload tasks when reload() is called', (done) => {
|
||||
@@ -170,7 +183,7 @@ describe('ActivitiTaskList', () => {
|
||||
component.state = 'open';
|
||||
component.assignment = 'fake-assignee';
|
||||
component.ngOnInit();
|
||||
component.onSuccess.subscribe( (res) => {
|
||||
component.onSuccess.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.data).toBeDefined();
|
||||
expect(component.isListEmpty()).not.toBeTruthy();
|
||||
@@ -220,7 +233,7 @@ describe('ActivitiTaskList', () => {
|
||||
const appId = '1';
|
||||
let change = new SimpleChange(null, appId);
|
||||
|
||||
component.onSuccess.subscribe( (res) => {
|
||||
component.onSuccess.subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(component.data).toBeDefined();
|
||||
expect(component.isListEmpty()).not.toBeTruthy();
|
||||
|
@@ -83,7 +83,6 @@ export class ActivitiTaskList implements OnInit, OnChanges {
|
||||
if (!this.data) {
|
||||
this.data = this.initDefaultSchemaColumns();
|
||||
}
|
||||
this.reload();
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
|
Reference in New Issue
Block a user