Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
feat: hits by host in the global dashboard analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
aelamrani authored and brasseld committed Mar 28, 2019
1 parent 6d7331b commit 1d26b3e
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/management/platform/dashboard/dashboard.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class DashboardController {
private AnalyticsService,
private ApiService,
private ApplicationService,
private $scope
private $scope,
private Constants
) {
'ngInject';
this.eventLabels = {};
Expand Down Expand Up @@ -194,6 +195,40 @@ class DashboardController {
}
}];

if (Constants.portal.dashboard && Constants.portal.dashboard.widgets) {
let initialDashboardLength = this.$scope.platformDashboard.length;
for (let i = 0; i < Constants.portal.dashboard.widgets.length; i++) {
let nbWidget = this.$scope.platformDashboard.length - initialDashboardLength;
let row = nbWidget > 2 ? 3 : 2;
let col = nbWidget > 2 ? (nbWidget - 3) * 2 : nbWidget * 2;
switch (Constants.portal.dashboard.widgets[i]) {
case 'host':
this.$scope.platformDashboard.push({
row: row,
col: col,
sizeY: 1,
sizeX: 2,
title: 'Hits by Host ',
subhead: 'Hits repartition by Host HTTP Header',
chart: {
type: 'table',
selectable: true,
columns: ['Host', 'Hits'],
paging: 5,
request: {
type: 'group_by',
field: 'host',
fieldLabel: 'host',
size: 20

}
}
});
break;
}
}
}

_.forEach(this.$scope.platformDashboard, (widget) => {
_.merge(widget, {
chart: {
Expand Down

0 comments on commit 1d26b3e

Please sign in to comment.