Added custom tables support
This commit is contained in:
parent
81f7b4980d
commit
7fead8c0d9
@ -20,7 +20,8 @@ angular.module('adagios', [
|
|||||||
'adagios.config',
|
'adagios.config',
|
||||||
'adagios.view.dashboard',
|
'adagios.view.dashboard',
|
||||||
'adagios.view.hosts',
|
'adagios.view.hosts',
|
||||||
'adagios.view.services'
|
'adagios.view.services',
|
||||||
|
'adagios.view.custom'
|
||||||
])
|
])
|
||||||
|
|
||||||
.config(['$routeProvider', function ($routeProvider) {
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
@ -13,5 +13,17 @@
|
|||||||
"cells": ["host", "service_check", "duration", "last_check"],
|
"cells": ["host", "service_check", "duration", "last_check"],
|
||||||
"apiName": "services",
|
"apiName": "services",
|
||||||
"filters": {}
|
"filters": {}
|
||||||
}
|
},
|
||||||
|
"customViewsConfig": {
|
||||||
|
"customView1": {
|
||||||
|
"cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"],
|
||||||
|
"apiName": "hosts",
|
||||||
|
"filters": {}
|
||||||
|
},
|
||||||
|
"customView2": {
|
||||||
|
"cells": ["host", "service_check", "duration", "last_check"],
|
||||||
|
"apiName": "services",
|
||||||
|
"filters": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
7
app/custom_views/custom_views.html
Normal file
7
app/custom_views/custom_views.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<div ng-controller="CustomViewsCtrl" id="tactical">
|
||||||
|
|
||||||
|
<h2>Custom View</h2>
|
||||||
|
|
||||||
|
<adg-table cells="{{customViewCells}}" api-name="{{customViewApiName}}" filters="{{customViewFilters}}"></adg-table>
|
||||||
|
|
||||||
|
</div>
|
42
app/custom_views/custom_views.js
Normal file
42
app/custom_views/custom_views.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('adagios.view.custom', ['ngRoute',
|
||||||
|
'adagios.tactical.status_overview',
|
||||||
|
'adagios.tactical.current_health',
|
||||||
|
'adagios.tactical.top_alert_producers',
|
||||||
|
'adagios.table'
|
||||||
|
])
|
||||||
|
|
||||||
|
.value('customViewsConfig', {})
|
||||||
|
|
||||||
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
$routeProvider.when('/customViews', {
|
||||||
|
templateUrl: 'custom_views/custom_views.html',
|
||||||
|
controller: 'CustomViewsCtrl'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('CustomViewsCtrl', [ '$scope', '$routeParams', 'customViewsConfig',
|
||||||
|
function ($scope, $routeParams, customViewsConfig) {
|
||||||
|
var viewName = "";
|
||||||
|
|
||||||
|
if (!!$routeParams.view) {
|
||||||
|
viewName = $routeParams.view;
|
||||||
|
} else {
|
||||||
|
console.log("ERROR : 'view' GET parameter must be the custom view name");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.customViewCells = customViewsConfig[viewName].cells.join();
|
||||||
|
$scope.customViewApiName = customViewsConfig[viewName].apiName;
|
||||||
|
$scope.customViewFilters = customViewsConfig[viewName].filters;
|
||||||
|
}])
|
||||||
|
|
||||||
|
.run(['readConfig', 'customViewsConfig', function (readConfig, customViewsConfig) {
|
||||||
|
var viewsConfig = readConfig.data.customViewsConfig;
|
||||||
|
|
||||||
|
angular.forEach(viewsConfig, function(config, view) {
|
||||||
|
customViewsConfig[view] = config;
|
||||||
|
});
|
||||||
|
|
||||||
|
}]);
|
@ -55,6 +55,7 @@
|
|||||||
<script src="dashboard/dashboard.js"></script>
|
<script src="dashboard/dashboard.js"></script>
|
||||||
<script src="hosts/hosts.js"></script>
|
<script src="hosts/hosts.js"></script>
|
||||||
<script src="services/services.js"></script>
|
<script src="services/services.js"></script>
|
||||||
|
<script src="custom_views/custom_views.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="layout color-scheme--dark">
|
<body class="layout color-scheme--dark">
|
||||||
|
Loading…
Reference in New Issue
Block a user