diff --git a/app/app.js b/app/app.js index 53c8332..eff8a10 100644 --- a/app/app.js +++ b/app/app.js @@ -5,8 +5,7 @@ angular.element(document).ready(function () { $.get('components/config/config.json', function (data) { angular.module('adagios.config').config(['readConfigProvider', function (readConfigProvider) { - readConfigProvider.setDashboardConfig(data.dashboardConfig); - readConfigProvider.setHostsConfig(data.hostsConfig); + readConfigProvider.loadJSON(data); }]); angular.bootstrap(document, ['adagios']); @@ -22,7 +21,8 @@ angular.module('adagios', [ 'adagios.table', 'adagios.filters', 'adagios.config', - 'adagios.view.hosts' + 'adagios.view.hosts', + 'adagios.view.services' ]) .config(['$routeProvider', function ($routeProvider) { diff --git a/app/components/config/config.js b/app/components/config/config.js index b5a753f..e389051 100644 --- a/app/components/config/config.js +++ b/app/components/config/config.js @@ -1,27 +1,21 @@ 'use strict'; -function AdagiosConfig(dashboardConfig, hostsConfig) { - this.dashboardConfig = dashboardConfig; - this.hostsConfig = hostsConfig; +function AdagiosConfig(data) { + this.data = data; } angular.module('adagios.config', []) .provider('readConfig', function ReadConfigProvider() { - var dashboardConfig = {}, - hostsConfig = {}; + var data = {}; - this.setDashboardConfig = function (value) { - dashboardConfig = value; - }; - - this.setHostsConfig = function (value) { - hostsConfig = value; + this.loadJSON = function (value) { + data = value; }; this.$get = [function getConfigFactory() { - return new AdagiosConfig(dashboardConfig, hostsConfig); + return new AdagiosConfig(data); }]; }); diff --git a/app/components/config/config.json b/app/components/config/config.json index 54aa364..20c5595 100644 --- a/app/components/config/config.json +++ b/app/components/config/config.json @@ -8,5 +8,10 @@ "cells": ["hosts_host", "host_address", "duration", "last_check", "host_status"], "apiName": "hosts", "filters": {} + }, + "servicesConfig": { + "cells": ["host", "service_check", "duration", "last_check"], + "apiName": "services", + "filters": {} } } diff --git a/app/components/sidebar/sidebar.html b/app/components/sidebar/sidebar.html index c397797..6baebbb 100644 --- a/app/components/sidebar/sidebar.html +++ b/app/components/sidebar/sidebar.html @@ -8,7 +8,7 @@ diff --git a/app/dashboard/dashboard.js b/app/dashboard/dashboard.js index 834c5ec..e2b1764 100644 --- a/app/dashboard/dashboard.js +++ b/app/dashboard/dashboard.js @@ -23,7 +23,7 @@ angular.module('adagios.tactical', ['ngRoute', }]) .run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) { - dashboardConfig.cells = readConfig.dashboardConfig.cells; - dashboardConfig.apiName = readConfig.dashboardConfig.apiName; - dashboardConfig.filters = readConfig.dashboardConfig.filters; + dashboardConfig.cells = readConfig.data.dashboardConfig.cells; + dashboardConfig.apiName = readConfig.data.dashboardConfig.apiName; + dashboardConfig.filters = readConfig.data.dashboardConfig.filters; }]); diff --git a/app/hosts/hosts.js b/app/hosts/hosts.js index 4b9a616..07294ef 100644 --- a/app/hosts/hosts.js +++ b/app/hosts/hosts.js @@ -20,7 +20,7 @@ angular.module('adagios.view.hosts', ['ngRoute', }]) .run(['readConfig', 'hostsConfig', function (readConfig, hostsConfig) { - hostsConfig.cells = readConfig.hostsConfig.cells; - hostsConfig.apiName = readConfig.hostsConfig.apiName; - hostsConfig.filters = readConfig.hostsConfig.filters; + hostsConfig.cells = readConfig.data.hostsConfig.cells; + hostsConfig.apiName = readConfig.data.hostsConfig.apiName; + hostsConfig.filters = readConfig.data.hostsConfig.filters; }]); diff --git a/app/index.html b/app/index.html index fb38076..4735ec4 100644 --- a/app/index.html +++ b/app/index.html @@ -54,6 +54,7 @@ + diff --git a/app/services/services.html b/app/services/services.html new file mode 100644 index 0000000..5c1b734 --- /dev/null +++ b/app/services/services.html @@ -0,0 +1,7 @@ +
+ +

Services

+ + + +
diff --git a/app/services/services.js b/app/services/services.js new file mode 100644 index 0000000..33efb99 --- /dev/null +++ b/app/services/services.js @@ -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; + }]);