Merge pull request #18 from Freddrickk/dashboard
Add services view, modify dashboard and refactor config
This commit is contained in:
commit
b595bdb559
app
@ -5,8 +5,7 @@ angular.element(document).ready(function () {
|
|||||||
$.get('components/config/config.json', function (data) {
|
$.get('components/config/config.json', function (data) {
|
||||||
|
|
||||||
angular.module('adagios.config').config(['readConfigProvider', function (readConfigProvider) {
|
angular.module('adagios.config').config(['readConfigProvider', function (readConfigProvider) {
|
||||||
readConfigProvider.setDashboardConfig(data.dashboardConfig);
|
readConfigProvider.loadJSON(data);
|
||||||
readConfigProvider.setHostsConfig(data.hostsConfig);
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
angular.bootstrap(document, ['adagios']);
|
angular.bootstrap(document, ['adagios']);
|
||||||
@ -22,7 +21,8 @@ angular.module('adagios', [
|
|||||||
'adagios.table',
|
'adagios.table',
|
||||||
'adagios.filters',
|
'adagios.filters',
|
||||||
'adagios.config',
|
'adagios.config',
|
||||||
'adagios.view.hosts'
|
'adagios.view.hosts',
|
||||||
|
'adagios.view.services'
|
||||||
])
|
])
|
||||||
|
|
||||||
.config(['$routeProvider', function ($routeProvider) {
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
function AdagiosConfig(dashboardConfig, hostsConfig) {
|
function AdagiosConfig(data) {
|
||||||
this.dashboardConfig = dashboardConfig;
|
this.data = data;
|
||||||
this.hostsConfig = hostsConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
angular.module('adagios.config', [])
|
angular.module('adagios.config', [])
|
||||||
|
|
||||||
.provider('readConfig', function ReadConfigProvider() {
|
.provider('readConfig', function ReadConfigProvider() {
|
||||||
|
|
||||||
var dashboardConfig = {},
|
var data = {};
|
||||||
hostsConfig = {};
|
|
||||||
|
|
||||||
this.setDashboardConfig = function (value) {
|
this.loadJSON = function (value) {
|
||||||
dashboardConfig = value;
|
data = value;
|
||||||
};
|
|
||||||
|
|
||||||
this.setHostsConfig = function (value) {
|
|
||||||
hostsConfig = value;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$get = [function getConfigFactory() {
|
this.$get = [function getConfigFactory() {
|
||||||
return new AdagiosConfig(dashboardConfig, hostsConfig);
|
return new AdagiosConfig(data);
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
|
@ -8,5 +8,10 @@
|
|||||||
"cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"],
|
"cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"],
|
||||||
"apiName": "hosts",
|
"apiName": "hosts",
|
||||||
"filters": {}
|
"filters": {}
|
||||||
|
},
|
||||||
|
"servicesConfig": {
|
||||||
|
"cells": ["host", "service_check", "duration", "last_check"],
|
||||||
|
"apiName": "services",
|
||||||
|
"filters": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<ul class="sub-menu" id="shortcut">
|
<ul class="sub-menu" id="shortcut">
|
||||||
<li><a href="#/dashboard">Dashboard</a></li>
|
<li><a href="#/dashboard">Dashboard</a></li>
|
||||||
<li><a href="#/hosts">Hosts</a></li>
|
<li><a href="#/hosts">Hosts</a></li>
|
||||||
<li><a href="#">Services</a></li>
|
<li><a href="#/services">Services</a></li>
|
||||||
<li><a href="#">Networks parents</a></li>
|
<li><a href="#">Networks parents</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -23,7 +23,7 @@ angular.module('adagios.tactical', ['ngRoute',
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) {
|
.run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) {
|
||||||
dashboardConfig.cells = readConfig.dashboardConfig.cells;
|
dashboardConfig.cells = readConfig.data.dashboardConfig.cells;
|
||||||
dashboardConfig.apiName = readConfig.dashboardConfig.apiName;
|
dashboardConfig.apiName = readConfig.data.dashboardConfig.apiName;
|
||||||
dashboardConfig.filters = readConfig.dashboardConfig.filters;
|
dashboardConfig.filters = readConfig.data.dashboardConfig.filters;
|
||||||
}]);
|
}]);
|
||||||
|
@ -20,7 +20,7 @@ angular.module('adagios.view.hosts', ['ngRoute',
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['readConfig', 'hostsConfig', function (readConfig, hostsConfig) {
|
.run(['readConfig', 'hostsConfig', function (readConfig, hostsConfig) {
|
||||||
hostsConfig.cells = readConfig.hostsConfig.cells;
|
hostsConfig.cells = readConfig.data.hostsConfig.cells;
|
||||||
hostsConfig.apiName = readConfig.hostsConfig.apiName;
|
hostsConfig.apiName = readConfig.data.hostsConfig.apiName;
|
||||||
hostsConfig.filters = readConfig.hostsConfig.filters;
|
hostsConfig.filters = readConfig.data.hostsConfig.filters;
|
||||||
}]);
|
}]);
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
<!-- VIEWS -->
|
<!-- VIEWS -->
|
||||||
<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>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="layout color-scheme--dark">
|
<body class="layout color-scheme--dark">
|
||||||
|
7
app/services/services.html
Normal file
7
app/services/services.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<div ng-controller="ServicesCtrl" id="tactical" class="">
|
||||||
|
|
||||||
|
<h2>Services</h2>
|
||||||
|
|
||||||
|
<adg-table cells="{{servicesCells}}" api-name="{{servicesApiName}}" filters="{{servicesFilters}}"></adg-table>
|
||||||
|
|
||||||
|
</div>
|
26
app/services/services.js
Normal file
26
app/services/services.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('adagios.view.services', ['ngRoute',
|
||||||
|
'adagios.table'
|
||||||
|
])
|
||||||
|
|
||||||
|
.value('servicesConfig', {})
|
||||||
|
|
||||||
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
$routeProvider.when('/services', {
|
||||||
|
templateUrl: 'services/services.html',
|
||||||
|
controller: 'ServicesCtrl'
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.controller('ServicesCtrl', ['$scope', 'servicesConfig', function ($scope, servicesConfig) {
|
||||||
|
$scope.servicesCells = servicesConfig.cells.join();
|
||||||
|
$scope.servicesApiName = servicesConfig.apiName;
|
||||||
|
$scope.servicesFilters = servicesConfig.filters;
|
||||||
|
}])
|
||||||
|
|
||||||
|
.run(['readConfig', 'servicesConfig', function (readConfig, servicesConfig) {
|
||||||
|
servicesConfig.cells = readConfig.data.servicesConfig.cells;
|
||||||
|
servicesConfig.apiName = readConfig.data.servicesConfig.apiName;
|
||||||
|
servicesConfig.filters = readConfig.data.servicesConfig.filters;
|
||||||
|
}]);
|
Loading…
x
Reference in New Issue
Block a user