mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Create HeatMap Model
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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<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> {
|
||||
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') {
|
||||
|
Reference in New Issue
Block a user