diff --git a/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts b/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts index 3f61139a4f..bba431596e 100644 --- a/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts +++ b/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts @@ -41,6 +41,9 @@ export class Chart { case 'barChart': chartType = 'bar'; break; + case 'processDefinitionHeatMap': + chartType = 'HeatMap'; + break; default: chartType = 'table'; break; @@ -132,23 +135,25 @@ export class TableChart extends Chart { } export class HeatMapChart extends Chart { - title: string; + avgTimePercentages: string; + avgTimeValues: string; + processDefinitionId: string; titleKey: string; - labels: string[] = []; - datasets: any[] = []; + totalCountValues: string; + totalCountsPercentages: string; + totalTimePercentages: string; + totalTimeValues: string; constructor(obj?: any) { super(obj); - this.title = obj && obj.title || null; + this.avgTimePercentages = obj && obj.avgTimePercentages || null; + this.avgTimeValues = obj && obj.avgTimeValues || null; + this.processDefinitionId = obj && obj.processDefinitionId || null; + this.totalCountValues = obj && obj.totalCountValues || null; this.titleKey = obj && obj.titleKey || null; - this.labels = obj && obj.columnNames; - if (obj.rows) { - this.datasets = obj && obj.rows; - } - } - - hasDatasets() { - return this.datasets && this.datasets.length > 0 ? true : false; + this.totalCountsPercentages = obj && obj.totalCountsPercentages || null; + this.totalTimePercentages = obj && obj.totalTimePercentages || null; + this.totalTimeValues = obj && obj.totalTimeValues || null; } } diff --git a/ng2-components/ng2-activiti-analytics/src/services/analytics.service.ts b/ng2-components/ng2-activiti-analytics/src/services/analytics.service.ts index 5025e14d6f..500336acc2 100644 --- a/ng2-components/ng2-activiti-analytics/src/services/analytics.service.ts +++ b/ng2-components/ng2-activiti-analytics/src/services/analytics.service.ts @@ -20,7 +20,7 @@ import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfr import { Observable } from 'rxjs/Rx'; import { Response, Http, Headers, RequestOptions, URLSearchParams } from '@angular/http'; import { ReportParametersModel, ParameterValueModel } from '../models/report.model'; -import { Chart, PieChart, TableChart, BarChart } from '../models/chart.model'; +import { Chart, PieChart, TableChart, BarChart, HeatMapChart } from '../models/chart.model'; @Injectable() export class AnalyticsService { @@ -129,6 +129,17 @@ export class AnalyticsService { }).catch(this.handleError); } + getProcessDefinitionModel(processDefinitionId: string): Observable { + let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/process-definitions/${processDefinitionId}/model-json`; + let options = this.getRequestOptions(); + return this.http + .get(url, options) + .map((res: any) => { + let body = res.json(); + return body; + }).catch(this.handleError); + } + getTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): Observable { if (reportId && processDefinitionId) { let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/reporting/report-params/${reportId}/tasks`; @@ -171,7 +182,7 @@ export class AnalyticsService { } else if (chartData.type === 'table') { elements.push(new TableChart(chartData)); } else if (chartData.type === 'processDefinitionHeatMap') { - elements.push(new TableChart(chartData)); + elements.push(new HeatMapChart(chartData)); } else if (chartData.type === 'masterDetailTable') { elements.push(new TableChart(chartData)); } else if (chartData.type === 'barChart') {