Added services view

This commit is contained in:
Frédéric Vachon 2015-02-06 15:43:36 -05:00
parent d843ce4835
commit 76e301f938
7 changed files with 52 additions and 5 deletions

View File

@ -7,6 +7,7 @@ angular.element(document).ready(function () {
angular.module('adagios.config').config(['readConfigProvider', function (readConfigProvider) { angular.module('adagios.config').config(['readConfigProvider', function (readConfigProvider) {
readConfigProvider.setDashboardConfig(data.dashboardConfig); readConfigProvider.setDashboardConfig(data.dashboardConfig);
readConfigProvider.setHostsConfig(data.hostsConfig); readConfigProvider.setHostsConfig(data.hostsConfig);
readConfigProvider.setServicesConfig(data.servicesConfig);
}]); }]);
angular.bootstrap(document, ['adagios']); angular.bootstrap(document, ['adagios']);
@ -22,7 +23,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) {

View File

@ -1,9 +1,10 @@
'use strict'; 'use strict';
function AdagiosConfig(dashboardConfig, hostsConfig) { function AdagiosConfig(dashboardConfig, hostsConfig, servicesConfig) {
this.dashboardConfig = dashboardConfig; this.dashboardConfig = dashboardConfig;
this.hostsConfig = hostsConfig; this.hostsConfig = hostsConfig;
this.servicesConfig = servicesConfig;
} }
angular.module('adagios.config', []) angular.module('adagios.config', [])
@ -11,7 +12,8 @@ angular.module('adagios.config', [])
.provider('readConfig', function ReadConfigProvider() { .provider('readConfig', function ReadConfigProvider() {
var dashboardConfig = {}, var dashboardConfig = {},
hostsConfig = {}; hostsConfig = {},
servicesConfig = {};
this.setDashboardConfig = function (value) { this.setDashboardConfig = function (value) {
dashboardConfig = value; dashboardConfig = value;
@ -21,7 +23,11 @@ angular.module('adagios.config', [])
hostsConfig = value; hostsConfig = value;
}; };
this.setServicesConfig = function (value) {
servicesConfig = value;
};
this.$get = [function getConfigFactory() { this.$get = [function getConfigFactory() {
return new AdagiosConfig(dashboardConfig, hostsConfig); return new AdagiosConfig(dashboardConfig, hostsConfig, servicesConfig);
}]; }];
}); });

View File

@ -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": {}
} }
} }

View File

@ -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>

View File

@ -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">

View 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
View 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.servicesConfig.cells;
servicesConfig.apiName = readConfig.servicesConfig.apiName;
servicesConfig.filters = readConfig.servicesConfig.filters;
}]);