Create HeatMap Model

This commit is contained in:
mauriziovitale84
2016-10-17 16:41:27 +01:00
parent e20418ea4a
commit 12eb316fef
2 changed files with 30 additions and 14 deletions

View File

@@ -41,6 +41,9 @@ export class Chart {
case 'barChart': case 'barChart':
chartType = 'bar'; chartType = 'bar';
break; break;
case 'processDefinitionHeatMap':
chartType = 'HeatMap';
break;
default: default:
chartType = 'table'; chartType = 'table';
break; break;
@@ -132,23 +135,25 @@ export class TableChart extends Chart {
} }
export class HeatMapChart extends Chart { export class HeatMapChart extends Chart {
title: string; avgTimePercentages: string;
avgTimeValues: string;
processDefinitionId: string;
titleKey: string; titleKey: string;
labels: string[] = []; totalCountValues: string;
datasets: any[] = []; totalCountsPercentages: string;
totalTimePercentages: string;
totalTimeValues: string;
constructor(obj?: any) { constructor(obj?: any) {
super(obj); 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.titleKey = obj && obj.titleKey || null;
this.labels = obj && obj.columnNames; this.totalCountsPercentages = obj && obj.totalCountsPercentages || null;
if (obj.rows) { this.totalTimePercentages = obj && obj.totalTimePercentages || null;
this.datasets = obj && obj.rows; this.totalTimeValues = obj && obj.totalTimeValues || null;
}
}
hasDatasets() {
return this.datasets && this.datasets.length > 0 ? true : false;
} }
} }

View File

@@ -20,7 +20,7 @@ import { AlfrescoAuthenticationService, AlfrescoSettingsService } from 'ng2-alfr
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import { Response, Http, Headers, RequestOptions, URLSearchParams } from '@angular/http'; import { Response, Http, Headers, RequestOptions, URLSearchParams } from '@angular/http';
import { ReportParametersModel, ParameterValueModel } from '../models/report.model'; 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() @Injectable()
export class AnalyticsService { export class AnalyticsService {
@@ -129,6 +129,17 @@ export class AnalyticsService {
}).catch(this.handleError); }).catch(this.handleError);
} }
getProcessDefinitionModel(processDefinitionId: string): Observable<any> {
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<any> { getTasksByProcessDefinitionId(reportId: string, processDefinitionId: string): Observable<any> {
if (reportId && processDefinitionId) { if (reportId && processDefinitionId) {
let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/reporting/report-params/${reportId}/tasks`; let url = `${this.alfrescoSettingsService.getBPMApiBaseUrl()}/app/rest/reporting/report-params/${reportId}/tasks`;
@@ -171,7 +182,7 @@ export class AnalyticsService {
} else if (chartData.type === 'table') { } else if (chartData.type === 'table') {
elements.push(new TableChart(chartData)); elements.push(new TableChart(chartData));
} else if (chartData.type === 'processDefinitionHeatMap') { } else if (chartData.type === 'processDefinitionHeatMap') {
elements.push(new TableChart(chartData)); elements.push(new HeatMapChart(chartData));
} else if (chartData.type === 'masterDetailTable') { } else if (chartData.type === 'masterDetailTable') {
elements.push(new TableChart(chartData)); elements.push(new TableChart(chartData));
} else if (chartData.type === 'barChart') { } else if (chartData.type === 'barChart') {