mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Merge pull request #991 from Alfresco/dev-mvitale-791-fix
Fix process definition api
This commit is contained in:
commit
db1c205bba
@ -69,6 +69,29 @@ export var reportDefParamProcessDef = {
|
|||||||
'definition': '{ "parameters" :[{"id":"processDefinitionId","name":null,"nameKey":null,"type":"processDefinition","value":null,"dependsOn":null}]}'
|
'definition': '{ "parameters" :[{"id":"processDefinitionId","name":null,"nameKey":null,"type":"processDefinition","value":null,"dependsOn":null}]}'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export var reportDefParamProcessDefOptionsNoApp = [
|
||||||
|
{
|
||||||
|
'id': 'FakeProcessTest 1:1:1',
|
||||||
|
'name': 'Fake Process Test 1 Name ',
|
||||||
|
'version': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'FakeProcessTest 1:2:1',
|
||||||
|
'name': 'Fake Process Test 1 Name ',
|
||||||
|
'version': 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'FakeProcessTest 2:1:1',
|
||||||
|
'name': 'Fake Process Test 2 Name ',
|
||||||
|
'version': 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': 'FakeProcessTest 3:1:1',
|
||||||
|
'name': 'Fake Process Test 3 Name ',
|
||||||
|
'version': 1
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
export var reportDefParamProcessDefOptions = {
|
export var reportDefParamProcessDefOptions = {
|
||||||
'size': 4, 'total': 4, 'start': 0, 'data': [
|
'size': 4, 'total': 4, 'start': 0, 'data': [
|
||||||
{
|
{
|
||||||
|
@ -293,7 +293,7 @@ describe('Test ng2-analytics-report-parameters Report Parameters ', () => {
|
|||||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'json',
|
contentType: 'json',
|
||||||
responseText: analyticParamsMock.reportDefParamProcessDefOptions
|
responseText: analyticParamsMock.reportDefParamProcessDefOptionsNoApp
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public convertNumber(value: string): number {
|
public convertNumber(value: string): number {
|
||||||
return parseInt(value, 10);
|
return value != null ? parseInt(value, 10) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertFormValuesToReportParamQuery(values: any): ReportQuery {
|
convertFormValuesToReportParamQuery(values: any): ReportQuery {
|
||||||
|
@ -68,7 +68,11 @@ export class AnalyticsService {
|
|||||||
if (type === 'status') {
|
if (type === 'status') {
|
||||||
return this.getProcessStatusValues();
|
return this.getProcessStatusValues();
|
||||||
} else if (type === 'processDefinition') {
|
} else if (type === 'processDefinition') {
|
||||||
|
if (appId === null || appId === undefined) {
|
||||||
|
return this.getProcessDefinitionsValuesNoApp();
|
||||||
|
} else {
|
||||||
return this.getProcessDefinitionsValues(appId);
|
return this.getProcessDefinitionsValues(appId);
|
||||||
|
}
|
||||||
} else if (type === 'dateInterval') {
|
} else if (type === 'dateInterval') {
|
||||||
return this.getDateIntervalValues();
|
return this.getDateIntervalValues();
|
||||||
} else if (type === 'task') {
|
} else if (type === 'task') {
|
||||||
@ -122,13 +126,26 @@ export class AnalyticsService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getProcessDefinitionsValuesNoApp(): Observable<any> {
|
||||||
|
let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/reporting/process-definitions`;
|
||||||
|
let options = this.getRequestOptions();
|
||||||
|
return this.http
|
||||||
|
.get(url, options)
|
||||||
|
.map((res: any) => {
|
||||||
|
let paramOptions: ParameterValueModel[] = [];
|
||||||
|
let body = res.json();
|
||||||
|
body.forEach((opt) => {
|
||||||
|
paramOptions.push(new ParameterValueModel(opt));
|
||||||
|
});
|
||||||
|
return paramOptions;
|
||||||
|
}).catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
getProcessDefinitionsValues(appId: string): Observable<any> {
|
getProcessDefinitionsValues(appId: string): Observable<any> {
|
||||||
let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/process-definitions`;
|
let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/process-definitions`;
|
||||||
let params: URLSearchParams;
|
let params: URLSearchParams;
|
||||||
if (appId) {
|
|
||||||
params = new URLSearchParams();
|
params = new URLSearchParams();
|
||||||
params.set('appDefinitionId', appId);
|
params.set('appDefinitionId', appId);
|
||||||
}
|
|
||||||
let options = this.getRequestOptions(params);
|
let options = this.getRequestOptions(params);
|
||||||
return this.http
|
return this.http
|
||||||
.get(url, options)
|
.get(url, options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user