Fix running process issue (#2391)

This commit is contained in:
Popovics András
2017-09-28 19:17:00 +01:00
committed by Eugenio Romano
parent e3ab50b4a1
commit e9766a6090
6 changed files with 40 additions and 7 deletions

View File

@@ -42,6 +42,7 @@
"@angular/forms": "4.3.6",
"@angular/http": "4.3.6",
"@angular/material": "2.0.0-beta.10",
"@angular/flex-layout": "2.0.0-beta.9",
"@angular/platform-browser": "4.3.6",
"@angular/platform-browser-dynamic": "4.3.6",
"@angular/router": "4.3.6",

View File

@@ -38,6 +38,11 @@ describe('ActivitiFilters', () => {
filter: { state: 'open', assignment: 'fake-assignee' }
}));
fakeGlobalFilter.push(new FilterProcessRepresentationModel({
name: 'Running',
filter: { state: 'open', assignment: 'fake-running' }
}));
let fakeGlobalFilterPromise = new Promise(function (resolve, reject) {
resolve(fakeGlobalFilter);
});
@@ -65,9 +70,27 @@ describe('ActivitiFilters', () => {
filterList.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
expect(filterList.filters).toBeDefined();
expect(filterList.filters.length).toEqual(2);
expect(filterList.filters.length).toEqual(3);
expect(filterList.filters[0].name).toEqual('FakeInvolvedTasks');
expect(filterList.filters[1].name).toEqual('FakeMyTasks');
expect(filterList.filters[2].name).toEqual('Running');
done();
});
filterList.ngOnInit();
});
it('should select the Running process filter', (done) => {
spyOn(activitiService, 'getProcessFilters').and.returnValue(Observable.fromPromise(fakeGlobalFilterPromise));
const appId = '1';
let change = new SimpleChange(null, appId, true);
filterList.ngOnChanges({ 'appId': change });
expect(filterList.currentFilter).toBeUndefined();
filterList.onSuccess.subscribe((res) => {
filterList.selectRunningFilter();
expect(filterList.currentFilter.name).toEqual('Running');
done();
});

View File

@@ -157,6 +157,13 @@ export class ProcessFiltersComponent implements OnInit, OnChanges {
}
}
/**
* Select the Running filter
*/
public selectRunningFilter() {
this.selectTaskFilter(this.activiti.getRunningFilterInstance(null));
}
/**
* Select as default task filter the first in the list
*/

View File

@@ -149,7 +149,7 @@ export class ProcessService extends TaskListService {
});
}
private getRunningFilterInstance(appId: string): FilterProcessRepresentationModel {
public getRunningFilterInstance(appId: string): FilterProcessRepresentationModel {
return new FilterProcessRepresentationModel({
'name': 'Running',
'appId': appId,

View File

@@ -7,7 +7,7 @@
"clean": "rimraf node_modules",
"clean-lock": "rimraf package-lock.json",
"rimraf": "rimraf",
"build": "npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.build.js --progress --profile --bail && npm run build-style",
"build": "npm run pkg-build && npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.build.js --progress --profile --bail && npm run build-style",
"test": "node node_modules/karma/bin/karma start --reporters mocha,coverage --single-run --component .",
"test-browser": "node node_modules/karma/bin/karma start karma.conf.js --reporters kjhtml",
"coverage": "",
@@ -17,6 +17,7 @@
"toc": "markdown-toc -i ng2-alfresco-core/README.md && markdown-toc -i ng2-alfresco-datatable/README.md && markdown-toc -i ng2-activiti-diagrams/README.md && markdown-toc -i ng2-activiti-analytics/README.md && markdown-toc -i ng2-activiti-form/README.md && markdown-toc -i ng2-activiti-tasklist/README.md && markdown-toc -i ng2-activiti-processlist/README.md && markdown-toc -i ng2-alfresco-documentlist/README.md && markdown-toc -i ng2-alfresco-login/README.md && markdown-toc -i ng2-alfresco-search/README.md && markdown-toc -i ng2-alfresco-tag/README.md && markdown-toc -i ng2-alfresco-upload/README.md && markdown-toc -i ng2-alfresco-viewer/README.md && markdown-toc -i ng2-alfresco-webscript/README.md && markdown-toc -i ng2-alfresco-webscript/README.md && markdown-toc -i ng2-alfresco-userinfo/README.md && markdown-toc -i ng2-alfresco-social/README.md && markdown-toc -i README.md",
"markdownlint": "markdownlint ng2-alfresco-core/README.md && markdownlint ng2-alfresco-datatable/README.md && markdownlint ng2-activiti-diagrams/README.md && markdownlint ng2-activiti-analytics/README.md && markdownlint ng2-activiti-form/README.md && markdownlint ng2-activiti-tasklist/README.md && markdownlint ng2-activiti-processlist/README.md && markdownlint ng2-alfresco-documentlist/README.md && markdownlint ng2-alfresco-login/README.md && markdownlint ng2-alfresco-search/README.md && markdownlint ng2-alfresco-tag/README.md && markdownlint ng2-alfresco-upload/README.md && markdownlint ng2-alfresco-viewer/README.md && markdownlint ng2-alfresco-webscript/README.md && markdownlint ng2-alfresco-webscript/README.md && markdownlint ng2-alfresco-userinfo/README.md && markdownlint ng2-alfresco-social/README.md && markdownlint README.md",
"doc": "npm run toc && npm run markdownlint && npm run webpack -- --config config/webpack.doc.js --progress --profile --bail",
"docindex": "node config/buildFullDocIndex.js",
"tslint": "",
"prepublish": "",
"tsc": "",
@@ -129,8 +130,6 @@
"karma-systemjs": "0.16.0",
"karma-webpack": "2.0.3",
"loader-utils": "1.1.0",
"markdown-toc": "1.1.0",
"markdownlint-cli": "^0.3.1",
"merge-stream": "1.0.1",
"node-sass": "4.5.3",
"null-loader": "0.1.1",
@@ -154,7 +153,9 @@
"webpack": "2.2.1",
"webpack-dev-server": "2.3.0",
"webpack-merge": "2.6.1",
"wsrv": "0.1.7"
"wsrv": "0.1.7",
"markdown-toc": "1.1.0",
"markdownlint-cli": "^0.3.1"
},
"license": "Apache-2.0",
"module": "./index.js",