Improve application configuration
Change-Id: Ic689dee2b15ace091a4e61995d3c64641660b899
This commit is contained in:
parent
a97fb551c7
commit
c7c793b699
@ -53,6 +53,10 @@ module.exports = function (grunt) {
|
|||||||
src: '<%= project.app %>/components/config/config.json',
|
src: '<%= project.app %>/components/config/config.json',
|
||||||
dest: '<%= project.dist %>/components/config/config.json'
|
dest: '<%= project.dist %>/components/config/config.json'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
src: '<%= project.app %>/components/config/componentsConfig.json',
|
||||||
|
dest: '<%= project.dist %>/components/config/componentsConfig.json'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
src: '<%= project.app %>/components/config/developmentConfig.json',
|
src: '<%= project.app %>/components/config/developmentConfig.json',
|
||||||
dest: '<%= project.dist %>/components/config/developmentConfig.json'
|
dest: '<%= project.dist %>/components/config/developmentConfig.json'
|
||||||
|
12
app/app.js
12
app/app.js
@ -10,16 +10,18 @@ angular.module('bansho', [
|
|||||||
'bansho.topbar',
|
'bansho.topbar',
|
||||||
'bansho.sidebar',
|
'bansho.sidebar',
|
||||||
'bansho.surveil',
|
'bansho.surveil',
|
||||||
|
'bansho.datasource',
|
||||||
|
'bansho.directive',
|
||||||
'bansho.host',
|
'bansho.host',
|
||||||
'bansho.service',
|
'bansho.service',
|
||||||
'bansho.drupal',
|
'bansho.drupal',
|
||||||
'bansho.drupal.tile',
|
'bansho.drupal.tile',
|
||||||
'bansho.drupal.info',
|
'bansho.drupal.info',
|
||||||
'bansho.view',
|
'bansho.view',
|
||||||
'bansho.view.dashboard',
|
'bansho.view.page',
|
||||||
'bansho.view.singleTable',
|
|
||||||
'bansho.view.host',
|
'bansho.view.host',
|
||||||
'bansho.view.service',
|
'bansho.view.service',
|
||||||
|
'bansho.view.config',
|
||||||
'bansho.view.drupalDashboard',
|
'bansho.view.drupalDashboard',
|
||||||
'bansho.view.drupal',
|
'bansho.view.drupal',
|
||||||
'bansho.grafana'
|
'bansho.grafana'
|
||||||
@ -30,11 +32,13 @@ angular.module('bansho', [
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
// Reinitialise objects on url change
|
// Reinitialise objects on url change
|
||||||
.run(['$rootScope', 'promisesManager', 'reinitDrupalTiles', 'reinitDrupalInfo',
|
.run(['$rootScope', 'promisesManager', 'sharedData', 'reinitDrupalTiles', 'reinitDrupalInfo', 'componentsConfig',
|
||||||
function ($rootScope, promisesManager, reinitDrupalTiles, reinitDrupalInfo) {
|
function ($rootScope, promisesManager, sharedData, reinitDrupalTiles, reinitDrupalInfo, componentsConfig) {
|
||||||
|
componentsConfig.load();
|
||||||
$rootScope.$on('$locationChangeStart', function () {
|
$rootScope.$on('$locationChangeStart', function () {
|
||||||
reinitDrupalTiles();
|
reinitDrupalTiles();
|
||||||
reinitDrupalInfo();
|
reinitDrupalInfo();
|
||||||
promisesManager.clearAllPromises();
|
promisesManager.clearAllPromises();
|
||||||
|
sharedData.clear();
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
@import 'modules-interface/main';
|
@import 'modules-interface/main';
|
||||||
@import '../../components/topbar/topbar';
|
@import '../../components/topbar/topbar';
|
||||||
@import '../../components/sidebar/sidebar';
|
@import '../../components/sidebar/sidebar';
|
||||||
@import '../../components/tactical/tactical';
|
@import '../../components/directive/tactical/tactical';
|
||||||
|
|
||||||
//----------------------------------*\
|
//----------------------------------*\
|
||||||
// TEMPORARY MODULES
|
// TEMPORARY MODULES
|
||||||
|
@ -11,6 +11,7 @@ angular.module('bansho.authentication', [])
|
|||||||
|
|
||||||
.controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', 'themeManager', function ($scope, $rootScope, $location, authService, configManager, themeManager) {
|
.controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', 'themeManager', function ($scope, $rootScope, $location, authService, configManager, themeManager) {
|
||||||
themeManager.setTheme(themeManager.THEMES.DEFAULT);
|
themeManager.setTheme(themeManager.THEMES.DEFAULT);
|
||||||
|
$rootScope.isAuthenticated = false;
|
||||||
|
|
||||||
var login = function (credentials) {
|
var login = function (credentials) {
|
||||||
authService.login(credentials);
|
authService.login(credentials);
|
||||||
|
252
app/components/config/componentsConfig.json
Normal file
252
app/components/config/componentsConfig.json
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
{
|
||||||
|
"filters": {
|
||||||
|
"allHostOpenProblems": {
|
||||||
|
"name": "Open hosts problems",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"DOWN",
|
||||||
|
"UNREACHABLE"
|
||||||
|
],
|
||||||
|
"acknowledged": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allHostsProblems": {
|
||||||
|
"name": "Hosts problems",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hostOk": {
|
||||||
|
"name": "All Ok",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hostNotOk": {
|
||||||
|
"name": "All not Ok",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serviceOk": {
|
||||||
|
"name": "All Ok",
|
||||||
|
"filter": {
|
||||||
|
"services": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"serviceNotOk": {
|
||||||
|
"name": "All not Ok",
|
||||||
|
"filter": {
|
||||||
|
"services": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allAlert": {
|
||||||
|
"name": "All ALERT",
|
||||||
|
"filter": {
|
||||||
|
"events": {
|
||||||
|
"is": {
|
||||||
|
"event_type": [
|
||||||
|
"ALERT"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allNotification": {
|
||||||
|
"name": "All NOTIFICATION",
|
||||||
|
"filter": {
|
||||||
|
"events": {
|
||||||
|
"is": {
|
||||||
|
"event_type": [
|
||||||
|
"NOTIFICATION"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allOk": {
|
||||||
|
"name": "All OK",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allNotOk": {
|
||||||
|
"name": "All not OK",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allServices": {
|
||||||
|
"name": "All",
|
||||||
|
"filter": {
|
||||||
|
"hosts": {},
|
||||||
|
"services": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allServicesProblems": {
|
||||||
|
"name": "Open services problems",
|
||||||
|
"filter": {
|
||||||
|
"services": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allServiceOpenProblems": {
|
||||||
|
"name": "Open services problems",
|
||||||
|
"filter": {
|
||||||
|
"services": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is": {
|
||||||
|
"acknowledged": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allServiceOpenProblemsOnly": {
|
||||||
|
"name": "Open services problems",
|
||||||
|
"filter": {
|
||||||
|
"services": {
|
||||||
|
"isnot": {
|
||||||
|
"state": [
|
||||||
|
"OK"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"is": {
|
||||||
|
"acknowledged": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hosts": {
|
||||||
|
"is": {
|
||||||
|
"state": [
|
||||||
|
"UP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"all": {
|
||||||
|
"name": "All",
|
||||||
|
"filter": {
|
||||||
|
"services": {},
|
||||||
|
"hosts": {},
|
||||||
|
"events": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inputSource": {
|
||||||
|
"hostOpenProblems": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "hosts",
|
||||||
|
"filter": "allHostOpenProblems"
|
||||||
|
},
|
||||||
|
"serviceOpenProblems": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "services",
|
||||||
|
"filter": "allServiceOpenProblems"
|
||||||
|
},
|
||||||
|
"serviceOpenProblemsOnly": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "services",
|
||||||
|
"filter": "allServiceOpenProblemsOnly"
|
||||||
|
},
|
||||||
|
"hostsProblems": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "hosts",
|
||||||
|
"filter": "allHostsProblems"
|
||||||
|
},
|
||||||
|
"servicesProblems": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "services",
|
||||||
|
"filter": "allServicesProblems"
|
||||||
|
},
|
||||||
|
"events": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "events",
|
||||||
|
"filter": "all"
|
||||||
|
},
|
||||||
|
"hosts": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "hosts",
|
||||||
|
"filter": "all"
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"provider": "status",
|
||||||
|
"endpoint": "services",
|
||||||
|
"filter": "all"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -44,7 +44,50 @@ angular.module('bansho.config', [])
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.service('configManager', ['$http', '$q', function ($http, $q) {
|
.service('componentsConfig', ['$http', function($http) {
|
||||||
|
var componentsConfig;
|
||||||
|
|
||||||
|
this.getFilter = function (name) {
|
||||||
|
return componentsConfig.filters[name];
|
||||||
|
};
|
||||||
|
|
||||||
|
this.mergeFilters = function (filters) {
|
||||||
|
var filter = {};
|
||||||
|
|
||||||
|
angular.forEach(filters, function (f) {
|
||||||
|
angular.forEach(f, function (endpointFilter, endpoint) {
|
||||||
|
if (!filter[endpoint]) {
|
||||||
|
filter[endpoint] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
angular.forEach(endpointFilter, function (constraint, constraintType) {
|
||||||
|
if (!filter[endpoint][constraintType]) {
|
||||||
|
filter[endpoint][constraintType] = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
angular.forEach(constraint, function (value, key) {
|
||||||
|
filter[endpoint][constraintType][key] = value;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getInputSource = function (name) {
|
||||||
|
return componentsConfig.inputSource[name];
|
||||||
|
};
|
||||||
|
|
||||||
|
this.load = function () {
|
||||||
|
$http.get('components/config/componentsConfig.json')
|
||||||
|
.success(function(config) {
|
||||||
|
componentsConfig = config;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.service('configManager', ['$http', '$q', 'componentsConfig', function ($http, $q, componentsConfig) {
|
||||||
var config = {},
|
var config = {},
|
||||||
developmentConfig = {};
|
developmentConfig = {};
|
||||||
|
|
||||||
@ -112,10 +155,11 @@ angular.module('bansho.config', [])
|
|||||||
this.fetchConfig = function (useStoredConfig) {
|
this.fetchConfig = function (useStoredConfig) {
|
||||||
var responsePromise = $q.defer();
|
var responsePromise = $q.defer();
|
||||||
|
|
||||||
|
componentsConfig.load();
|
||||||
|
|
||||||
$http.get('surveil/v2/bansho/config')
|
$http.get('surveil/v2/bansho/config')
|
||||||
.success(function (conf) {
|
.success(function (conf) {
|
||||||
if (!useStoredConfig || jQuery.isEmptyObject(conf)) {
|
if (!useStoredConfig || jQuery.isEmptyObject(conf)) {
|
||||||
|
|
||||||
$http.get('components/config/config.json')
|
$http.get('components/config/config.json')
|
||||||
.success(function (conf) {
|
.success(function (conf) {
|
||||||
config.data = conf;
|
config.data = conf;
|
||||||
|
@ -3,46 +3,105 @@
|
|||||||
"theme": "dark"
|
"theme": "dark"
|
||||||
},
|
},
|
||||||
"dashboardConfig": {
|
"dashboardConfig": {
|
||||||
"title": "Unhandled service problems",
|
"template": "page",
|
||||||
"refreshInterval": 30,
|
"attributes": {
|
||||||
"template": "dashboard",
|
"refreshInterval": 30
|
||||||
|
},
|
||||||
"components": [
|
"components": [
|
||||||
{
|
|
||||||
"type": "actionbar",
|
|
||||||
"config": {
|
|
||||||
"components": [
|
|
||||||
"filter",
|
|
||||||
"acknowledge",
|
|
||||||
"downtime",
|
|
||||||
"recheck",
|
|
||||||
"more",
|
|
||||||
"search-filter"
|
|
||||||
],
|
|
||||||
"tableId": [
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"extra_components": [
|
|
||||||
{
|
{
|
||||||
"type": "tactical",
|
"type": "tactical",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Tactical Overview",
|
"title": "Tactical Overview",
|
||||||
"components": {
|
|
||||||
"statusOverview": true,
|
"statusOverview": true,
|
||||||
"currentHealth": true,
|
"currentHealth": true,
|
||||||
"topAlertProducers": false
|
"topAlertProducers": false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tabpanel",
|
||||||
|
"attributes": {
|
||||||
|
"navigation": [
|
||||||
|
{
|
||||||
|
"title": "Open Problems",
|
||||||
|
"panelId": "openProblems",
|
||||||
|
"provider": "nbServicesHostsOpenProblems"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "All Problems",
|
||||||
|
"panelId": "allProblems",
|
||||||
|
"provider": "nbServicesHostsOpenProblemsDoubleCount"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"attributes": {
|
||||||
|
"panelId": "openProblems"
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": [
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar-filter",
|
||||||
|
"attributes": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allOk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allNotOk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-acknowledge",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-downtime",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-recheck",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-more",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-search-filter",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "title",
|
||||||
|
"attributes": {
|
||||||
|
"title": "Open hosts problems",
|
||||||
|
"item": "host",
|
||||||
|
"provider": "nbHostsOpenProblems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Open Hosts problems",
|
"tableId": 0,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -60,32 +119,24 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": false,
|
"headerFollow": false,
|
||||||
"inputSource": {
|
"inputSource": "hostOpenProblems",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "hosts",
|
|
||||||
"filters": {
|
|
||||||
"is": {
|
|
||||||
"acknowledged": [
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"state": [
|
|
||||||
"DOWN",
|
|
||||||
"UNREACHABLE"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": false,
|
"isWrappable": false,
|
||||||
"checkColumn": true,
|
"checkColumn": true,
|
||||||
"noRepeatCell": ""
|
"noRepeatCell": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "title",
|
||||||
|
"attributes": {
|
||||||
|
"title": "Open Service Problems",
|
||||||
|
"item": "service",
|
||||||
|
"provider": "nbServicesOpenProblemsOnly"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Open Service problems",
|
"tableId": 1,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -101,44 +152,90 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": false,
|
"headerFollow": false,
|
||||||
"inputSource": {
|
"inputSource": "serviceOpenProblemsOnly",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "services",
|
|
||||||
"filters": {
|
|
||||||
"isnot": {
|
|
||||||
"state": [
|
|
||||||
"OK"
|
|
||||||
],
|
|
||||||
"host_state": [
|
|
||||||
"DOWN",
|
|
||||||
"UNREACHABLE"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"is": {
|
|
||||||
"acknowledged": [
|
|
||||||
false
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": true,
|
"isWrappable": true,
|
||||||
"checkColumn": true,
|
"checkColumn": true,
|
||||||
"noRepeatCell": "host"
|
"noRepeatCell": "host"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "panel",
|
||||||
"config": {
|
"attributes": {
|
||||||
|
"panelId": "allProblems",
|
||||||
|
"provider": "nbServicesHostsOpenProblems"
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": [
|
||||||
|
2,
|
||||||
|
3
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar-filter",
|
||||||
|
"attributes": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allOk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allNotOk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-acknowledge",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-downtime",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-recheck",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-more",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-search-filter",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "title",
|
||||||
|
"attributes": {
|
||||||
"title": "Hosts problems",
|
"title": "Hosts problems",
|
||||||
|
"item": "host",
|
||||||
|
"provider": "nbHostsOpenProblems"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "table",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": 2,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
"Address",
|
"Address",
|
||||||
"Duration",
|
"Duration",
|
||||||
"Last check",
|
"Lastcheck",
|
||||||
"Host status"
|
"Hoststatus"
|
||||||
],
|
],
|
||||||
"name": [
|
"name": [
|
||||||
"status_host",
|
"status_host",
|
||||||
@ -149,28 +246,24 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": false,
|
"headerFollow": false,
|
||||||
"inputSource": {
|
"inputSource": "hostsProblems",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "hosts",
|
|
||||||
"filters": {
|
|
||||||
"isnot": {
|
|
||||||
"state": [
|
|
||||||
"UP"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": false,
|
"isWrappable": false,
|
||||||
"checkColumn": true,
|
"checkColumn": true,
|
||||||
"noRepeatCell": ""
|
"noRepeatCell": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "title",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Services problems",
|
"title": "Services problems",
|
||||||
|
"item": "service",
|
||||||
|
"provider": "nbServicesOpenProblems"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "table",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": 3,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -186,50 +279,84 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": false,
|
"headerFollow": false,
|
||||||
"inputSource": {
|
"inputSource": "servicesProblems",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "services",
|
|
||||||
"filters": {
|
|
||||||
"isnot": {
|
|
||||||
"state": [
|
|
||||||
"OK"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": true,
|
"isWrappable": true,
|
||||||
"checkColumn": true,
|
"checkColumn": true,
|
||||||
"noRepeatCell": "host"
|
"noRepeatCell": "host"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"liveHosts": {
|
"liveHosts": {
|
||||||
"title": "Hosts",
|
"template": "page",
|
||||||
"refreshInterval": 30,
|
|
||||||
"template": "tables",
|
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "actionbar",
|
"type": "panel",
|
||||||
"config": {
|
|
||||||
"components": [
|
"components": [
|
||||||
"filter",
|
{
|
||||||
"acknowledge",
|
"type": "title",
|
||||||
"downtime",
|
"attributes": {
|
||||||
"recheck",
|
"title": "Hosts"
|
||||||
"more",
|
|
||||||
"search-filter"
|
|
||||||
],
|
|
||||||
"tableId": [0]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": [
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar-filter",
|
||||||
|
"attributes": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "hostOk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "hostNotOk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-acknowledge",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-downtime",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-recheck",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-more",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-search-filter",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Hosts",
|
|
||||||
"tableId": 0,
|
"tableId": 0,
|
||||||
|
"refreshInterval": 30,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -247,45 +374,82 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": true,
|
"headerFollow": true,
|
||||||
"inputSource": {
|
"inputSource": "hosts",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "hosts",
|
|
||||||
"filters": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": false,
|
"isWrappable": false,
|
||||||
"noRepeatCell": "",
|
"noRepeatCell": "",
|
||||||
"checkColumn": true,
|
"checkColumn": true
|
||||||
"containsActionBar": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"liveServices": {
|
"liveServices": {
|
||||||
"title": "Services",
|
"template": "page",
|
||||||
"refreshInterval": 30,
|
|
||||||
"template": "tables",
|
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "actionbar",
|
"type": "panel",
|
||||||
"config": {
|
|
||||||
"components": [
|
"components": [
|
||||||
"filter",
|
{
|
||||||
"acknowledge",
|
"type": "title",
|
||||||
"downtime",
|
"attributes": {
|
||||||
"recheck",
|
"title": "Services"
|
||||||
"more",
|
|
||||||
"search-filter"
|
|
||||||
],
|
|
||||||
"tableId": [0]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": [
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar-filter",
|
||||||
|
"attributes": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "serviceOk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "serviceNotOk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-acknowledge",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-downtime",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-recheck",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-more",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-search-filter",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Services",
|
|
||||||
"tableId": 0,
|
"tableId": 0,
|
||||||
|
"refreshInterval": 30,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Host",
|
"Host",
|
||||||
@ -300,48 +464,76 @@
|
|||||||
"status_last_check"
|
"status_last_check"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"inputSource": {
|
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "services",
|
|
||||||
"filters": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": false,
|
|
||||||
"noRepeatCell": "host",
|
|
||||||
"headerFollow": true,
|
"headerFollow": true,
|
||||||
"containsActionBar": true,
|
"inputSource": "services",
|
||||||
"checkColumn": true
|
"isWrappable": false,
|
||||||
|
"checkColumn": true,
|
||||||
|
"noRepeatCell": "host"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"liveEvents": {
|
"liveEvents": {
|
||||||
"title": "Events",
|
"template": "page",
|
||||||
"refreshInterval": 30,
|
|
||||||
"template": "tables",
|
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "actionbar",
|
"type": "panel",
|
||||||
"config": {
|
|
||||||
"components": [
|
"components": [
|
||||||
"filter",
|
{
|
||||||
"more",
|
"type": "title",
|
||||||
"search-filter"
|
"attributes": {
|
||||||
],
|
"title": "Events"
|
||||||
"tableId": [0]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar",
|
||||||
|
"attributes": {
|
||||||
|
"tableId": [
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "actionbar-filter",
|
||||||
|
"attributes": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allAlert"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "componentsConfig",
|
||||||
|
"content": "allNotification"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-more",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "actionbar-search-filter",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "table",
|
"type": "table",
|
||||||
"config": {
|
"attributes": {
|
||||||
"title": "Hosts",
|
"refreshInterval": 30,
|
||||||
"tableId": 0,
|
"tableId": 0,
|
||||||
"cells": {
|
"cells": {
|
||||||
"text": [
|
"text": [
|
||||||
"Event type",
|
"Event type",
|
||||||
"Output",
|
"Output",
|
||||||
"Host name",
|
"Hostname",
|
||||||
"Service",
|
"Service",
|
||||||
"Time",
|
"Time",
|
||||||
"Complete data"
|
"Complete data"
|
||||||
@ -356,30 +548,86 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"headerFollow": true,
|
"headerFollow": true,
|
||||||
"inputSource": {
|
"inputSource": "events",
|
||||||
"service": "surveilStatus",
|
|
||||||
"config": {
|
|
||||||
"apiName": "events",
|
|
||||||
"filters": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isWrappable": false,
|
"isWrappable": false,
|
||||||
"noRepeatCell": "",
|
|
||||||
"checkColumn": false,
|
"checkColumn": false,
|
||||||
"containsActionBar": false
|
"noRepeatCell": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"host": {
|
"host": {
|
||||||
"title": "Host",
|
"template": "host",
|
||||||
"refreshInterval": 30,
|
"components": [
|
||||||
"template": "host"
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "host",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "host-main",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "host-live",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "host-load",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "host-cpu",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "host-info",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "host-services-list",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"service": {
|
"service": {
|
||||||
"title": "Service",
|
"template": "service",
|
||||||
"refreshInterval": 30,
|
"components": [
|
||||||
"template": "service"
|
{
|
||||||
|
"type": "panel",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "service",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "service-main",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "service-live",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "service-info",
|
||||||
|
"attributes": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "service-graphs",
|
||||||
|
"attributes": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refreshInterval": 30
|
||||||
},
|
},
|
||||||
"drupal": {
|
"drupal": {
|
||||||
"title": "Drupal",
|
"title": "Drupal",
|
||||||
|
193
app/components/datasource/datasource.js
Normal file
193
app/components/datasource/datasource.js
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.datasource', ['bansho.surveil'])
|
||||||
|
.value('tableGlobalConfig', {'cellToFieldsMap': {}, 'cellWrappableField': {}})
|
||||||
|
|
||||||
|
.service('datasource', ['$filter', 'surveilStatus', 'surveilQuery', 'componentsConfig', 'tableGlobalConfig',
|
||||||
|
function ($filter, surveilStatus, surveilQuery, componentsConfig, tableGlobalConfig) {
|
||||||
|
var providerServices = {
|
||||||
|
status: surveilStatus
|
||||||
|
},
|
||||||
|
config = [],
|
||||||
|
data = [],
|
||||||
|
filteredData = [],
|
||||||
|
listeners = [];
|
||||||
|
|
||||||
|
function notifyDataChanged(tableId) {
|
||||||
|
angular.forEach(listeners[tableId], function (callback) {
|
||||||
|
callback(filteredData[tableId], config[tableId].isCheckAll);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterData(tableId) {
|
||||||
|
filteredData[tableId] = $filter('filter')(data[tableId], config[tableId].searchFilter);
|
||||||
|
notifyDataChanged(tableId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshTableData(tableId) {
|
||||||
|
var conf = config[tableId],
|
||||||
|
inputSource = componentsConfig.getInputSource(conf.inputSource),
|
||||||
|
filter = componentsConfig.getFilter(inputSource.filter).filter,
|
||||||
|
promise;
|
||||||
|
|
||||||
|
if (config[tableId].queryFilter) {
|
||||||
|
filter = componentsConfig.mergeFilters([config[tableId].queryFilter, filter]);
|
||||||
|
}
|
||||||
|
|
||||||
|
promise = providerServices[inputSource.provider].getData([], filter, inputSource.endpoint);
|
||||||
|
|
||||||
|
promise.then(function (newData) {
|
||||||
|
data[tableId] = newData;
|
||||||
|
config[tableId].isCheckAll = false;
|
||||||
|
filterData(tableId);
|
||||||
|
}, function (error) {
|
||||||
|
throw new Error('getTableData : Query failed' + error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
refreshTableData: refreshTableData,
|
||||||
|
addTable: function (tableId, conf) {
|
||||||
|
config[tableId] = conf;
|
||||||
|
config[tableId].requestFields = [];
|
||||||
|
angular.forEach(config[tableId].cells.name, function (cell) {
|
||||||
|
angular.forEach(tableGlobalConfig.cellToFieldsMap[cell], function (_value) {
|
||||||
|
config[tableId].requestFields.push(_value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getConfig: function (tableId) {
|
||||||
|
return config[tableId];
|
||||||
|
},
|
||||||
|
forEachCheckedEntry: function (tableId, callbackIsChecked) {
|
||||||
|
angular.forEach(filteredData[tableId], function (entry) {
|
||||||
|
if (entry.is_checked) {
|
||||||
|
callbackIsChecked(entry);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
notifyDataChanged(tableId);
|
||||||
|
},
|
||||||
|
registerDataChanged: function (tableId, callback) {
|
||||||
|
if (!listeners[tableId]) {
|
||||||
|
listeners[tableId] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
listeners[tableId].push(callback);
|
||||||
|
},
|
||||||
|
setAllCheckTable: function (tableId, isChecked) {
|
||||||
|
config[tableId].isCheckAll = isChecked;
|
||||||
|
angular.forEach(filteredData[tableId], function (entry) {
|
||||||
|
entry.is_checked = isChecked;
|
||||||
|
});
|
||||||
|
|
||||||
|
notifyDataChanged(tableId, isChecked);
|
||||||
|
},
|
||||||
|
setSearchFilter: function (tableId, searchFilter) {
|
||||||
|
config[tableId].searchFilter = searchFilter;
|
||||||
|
filterData(tableId);
|
||||||
|
|
||||||
|
notifyDataChanged(tableId);
|
||||||
|
},
|
||||||
|
setQueryFilter: function (tableId, queryFilter) {
|
||||||
|
config[tableId].queryFilter = queryFilter;
|
||||||
|
refreshTableData(tableId);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.service('sharedData', ['$interval', 'surveilStatus',
|
||||||
|
function ($interval, surveilStatus) {
|
||||||
|
var sharedData = {},
|
||||||
|
listeners = {},
|
||||||
|
providers = {
|
||||||
|
'nbHostsOpenProblems': function (key) {
|
||||||
|
surveilStatus.getNbHostOpenProblems().then(function (nbHostProblems) {
|
||||||
|
sharedData[key].value = nbHostProblems;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'nbServicesOpenProblems': function (key) {
|
||||||
|
surveilStatus.getNbServiceOpenProblems().then(function (nbServiceProblems) {
|
||||||
|
sharedData[key].value = nbServiceProblems;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'nbHosts': function (key) {
|
||||||
|
surveilStatus.getNbHosts().then(function (nbHosts) {
|
||||||
|
sharedData[key].value = nbHosts;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
'nbServices': function (key) {
|
||||||
|
surveilStatus.getNbServices().then(function (nbServices) {
|
||||||
|
sharedData[key].value = nbServices;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'nbServicesOpenProblemsOnly': function (key) {
|
||||||
|
surveilStatus.getNbServiceOpenProblemsOnly().then(function (nbServices) {
|
||||||
|
sharedData[key].value = nbServices;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'nbServicesHostsOpenProblems': function (key) {
|
||||||
|
surveilStatus.getNbHostsProblems().then(function (nbHosts) {
|
||||||
|
surveilStatus.getNbServiceOpenProblemsOnly().then(function (nbServices) {
|
||||||
|
sharedData[key].value = nbHosts + nbServices;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'nbServicesHostsOpenProblemsDoubleCount': function (key) {
|
||||||
|
surveilStatus.getNbHostsProblems().then(function (nbHosts) {
|
||||||
|
surveilStatus.getNbServiceOpenProblems().then(function (nbServices) {
|
||||||
|
sharedData[key].value = nbHosts + nbServices;
|
||||||
|
notifyListeners(key);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var notifyListeners = function (key) {
|
||||||
|
angular.forEach(listeners[key], function (onChange) {
|
||||||
|
onChange(sharedData[key].value);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
clear: function () {
|
||||||
|
angular.forEach(sharedData, function (provider) {
|
||||||
|
$interval.cancel(provider.promise);
|
||||||
|
});
|
||||||
|
sharedData = {};
|
||||||
|
listeners = {};
|
||||||
|
},
|
||||||
|
getData: function (key, interval, onChange) {
|
||||||
|
if (!sharedData[key]) {
|
||||||
|
sharedData[key] = {
|
||||||
|
interval: interval
|
||||||
|
};
|
||||||
|
|
||||||
|
listeners[key] = [
|
||||||
|
onChange
|
||||||
|
];
|
||||||
|
|
||||||
|
providers[key](key);
|
||||||
|
$interval(providers[key](key), interval);
|
||||||
|
} else {
|
||||||
|
listeners[key].push(onChange);
|
||||||
|
|
||||||
|
if (sharedData[key].interval >= interval) {
|
||||||
|
sharedData[key].interval = interval;
|
||||||
|
$interval.cancel(sharedData[key].promise);
|
||||||
|
sharedData[key].promise = $interval(providers[key](key), interval);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return sharedData[key].value;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}]);
|
@ -1,4 +1,5 @@
|
|||||||
<menu class="filters">
|
<menu class="filters">
|
||||||
<ul class="filters__list clearfix">
|
<ul class="filters__list clearfix">
|
||||||
|
<bansho-components components="components"></bansho-components>
|
||||||
</ul>
|
</ul>
|
||||||
</menu>
|
</menu>
|
22
app/components/directive/actionbar/actionbar.js
Normal file
22
app/components/directive/actionbar/actionbar.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar', ['bansho.datasource', 'bansho.surveil', 'bansho.notifications'])
|
||||||
|
.directive('banshoActionbar', ['$compile', function ($compile) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/actionbar/actionbar.html',
|
||||||
|
link: function (scope, element) {
|
||||||
|
scope.tableId = scope.options.attributes.tableId;
|
||||||
|
scope.components = scope.options.components;
|
||||||
|
|
||||||
|
angular.forEach(scope.components, function (component) {
|
||||||
|
component.attributes.tableId = scope.tableId;
|
||||||
|
});
|
||||||
|
|
||||||
|
$compile(element.contents())(scope);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}]);
|
@ -1,38 +1,32 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('bansho.table.actionbar')
|
angular.module('bansho.actionbar')
|
||||||
.directive('banshoActionbarAcknowledge', [function () {
|
.directive('banshoActionbarAcknowledge', [function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: 'components/table/actionbar/component_acknowledge/acknowledge.html',
|
templateUrl: 'components/directive/actionbar/component_acknowledge/acknowledge.html',
|
||||||
scope: {
|
scope: {
|
||||||
tableId: '='
|
options: '='
|
||||||
},
|
},
|
||||||
controller: ['$scope', 'tables', 'surveilActions', 'notifications',
|
controller: ['$scope', 'datasource', 'surveilActions', 'notifications',
|
||||||
function ($scope, tables, surveilActions, notifications) {
|
function ($scope, datasource, surveilActions, notifications) {
|
||||||
$scope.isAcknowledgeFormShown = false;
|
$scope.isAcknowledgeFormShown = false;
|
||||||
$scope.switchAcknowledgeFormShown = function () {
|
$scope.switchAcknowledgeFormShown = function () {
|
||||||
$scope.isAcknowledgeFormShown = !$scope.isAcknowledgeFormShown;
|
$scope.isAcknowledgeFormShown = !$scope.isAcknowledgeFormShown;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.acknowledgeProblems = function () {
|
$scope.acknowledgeProblems = function () {
|
||||||
angular.forEach($scope.tableId, function (tableId) {
|
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||||
tables.forEachCheckedEntry(tableId, function (entry) {
|
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||||
var service_description;
|
surveilActions.acknowledge(entry.host_host_name, entry.service_service_description, $scope.attrs).then(function (data) {
|
||||||
|
notifications.push('success', 'Acknowledgement', 'Acknowledged ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
if ('description' in entry) {
|
|
||||||
service_description = entry.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
surveilActions.acknowledge(entry.host_name, service_description, $scope.attrs).then(function (data) {
|
|
||||||
notifications.push('success', 'Acknowledgement', 'Acknowledged ' + entry.host_name);
|
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
notifications.push('error', 'Acknowledgement', 'Could not acknowledge ' + entry.host_name);
|
notifications.push('error', 'Acknowledgement', 'Could not acknowledge ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tables.setAllCheckTable(tableId, false);
|
datasource.setAllCheckTable(tableId, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.isAcknowledgeFormShown = false;
|
$scope.isAcknowledgeFormShown = false;
|
@ -0,0 +1,39 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar')
|
||||||
|
.directive('banshoActionbarDowntime', [function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/actionbar/component_downtime/downtime.html',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
controller: ['$scope', 'datasource', 'surveilActions', 'notifications',
|
||||||
|
function ($scope, datasource, surveilActions, notifications) {
|
||||||
|
$scope.tableId = $scope.options.attributes.tableId;
|
||||||
|
|
||||||
|
$scope.isDowntimeFormShown = false;
|
||||||
|
$scope.switchDowntimeFormShown = function () {
|
||||||
|
$scope.isDowntimeFormShown = !$scope.isDowntimeFormShown;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.sendDowntime = function () {
|
||||||
|
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||||
|
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||||
|
surveilActions.downtime(entry.host_host_name, entry.service_service_description, $scope.attrs).then(function (data) {
|
||||||
|
notifications.push('success', 'Downtime', 'Added downtime for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
notifications.push('error', 'Downtime', 'Could not add downtime for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
datasource.setAllCheckTable(tableId, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.isDowntimeFormShown = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}]);
|
@ -1,19 +1,19 @@
|
|||||||
<li class="filters__item filters__item--more clearfix">
|
<li class="filters__item filters__item--problems">
|
||||||
<button class="filters__button"
|
<button class="filters__button"
|
||||||
type="button"
|
type="button"
|
||||||
data-toggle="collapse"
|
|
||||||
data-target="#filtersProblems"
|
data-target="#filtersProblems"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-controls="filtersProblems">
|
aria-controls="filtersProblems"
|
||||||
<span>{{activeFilter.text}}</span>
|
data-ng-click="switchFilterFormShown()">
|
||||||
|
<span>{{activeFilter.name}}</span>
|
||||||
<i class="ico-down-dir"></i>
|
<i class="ico-down-dir"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="filters__panel collapse" id="filtersProblems">
|
<div class="filters__panel collapse" ng-class="{collapse: isShown}" id="filtersProblems">
|
||||||
<ul class="filters__sublist">
|
<ul class="filters__sublist">
|
||||||
<li class="filters__subitem" ng-repeat="actionbarFilter in possibleFilters" ng-click="activateFilter($index)">
|
<li class="filters__subitem" ng-repeat="actionbarFilter in filters" ng-click="activateFilter($index)">
|
||||||
<a class="filters__link state--current" ng-if="actionbarFilter === activeFilter">{{actionbarFilter.text}}</a>
|
<a class="filters__link state--current" ng-if="actionbarFilter === activeFilter">{{actionbarFilter.name}}</a>
|
||||||
<a class="filters__link" ng-if="actionbarFilter !== activeFilter">{{actionbarFilter.text}}</a>
|
<a class="filters__link" ng-if="actionbarFilter !== activeFilter">{{actionbarFilter.name}}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
@ -0,0 +1,49 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar')
|
||||||
|
.directive('banshoActionbarFilter', ['componentsConfig', function (componentsConfig) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/actionbar/component_filter/filter.html',
|
||||||
|
controller: ['$scope', 'datasource', function ($scope, datasource) {
|
||||||
|
$scope.tableId = $scope.options.attributes.tableId;
|
||||||
|
|
||||||
|
$scope.filters = [];
|
||||||
|
angular.forEach($scope.options.attributes.filters, function (filter) {
|
||||||
|
switch (filter.location) {
|
||||||
|
case 'inline':
|
||||||
|
$scope.filters.push(filter.content);
|
||||||
|
break;
|
||||||
|
case 'componentsConfig':
|
||||||
|
$scope.filters.push(
|
||||||
|
componentsConfig.getFilter(
|
||||||
|
filter.content
|
||||||
|
)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.isShown = false;
|
||||||
|
|
||||||
|
$scope.activeFilter = $scope.filters[0];
|
||||||
|
|
||||||
|
$scope.components = $scope.options.components;
|
||||||
|
$scope.switchFilterFormShown = function () {
|
||||||
|
$scope.isShown = !$scope.isShown;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.activateFilter = function (item) {
|
||||||
|
$scope.activeFilter = $scope.filters[item];
|
||||||
|
|
||||||
|
angular.forEach($scope.tableId, function (tableId) {
|
||||||
|
datasource.setQueryFilter(tableId, $scope.activeFilter.filter);
|
||||||
|
});
|
||||||
|
$scope.isShown = false;
|
||||||
|
};
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}]);
|
13
app/components/directive/actionbar/component_more/more.js
Normal file
13
app/components/directive/actionbar/component_more/more.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar')
|
||||||
|
.directive('banshoActionbarMore', [function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
'tableId': '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/actionbar/component_more/more.html',
|
||||||
|
controller: ['$scope', 'datasource', function ($scope, datasource) {}]
|
||||||
|
};
|
||||||
|
}]);
|
@ -0,0 +1,30 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar')
|
||||||
|
.directive('banshoActionbarRecheck', [function () {
|
||||||
|
return {
|
||||||
|
restrict: 'EA',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/actionbar/component_recheck/recheck.html',
|
||||||
|
controller: ['$scope', 'datasource', 'surveilActions', 'notifications',
|
||||||
|
function ($scope, datasource, surveilActions, notifications) {
|
||||||
|
$scope.sendRecheck = function () {
|
||||||
|
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||||
|
datasource.forEachCheckedEntry(tableId, function (entry) {
|
||||||
|
surveilActions.recheck(entry.host_host_name, entry.service_service_description).then(function (data) {
|
||||||
|
notifications.push('success', 'Recheck', 'Scheduled recheck for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
notifications.push('error', 'Recheck', 'Could not schedule recheck for ' + entry.host_host_name + ' ' + entry.service_service_description);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
datasource.setAllCheckTable(tableId, false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}]);
|
@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.actionbar')
|
||||||
|
.directive('banshoActionbarSearchFilter', [function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/actionbar/component_search_filter/search_filter.html',
|
||||||
|
controller: ['$scope', 'datasource', function ($scope, datasource) {
|
||||||
|
$scope.searchFilterChange = function () {
|
||||||
|
angular.forEach($scope.options.attributes.tableId, function (tableId) {
|
||||||
|
datasource.setSearchFilter(tableId, $scope.searchFilter);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}]);
|
11
app/components/directive/directive.js
Normal file
11
app/components/directive/directive.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.directive', [
|
||||||
|
'bansho.actionbar',
|
||||||
|
'bansho.host',
|
||||||
|
'bansho.service',
|
||||||
|
'bansho.table',
|
||||||
|
'bansho.tabpanel',
|
||||||
|
'bansho.tactical',
|
||||||
|
'bansho.title'
|
||||||
|
]);
|
6
app/components/directive/host/host.html
Normal file
6
app/components/directive/host/host.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<article>
|
||||||
|
<section class="main__content tabpanel">
|
||||||
|
<bansho-components components="components"></bansho-components>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
|
37
app/components/directive/host/host.js
Normal file
37
app/components/directive/host/host.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host', ['bansho.datasource'])
|
||||||
|
|
||||||
|
.directive('banshoHost', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/host/host.html',
|
||||||
|
controller: ['$scope', 'pageParams', 'surveilStatus', 'iframeUrl',
|
||||||
|
function ($scope, pageParams, surveilStatus, iframeUrl) {
|
||||||
|
var hostname = pageParams.hostname;
|
||||||
|
|
||||||
|
$scope.param = {};
|
||||||
|
surveilStatus.getHost(hostname).then(function (data) {
|
||||||
|
surveilStatus.getService(hostname).then(function(services) {
|
||||||
|
$scope.param.host = data[0];
|
||||||
|
$scope.param.host.services = [];
|
||||||
|
angular.forEach(services, function (service) {
|
||||||
|
if (service.service_description === 'cpu') {
|
||||||
|
$scope.param.host.cpu = service;
|
||||||
|
} else if (service.service_description === 'load') {
|
||||||
|
$scope.param.host.load = service;
|
||||||
|
$scope.param.host.load.iframeUrl = iframeUrl.getIFrameUrl("metric_load1", hostname, "load");
|
||||||
|
} else {
|
||||||
|
$scope.param.host.services.push(service);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.components = $scope.options.components;
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
});
|
15
app/components/directive/host/host_cpu/host_cpu.html
Normal file
15
app/components/directive/host/host_cpu/host_cpu.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<div data-ng-show="param.host.cpu" class="subcomponent__live subcomponent__small">
|
||||||
|
<h2>Cpu</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>State</td>
|
||||||
|
<td><bansho-service-state-icon state="param.host.cpu.state"></bansho-service-state-icon> {{param.host.cpu.state}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Output</td>
|
||||||
|
<td>{{param.host.cpu.plugin_output}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
12
app/components/directive/host/host_cpu/host_cpu.js
Normal file
12
app/components/directive/host/host_cpu/host_cpu.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostCpu', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_cpu/host_cpu.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
35
app/components/directive/host/host_info/host_info.html
Normal file
35
app/components/directive/host/host_info/host_info.html
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<div class="subcomponent__live">
|
||||||
|
<h2>Info</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Last check</td>
|
||||||
|
<td>{{param.host.host_last_check | timeElapsed}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Check period</td>
|
||||||
|
<td>{{param.host.config_host_check_period}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Notification period</td>
|
||||||
|
<td>{{param.host.config_host_notification_period}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Active checks</td>
|
||||||
|
<td>{{param.host.config_host_active_checks}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Notifications</td>
|
||||||
|
<td>{{param.host.config_host_notifications_enabled}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Event Handler</td>
|
||||||
|
<td>{{param.host.config_host_event_handler_enabled}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Flag detection</td>
|
||||||
|
<td>{{param.host.config_host_flap_detection_enabled}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
12
app/components/directive/host/host_info/host_info.js
Normal file
12
app/components/directive/host/host_info/host_info.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostInfo', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_info/host_info.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
15
app/components/directive/host/host_live/host_live.html
Normal file
15
app/components/directive/host/host_live/host_live.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<div class="subcomponent__live subcomponent__small">
|
||||||
|
<h2>Live status</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>State</td>
|
||||||
|
<td><bansho-host-state-icon state="param.host.host_state"></bansho-host-state-icon> {{param.host.host_state}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Output</td>
|
||||||
|
<td>{{param.host.host_plugin_output}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
12
app/components/directive/host/host_live/host_live.js
Normal file
12
app/components/directive/host/host_live/host_live.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostLive', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_live/host_live.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
16
app/components/directive/host/host_load/host_load.html
Normal file
16
app/components/directive/host/host_load/host_load.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<div data-ng-show="param.host.load" class="subcomponent__live subcomponent__small">
|
||||||
|
<h2>Load</h2>
|
||||||
|
<iframe src="{{param.host.load.iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
|
||||||
|
<table class="data-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>State</td>
|
||||||
|
<td><bansho-service-state-icon state="param.host.load.state"></bansho-service-state-icon> {{param.host.load.state}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Output</td>
|
||||||
|
<td>{{param.host.load.plugin_output}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
12
app/components/directive/host/host_load/host_load.js
Normal file
12
app/components/directive/host/host_load/host_load.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostLoad', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_load/host_load.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
9
app/components/directive/host/host_main/host_main.html
Normal file
9
app/components/directive/host/host_main/host_main.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<div class="subcomponent__live subcomponent__title">
|
||||||
|
<header class="main__content__header clearfix">
|
||||||
|
<h2 class="main__content__title">
|
||||||
|
{{param.host.host_host_name}}
|
||||||
|
<span class="subtitle" ng-show="param.host.host_config_alias">(param.host.host_config_alias)</span>
|
||||||
|
<span class="subtitle">{{param.host.host_address}}</span>
|
||||||
|
</h2>
|
||||||
|
</header>
|
||||||
|
</div>
|
12
app/components/directive/host/host_main/host_main.js
Normal file
12
app/components/directive/host/host_main/host_main.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostMain', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_main/host_main.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
@ -0,0 +1,19 @@
|
|||||||
|
<div ng-show="param.host.services.length >= 1" class="subcomponent__live">
|
||||||
|
<h2>Services</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Service description</th>
|
||||||
|
<th>Acknowledged</th>
|
||||||
|
<th>State</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="service in param.host.services">
|
||||||
|
<td><a href="#/view?view=service&host_name={{service.service_host_name}}&description={{service.service_service_description}}">{{service.service_service_description}}</a>
|
||||||
|
<td>{{service.service_acknowledged ? "Yes" : "No"}}</td>
|
||||||
|
<td><bansho-service-state-icon state="service.service_state"></bansho-service-state-icon>{{service.service_state}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.host')
|
||||||
|
.directive('banshoHostServicesList', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/host/host_services_list/host_services_list.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
5
app/components/directive/service/service.html
Normal file
5
app/components/directive/service/service.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<article>
|
||||||
|
<section class="main__content tabpanel">
|
||||||
|
<bansho-components components="components"></bansho-components>
|
||||||
|
</section>
|
||||||
|
</article>
|
32
app/components/directive/service/service.js
Normal file
32
app/components/directive/service/service.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.service', ['bansho.datasource'])
|
||||||
|
|
||||||
|
.directive('banshoService', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/service/service.html',
|
||||||
|
controller: ['$scope', 'pageParams', 'surveilStatus', 'iframeUrl',
|
||||||
|
function ($scope, pageParams, surveilStatus, iframeUrl) {
|
||||||
|
var hostname = pageParams.host_name,
|
||||||
|
serviceDescription = pageParams.service_description;
|
||||||
|
|
||||||
|
$scope.param = {};
|
||||||
|
surveilStatus.getService(hostname, serviceDescription).then(function (data) {
|
||||||
|
$scope.param.service = data[0];
|
||||||
|
surveilStatus.getServiceMetricNames(hostname, serviceDescription).then(function(metric_names) {
|
||||||
|
$scope.param.service.iframeUrls = {};
|
||||||
|
angular.forEach(metric_names, function (metric) {
|
||||||
|
var metricName = metric.metric_name.substr(7);
|
||||||
|
$scope.param.service.iframeUrls[metricName] = iframeUrl.getIFrameUrl(metric.metric_name, hostname, serviceDescription);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.components = $scope.options.components;
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
});
|
@ -1,4 +1,4 @@
|
|||||||
<div data-ng-repeat="(metric, iframeUrl) in iframeUrls" class="subcomponent__live subcomponent__small">
|
<div data-ng-repeat="(metric, iframeUrl) in param.service.iframeUrls" class="subcomponent__live subcomponent__small">
|
||||||
<h2>Graph - {{metric}}</h2>
|
<h2>Graph - {{metric}}</h2>
|
||||||
<iframe src="{{iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
|
<iframe src="{{iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
|
||||||
<table class="data-table">
|
<table class="data-table">
|
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.service')
|
||||||
|
.directive('banshoServiceGraphs', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/service/service_graphs/service_graphs.html'
|
||||||
|
};
|
||||||
|
});
|
@ -1,18 +1,18 @@
|
|||||||
<div ng-controller="ServiceInfoCtrl" class="subcomponent__live">
|
<div class="subcomponent__live">
|
||||||
<h2>Info</h2>
|
<h2>Info</h2>
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Last check</td>
|
<td>Last check</td>
|
||||||
<td>{{service.last_check|timeElapsed}}</td>
|
<td>{{param.service.service_last_check|timeElapsed}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Last state change</td>
|
<td>Last state change</td>
|
||||||
<td>{{service.last_state_change|timeElapsed}}</td>
|
<td>{{param.service.service_last_state_change|timeElapsed}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Acknowledged</td>
|
<td>Acknowledged</td>
|
||||||
<td>{{isAcknowledged}}</td>
|
<td>{{param.service.service_acknowledged ? "Yes" : "No"}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.service')
|
||||||
|
.directive('banshoServiceInfo', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/service/service_info/service_info.html'
|
||||||
|
};
|
||||||
|
});
|
@ -0,0 +1,15 @@
|
|||||||
|
<div class="subcomponent__live subcomponent__small">
|
||||||
|
<h2>Status</h2>
|
||||||
|
<table class="data-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>State</td>
|
||||||
|
<td><bansho-service-state-icon state="param.service.service_state"></bansho-service-state-icon> {{param.service.service_state}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Output</td>
|
||||||
|
<td>{{param.service.service_plugin_output}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -0,0 +1,9 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.service')
|
||||||
|
.directive('banshoServiceLive', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/service/service_live/service_live.html'
|
||||||
|
};
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
<div class="subcomponent__live subcomponent__title">
|
||||||
|
<h1>{{param.service.service_service_description}}
|
||||||
|
<span class="subtitle">
|
||||||
|
<a class="data-table__data" href="#/view?view=host&host_name={{param.service.service_host_name}}">{{param.service.host_host_name}}</a>
|
||||||
|
</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.service')
|
||||||
|
.directive('banshoServiceMain', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/service/service_main/service_main.html',
|
||||||
|
link: function (scope) {
|
||||||
|
scope.param = scope.$parent.param;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
<h2>Metrics</h2>
|
||||||
|
</div>
|
@ -1,17 +1,12 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('bansho.service.metrics', [])
|
angular.module('bansho.service.metrics', [])
|
||||||
|
|
||||||
.controller('ServiceMetricsCtrl', ['$scope', function ($scope) {
|
|
||||||
angular.noop();
|
|
||||||
}])
|
|
||||||
|
|
||||||
.directive('banshoServiceMetrics', function () {
|
.directive('banshoServiceMetrics', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
templateUrl: 'components/service/service_metrics/service_metrics.html',
|
||||||
service: '=service'
|
link: function (scope) {
|
||||||
},
|
scope.param = scope.$parent.param;
|
||||||
templateUrl: 'components/service/service_metrics/service_metrics.html'
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__duration">
|
||||||
|
<time class="data-table__data">{{entry.service_last_state_change | timeElapsed}}</time>
|
||||||
|
</td>
|
@ -9,19 +9,19 @@ angular.module('bansho.table.cell_status_event', ['bansho.table'])
|
|||||||
};
|
};
|
||||||
|
|
||||||
var shownOutput = {
|
var shownOutput = {
|
||||||
'attempts': true,
|
'event_attempts': true,
|
||||||
'contact': true,
|
'event_contact': true,
|
||||||
'notification_method': true,
|
'event_notification_method': true,
|
||||||
'notification_type': true,
|
'event_notification_type': true,
|
||||||
'state': true,
|
'event_state': true,
|
||||||
'state_type': true
|
'event_state_type': true
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.filter = function (entry) {
|
$scope.filter = function (entry) {
|
||||||
var result = {};
|
var result = {};
|
||||||
angular.forEach(entry, function(value, key) {
|
angular.forEach(entry, function(value, key) {
|
||||||
if (shownOutput[key]) {
|
if (shownOutput[key]) {
|
||||||
result[key] = value;
|
result[key.substring(6)] = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__event_type">
|
||||||
|
<p class="data-table__data">{{entry.event_event_type}}</p>
|
||||||
|
</td>
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__event_host_name">
|
||||||
|
<p class="data-table__data">{{entry.event_host_name}}</p>
|
||||||
|
</td>
|
@ -1,3 +1,3 @@
|
|||||||
<td class="data-table__event_output" ng-controller="CellStatusEventOutputCtrl">
|
<td class="data-table__event_output" ng-controller="CellStatusEventOutputCtrl">
|
||||||
<p class="data-table__data">{{entry.output}}</p>
|
<p class="data-table__data">{{entry.event_output}}</p>
|
||||||
</td>
|
</td>
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__event_service_description">
|
||||||
|
<p class="data-table__data">{{entry.event_service_description}}</p>
|
||||||
|
</td>
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__time">
|
||||||
|
<time class="data-table__data">{{entry.event_time}}</time>
|
||||||
|
</td>
|
@ -1,3 +1,3 @@
|
|||||||
<td class="data-table__host {{entry[cell_name + '_additionnalClass']}} {{state}}" ng-controller="CellStatusHostCtrl">
|
<td class="data-table__host {{entry[cell_name + '_additionnalClass']}} {{state}}" ng-controller="CellStatusHostCtrl">
|
||||||
<a class="data-table__data" href="#/view?view=host&host_name={{entry.host_name}}">{{entry.host_name}}</a>
|
<a class="data-table__data" href="#/view?view=host&host_name={{entry.host_host_name}}">{{entry.host_host_name}}</a>
|
||||||
</td>
|
</td>
|
@ -17,6 +17,6 @@ angular.module('bansho.table.cell_status_host', ['bansho.table'])
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
.run(['tableGlobalConfig', function (tableGlobalConfig) {
|
||||||
tableGlobalConfig.cellToFieldsMap.status_host = ['host_state', 'host_name'];
|
tableGlobalConfig.cellToFieldsMap.status_host = ['state', 'host_name'];
|
||||||
tableGlobalConfig.cellWrappableField.status_host = 'host_name';
|
tableGlobalConfig.cellWrappableField.status_host = 'host_name';
|
||||||
}]);
|
}]);
|
@ -1,3 +1,3 @@
|
|||||||
<td class="data-table__hostaddress" ng-controller="CellStatusHostAddressCtrl">
|
<td class="data-table__hostaddress" ng-controller="CellStatusHostAddressCtrl">
|
||||||
<span class="data-table__data">{{entry.address}}</span>
|
<span class="data-table__data">{{entry.host_address}}</span>
|
||||||
</td>
|
</td>
|
@ -0,0 +1,3 @@
|
|||||||
|
<td class="data-table__lastcheck">
|
||||||
|
<time class="data-table__data">{{entry.host_last_check * 1000 | date: "medium"}}</time>
|
||||||
|
</td>
|
@ -0,0 +1,8 @@
|
|||||||
|
<td class="data-table__service {{state}}" ng-controller="CellStatusServiceCheckCtrl">
|
||||||
|
<dl class="data-table__data">
|
||||||
|
<dt class="data-table__service__name">
|
||||||
|
<a href="#/view?view=service&host_name={{entry.host_host_name}}&description={{entry.service_service_description}}">{{entry.service_service_description}}</a>
|
||||||
|
</dt>
|
||||||
|
<dd class="data-table__service__summary">{{entry.service_plugin_output}}</dd>
|
||||||
|
</dl>
|
||||||
|
</td>
|
@ -3,9 +3,9 @@
|
|||||||
angular.module('bansho.table.cell_status_service_check', ['bansho.table'])
|
angular.module('bansho.table.cell_status_service_check', ['bansho.table'])
|
||||||
|
|
||||||
.controller('CellStatusServiceCheckCtrl', ['$scope', function ($scope) {
|
.controller('CellStatusServiceCheckCtrl', ['$scope', function ($scope) {
|
||||||
if ($scope.entry.state === 'OK') {
|
if ($scope.entry.service_state === 'OK') {
|
||||||
$scope.state = 'state--ok';
|
$scope.state = 'state--ok';
|
||||||
} else if ($scope.entry.state === 'WARNING') {
|
} else if ($scope.entry.service_state === 'WARNING') {
|
||||||
$scope.state = 'state--warning';
|
$scope.state = 'state--warning';
|
||||||
} else {
|
} else {
|
||||||
$scope.state = 'state--error';
|
$scope.state = 'state--error';
|
48
app/components/directive/table/state_icon/state_icon.js
Normal file
48
app/components/directive/table/state_icon/state_icon.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.table')
|
||||||
|
.directive('banshoHostStateIcon', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
state: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/table/state_icon/state_icon.html',
|
||||||
|
controller: ['$scope', function ($scope) {
|
||||||
|
$scope.$watch('state', function (newValue) {
|
||||||
|
if ($scope.state === 'UP') {
|
||||||
|
$scope.stateClass = 'state--ok';
|
||||||
|
} else if ($scope.state === 'WARNING') {
|
||||||
|
$scope.stateClass = 'state--warning';
|
||||||
|
} else if ($scope.state === '') {
|
||||||
|
$scope.stateClass = '';
|
||||||
|
} else {
|
||||||
|
$scope.stateClass = 'state--error';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
.directive('banshoServiceStateIcon', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
state: '='
|
||||||
|
},
|
||||||
|
templateUrl: 'components/directive/table/state_icon/state_icon.html',
|
||||||
|
controller: ['$scope', function ($scope) {
|
||||||
|
$scope.$watch('state', function (newValue) {
|
||||||
|
if ($scope.state === 'OK') {
|
||||||
|
$scope.stateClass = 'state--ok';
|
||||||
|
} else if ($scope.state === 'WARNING') {
|
||||||
|
$scope.state = 'state--warning';
|
||||||
|
} else if ($scope.state === '') {
|
||||||
|
$scope.stateClass = '';
|
||||||
|
} else {
|
||||||
|
$scope.stateClass = 'state--error';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
});
|
40
app/components/directive/table/table.html
Normal file
40
app/components/directive/table/table.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<div>
|
||||||
|
<header class="main__content__header clearfix">
|
||||||
|
<h2 data-ng-show="title" class="main__content__title">tets{{title}}</h2>
|
||||||
|
</header>
|
||||||
|
<table class="data-table">
|
||||||
|
<thead class="moving-thead">
|
||||||
|
<tr>
|
||||||
|
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||||
|
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
|
||||||
|
</th>
|
||||||
|
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
|
||||||
|
{{cellsText[i]}}
|
||||||
|
<i class="ico-up-dir"></i>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<thead class="static-thead">
|
||||||
|
<tr>
|
||||||
|
<th data-ng-show="checkColumn" class="data-table__checkbox">
|
||||||
|
<md-checkbox aria-label='Check all' ng-model="isCheckAll" ng-change="onCheckChange()"></md-checkbox>
|
||||||
|
</th>
|
||||||
|
<th ng-repeat="i in cellIndexes" class="data-table__{{cellsName[i]}}">
|
||||||
|
{{cellsText[i]}}
|
||||||
|
<i class="ico-up-dir"></i>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody class="{{entry.child_class}}"
|
||||||
|
ng-repeat="(groupByKey, groupByItems) in entries | groupBy:'host_name'">
|
||||||
|
<tr ng-repeat="entry in groupByItems | noRepeat:this | wrappableStyle:this">
|
||||||
|
<td data-ng-show="checkColumn">
|
||||||
|
<md-checkbox aria-label='Check' ng-model="entry.is_checked"></md-checkbox>
|
||||||
|
</td>
|
||||||
|
<td bansho-cell cell-name="{{cell}}" ng-repeat="cell in cellsName"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -1,8 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('bansho.table', ['bansho.surveil',
|
angular.module('bansho.table', ['bansho.utils.promiseManager',
|
||||||
'bansho.utils.promiseManager',
|
'bansho.datasource',
|
||||||
'bansho.table.actionbar',
|
'bansho.actionbar',
|
||||||
'bansho.filters',
|
'bansho.filters',
|
||||||
'bansho.table.cell_status_host',
|
'bansho.table.cell_status_host',
|
||||||
'bansho.table.cell_status_event',
|
'bansho.table.cell_status_event',
|
||||||
@ -18,92 +18,40 @@ angular.module('bansho.table', ['bansho.surveil',
|
|||||||
'ngMaterial'
|
'ngMaterial'
|
||||||
])
|
])
|
||||||
|
|
||||||
.value('tableGlobalConfig', {'cellToFieldsMap': {}, 'cellWrappableField': {}})
|
.directive('banshoTable', ['datasource', 'tableGlobalConfig',
|
||||||
|
function (datasource, tableGlobalConfig) {
|
||||||
.service('tables', ['$filter', 'surveilStatus', 'tableGlobalConfig',
|
|
||||||
function ($filter, surveilStatus, tableGlobalConfig) {
|
|
||||||
var inputSourceServices = {
|
|
||||||
surveilStatus: surveilStatus
|
|
||||||
},
|
|
||||||
config = [],
|
|
||||||
data = [],
|
|
||||||
filteredData = [],
|
|
||||||
listeners = [];
|
|
||||||
|
|
||||||
function notifyDataChanged(tableId) {
|
|
||||||
angular.forEach(listeners[tableId], function (callback) {
|
|
||||||
callback(filteredData[tableId], config[tableId].isCheckAll);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterData(tableId) {
|
|
||||||
filteredData[tableId] = $filter('filter')(data[tableId], config[tableId].searchFilter);
|
|
||||||
notifyDataChanged(tableId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
refreshTableData: function (tableId) {
|
restrict: 'E',
|
||||||
var promise = inputSourceServices.surveilStatus.getTableData(
|
scope: {
|
||||||
config[tableId].requestFields, config[tableId].inputSource.config);
|
options: '='
|
||||||
promise.then(function (newData) {
|
|
||||||
data[tableId] = newData;
|
|
||||||
config[tableId].isCheckAll = false;
|
|
||||||
filterData(tableId);
|
|
||||||
}, function (error) {
|
|
||||||
throw new Error('getTableData : Query failed' + error);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
addTable: function (tableId, conf) {
|
templateUrl: 'components/directive/table/table.html',
|
||||||
config[tableId] = conf;
|
controller: ['$scope', '$interval', 'headerFollow', 'datasource', 'tableGlobalConfig', 'promisesManager', 'pageParams',
|
||||||
config[tableId].requestFields = [];
|
function ($scope, $interval, headerFollow, datasource, tableGlobalConfig, promisesManager, pageParams) {
|
||||||
angular.forEach(config[tableId].cells.name, function (cell) {
|
var conf = {},
|
||||||
angular.forEach(tableGlobalConfig.cellToFieldsMap[cell], function (_value) {
|
refreshInterval = pageParams.refreshInterval ? pageParams.refreshInterval : 100000,
|
||||||
config[tableId].requestFields.push(_value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getConfig: function (tableId) {
|
|
||||||
return config[tableId];
|
|
||||||
},
|
|
||||||
forEachCheckedEntry: function (tableId, callbackIsChecked) {
|
|
||||||
angular.forEach(filteredData[tableId], function (entry) {
|
|
||||||
if (entry.is_checked) {
|
|
||||||
callbackIsChecked(entry);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
notifyDataChanged(tableId);
|
|
||||||
},
|
|
||||||
registerDataChanged: function (tableId, callback) {
|
|
||||||
if (!listeners[tableId]) {
|
|
||||||
listeners[tableId] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
listeners[tableId].push(callback);
|
|
||||||
},
|
|
||||||
setAllCheckTable: function (tableId, isChecked) {
|
|
||||||
config[tableId].isCheckAll = isChecked;
|
|
||||||
angular.forEach(filteredData[tableId], function (entry) {
|
|
||||||
entry.is_checked = isChecked;
|
|
||||||
});
|
|
||||||
|
|
||||||
notifyDataChanged(tableId, isChecked);
|
|
||||||
},
|
|
||||||
setSearchFilter: function (tableId, searchFilter) {
|
|
||||||
config[tableId].searchFilter = searchFilter;
|
|
||||||
filterData(tableId);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}])
|
|
||||||
|
|
||||||
.controller('TableCtrl', ['$scope', '$interval', 'headerFollow', 'surveilStatus', 'tables', 'tableGlobalConfig', 'promisesManager',
|
|
||||||
function ($scope, $interval, headerFollow, surveilStatus, tables, tableGlobalConfig,
|
|
||||||
promisesManager) {
|
|
||||||
var conf = tables.getConfig($scope.tableId),
|
|
||||||
globalConfig = tableGlobalConfig,
|
|
||||||
i;
|
i;
|
||||||
|
|
||||||
if (conf.headerFollow) {
|
$scope.tableId = $scope.options.attributes.tableId;
|
||||||
|
|
||||||
|
// Create table configuration
|
||||||
|
conf.title = $scope.options.attributes.title;
|
||||||
|
|
||||||
|
conf.cells = {'text': [], 'name': []};
|
||||||
|
conf.cells.text = $scope.options.attributes.cells.text;
|
||||||
|
conf.cells.name = $scope.options.attributes.cells.name;
|
||||||
|
|
||||||
|
conf.inputSource = $scope.options.attributes.inputSource;
|
||||||
|
|
||||||
|
conf.isWrappable = $scope.$eval($scope.options.attributes.isWrappable);
|
||||||
|
conf.noRepeatCell = $scope.options.attributes.noRepeatCell;
|
||||||
|
|
||||||
|
datasource.addTable($scope.tableId, conf);
|
||||||
|
|
||||||
|
// Handle table layout
|
||||||
|
$scope.checkColumn = $scope.options.attributes.checkColumn;
|
||||||
|
|
||||||
|
if ($scope.options.attributes.headerFollow) {
|
||||||
headerFollow.activate();
|
headerFollow.activate();
|
||||||
} else {
|
} else {
|
||||||
headerFollow.deactivate();
|
headerFollow.deactivate();
|
||||||
@ -116,68 +64,27 @@ angular.module('bansho.table', ['bansho.surveil',
|
|||||||
$scope.cellIndexes.push(i);
|
$scope.cellIndexes.push(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.onCheckChange = function() {
|
$scope.onCheckChange = function () {
|
||||||
tables.setAllCheckTable($scope.tableId, $scope.isCheckAll);
|
datasource.setAllCheckTable($scope.tableId, $scope.isCheckAll);
|
||||||
};
|
};
|
||||||
|
|
||||||
tables.registerDataChanged($scope.tableId, function (data, isCheckAll) {
|
datasource.registerDataChanged($scope.tableId, function (data, isCheckAll) {
|
||||||
$scope.isCheckAll = isCheckAll;
|
$scope.isCheckAll = isCheckAll;
|
||||||
$scope.entries = data;
|
$scope.entries = data;
|
||||||
});
|
});
|
||||||
tables.refreshTableData($scope.tableId);
|
datasource.refreshTableData($scope.tableId);
|
||||||
if (globalConfig.refreshInterval !== 0) {
|
|
||||||
|
if ($scope.options.attributes.refreshInterval && $scope.options.attributes.refreshInterval !== 0) {
|
||||||
promisesManager.addAjaxPromise(
|
promisesManager.addAjaxPromise(
|
||||||
$interval(function () {
|
$interval(function () {
|
||||||
tables.refreshTableData($scope.tableId);
|
datasource.refreshTableData($scope.tableId);
|
||||||
}, globalConfig.refreshInterval)
|
}, refreshInterval)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}])
|
}]
|
||||||
|
|
||||||
.directive('banshoTable', ['$http', '$compile', 'tables', 'tableGlobalConfig',
|
|
||||||
function ($http, $compile, tables, tableGlobalConfig) {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
scope: {
|
|
||||||
tableId: '='
|
|
||||||
},
|
|
||||||
compile: function () {
|
|
||||||
return function (scope, element, attrs) {
|
|
||||||
var template = 'components/table/table.html',
|
|
||||||
conf = {};
|
|
||||||
|
|
||||||
if (!attrs.cellsText || !attrs.cellsName || !attrs.inputSource || !attrs.isWrappable) {
|
|
||||||
throw new Error('<bansho-table> "cells-text", "cells-name", "inputSource" and "is-wrappable" attributes must be defined');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create table configuration
|
|
||||||
conf.cells = { 'text': [], 'name': [] };
|
|
||||||
conf.cells.text = attrs.cellsText.split(',');
|
|
||||||
conf.cells.name = attrs.cellsName.split(',');
|
|
||||||
|
|
||||||
conf.inputSource = JSON.parse(attrs.inputSource);
|
|
||||||
|
|
||||||
conf.isWrappable = JSON.parse(attrs.isWrappable);
|
|
||||||
conf.noRepeatCell = attrs.noRepeatCell;
|
|
||||||
conf.headerFollow = scope.$eval(attrs.headerFollow);
|
|
||||||
|
|
||||||
tables.addTable(scope.tableId, conf);
|
|
||||||
|
|
||||||
scope.checkColumn = scope.$eval(attrs.checkColumn);
|
|
||||||
|
|
||||||
if (!!attrs.refreshInterval) {
|
|
||||||
tableGlobalConfig.refreshInterval = parseInt(attrs.refreshInterval * 1000, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
$http.get(template, { cache: true })
|
|
||||||
.success(function (data) {
|
|
||||||
var elem = $compile(data)(scope);
|
|
||||||
element.append(elem);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
])
|
||||||
}])
|
|
||||||
|
|
||||||
.directive('banshoCell', ['$http', '$compile', function ($http, $compile) {
|
.directive('banshoCell', ['$http', '$compile', function ($http, $compile) {
|
||||||
return {
|
return {
|
||||||
@ -188,7 +95,7 @@ angular.module('bansho.table', ['bansho.surveil',
|
|||||||
throw new Error('<bansho-cell> "cell-name" attribute must be defined');
|
throw new Error('<bansho-cell> "cell-name" attribute must be defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
var template = 'components/table/cell_' + attrs.cellName + '/cell_' + attrs.cellName + '.html';
|
var template = 'components/directive/table/cell_' + attrs.cellName + '/cell_' + attrs.cellName + '.html';
|
||||||
|
|
||||||
$http.get(template, { cache: true })
|
$http.get(template, { cache: true })
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
@ -201,33 +108,20 @@ angular.module('bansho.table', ['bansho.surveil',
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.value('TableConfigObj', function (config) {
|
.filter('wrappableStyle', ['datasource', 'tableGlobalConfig', function (datasource, tableGlobalConfig) {
|
||||||
this.title = config.title;
|
|
||||||
this.tableId = config.tableId;
|
|
||||||
this.CellsText = config.cells.text.join();
|
|
||||||
this.CellsName = config.cells.name.join();
|
|
||||||
this.InputSource = config.inputSource;
|
|
||||||
this.IsWrappable = config.isWrappable;
|
|
||||||
this.ContainsActionBar = config.containsActionBar;
|
|
||||||
this.CheckColumn = config.checkColumn;
|
|
||||||
this.HeaderFollow = config.headerFollow;
|
|
||||||
this.NoRepeatCell = config.noRepeatCell;
|
|
||||||
})
|
|
||||||
|
|
||||||
.filter('wrappableStyle', ['tables', 'tableGlobalConfig', function (tables, tableGlobalConfig) {
|
|
||||||
return function (input, scope) {
|
return function (input, scope) {
|
||||||
var last = '',
|
var last = '',
|
||||||
entry = {},
|
entry = {},
|
||||||
parent_found = false,
|
parent_found = false,
|
||||||
class_name = ['', ''],
|
class_name = ['', ''],
|
||||||
i,
|
i,
|
||||||
fieldToWrap = tableGlobalConfig.cellWrappableField[tables.getConfig(scope.tableId).noRepeatCell];
|
fieldToWrap = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.tableId).noRepeatCell];
|
||||||
|
|
||||||
if (fieldToWrap === undefined) {
|
if (fieldToWrap === undefined) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tables.getConfig(scope.tableId).isWrappable) {
|
if (datasource.getConfig(scope.tableId).isWrappable) {
|
||||||
class_name = ['state--hasChild', 'state--isChild'];
|
class_name = ['state--hasChild', 'state--isChild'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,12 +150,12 @@ angular.module('bansho.table', ['bansho.surveil',
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.filter('noRepeat', ['tables', 'tableGlobalConfig', function (tables, tableGlobalConfig) {
|
.filter('noRepeat', ['datasource', 'tableGlobalConfig', function (datasource, tableGlobalConfig) {
|
||||||
return function (items, scope) {
|
return function (items, scope) {
|
||||||
var newItems = [],
|
var newItems = [],
|
||||||
previous,
|
previous,
|
||||||
fieldToCompare = tableGlobalConfig.cellWrappableField[tables.getConfig(scope.tableId).noRepeatCell],
|
fieldToCompare = tableGlobalConfig.cellWrappableField[datasource.getConfig(scope.tableId).noRepeatCell],
|
||||||
newAttr = tables.getConfig(scope.tableId).noRepeatCell + "_additionnalClass";
|
newAttr = datasource.getConfig(scope.tableId).noRepeatCell + "_additionnalClass";
|
||||||
|
|
||||||
angular.forEach(items, function (item) {
|
angular.forEach(items, function (item) {
|
||||||
|
|
6
app/components/directive/tabpanel/panel.html
Normal file
6
app/components/directive/tabpanel/panel.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<div role="tabpanel" class="tab-pane" data-ng-class="{active: parent.currentPanel === index }"
|
||||||
|
id="{{options.attributes.panelId}}" data-ng-show="parent.currentPanel === index">
|
||||||
|
<section class="main__content tabpanel">
|
||||||
|
<bansho-components components="options.components"></bansho-components>
|
||||||
|
</section>
|
||||||
|
</div>
|
17
app/components/directive/tabpanel/tabpanel.html
Normal file
17
app/components/directive/tabpanel/tabpanel.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<section class="main__content tabpanel">
|
||||||
|
<nav>
|
||||||
|
<ul class="tablist clearfix">
|
||||||
|
<li role="presentation" class="tablist__item" data-ng-repeat="(index, panel) in navigation"
|
||||||
|
ng-class="{active: currentPanel === index }">
|
||||||
|
<a ng-click="setIsShown(index)"
|
||||||
|
class="tabpanel__tab"
|
||||||
|
aria-expanded="true"
|
||||||
|
role="tab"
|
||||||
|
data-toggle="tab"
|
||||||
|
data-problems="{{panel.right}}">{{panel.title}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<bansho-components components="options.components"></bansho-components>
|
||||||
|
</section>
|
50
app/components/directive/tabpanel/tabpanel.js
Normal file
50
app/components/directive/tabpanel/tabpanel.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.tabpanel', [])
|
||||||
|
.directive('banshoTabpanel', ['sharedData', function (sharedData) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/tabpanel/tabpanel.html',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
link: function (scope) {
|
||||||
|
scope.navigation = scope.options.attributes.navigation;
|
||||||
|
|
||||||
|
scope.currentPanel = 0;
|
||||||
|
scope.setIsShown = function (index) {
|
||||||
|
scope.currentPanel = index;
|
||||||
|
};
|
||||||
|
|
||||||
|
angular.forEach(scope.options.components, function (panel, index) {
|
||||||
|
panel.attributes.index = index;
|
||||||
|
});
|
||||||
|
|
||||||
|
angular.forEach(scope.options.attributes.navigation, function (panel, index) {
|
||||||
|
panel.right = sharedData.getData(panel.provider, 30000, function (data) {
|
||||||
|
panel.right = data;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
|
||||||
|
.directive('banshoPanel', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/tabpanel/panel.html',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
link: function (scope) {
|
||||||
|
if (scope.$parent.$parent.currentPanel !== undefined) {
|
||||||
|
scope.parent = scope.$parent.$parent;
|
||||||
|
scope.index = scope.options.attributes.index;
|
||||||
|
} else {
|
||||||
|
scope.parent = {};
|
||||||
|
scope.parent.currentPanel = 0;
|
||||||
|
scope.index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
@ -10,6 +10,6 @@ angular.module('bansho.tactical.current_health', ['bansho.surveil',
|
|||||||
.directive('banshoCurrentHealth', function () {
|
.directive('banshoCurrentHealth', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: 'components/tactical/current_health/current_health.html'
|
templateUrl: 'components/directive/tactical/current_health/current_health.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
@ -9,6 +9,6 @@ angular.module('bansho.tactical.status_overview', [])
|
|||||||
.directive('banshoStatusOverview', function () {
|
.directive('banshoStatusOverview', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: 'components/tactical/status_overview/status_overview.html'
|
templateUrl: 'components/directive/tactical/status_overview/status_overview.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
19
app/components/directive/tactical/tactical.html
Normal file
19
app/components/directive/tactical/tactical.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<header class="main__overview">
|
||||||
|
<h2 class="main__overview__title">{{title}}</h2>
|
||||||
|
<div class="panes panes--3" id="tactical">
|
||||||
|
<div class="panes__container">
|
||||||
|
<div class="panes__pane" ng-if="statusOverview">
|
||||||
|
<bansho-status-overview></bansho-status-overview>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panes__pane" ng-if="currentHealth">
|
||||||
|
<bansho-current-health></bansho-current-health>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panes__pane" ng-if="topAlertProducers">
|
||||||
|
<bansho-top-alert-producers></bansho-top-alert-producers>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
51
app/components/directive/tactical/tactical.js
Normal file
51
app/components/directive/tactical/tactical.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.tactical', ['bansho.surveil',
|
||||||
|
'bansho.tactical.status_overview',
|
||||||
|
'bansho.tactical.current_health',
|
||||||
|
'bansho.tactical.top_alert_producers'
|
||||||
|
])
|
||||||
|
|
||||||
|
.directive('banshoTactical', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/tactical/tactical.html',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
controller: ['$scope', '$interval', 'surveilStatus', 'pageParams', 'sharedData',
|
||||||
|
function ($scope, $interval, surveilStatus, pageParams, sharedData) {
|
||||||
|
var refreshInterval = pageParams.refreshInterval ? pageParams.refreshInterval : 100000;
|
||||||
|
$scope.title = $scope.options.attributes.title;
|
||||||
|
|
||||||
|
$scope.statusOverview = $scope.options.attributes.statusOverview;
|
||||||
|
$scope.currentHealth = $scope.options.attributes.currentHealth;
|
||||||
|
$scope.topAlertProducers = $scope.options.attributes.topAlertProducers;
|
||||||
|
|
||||||
|
$scope.totalHosts = sharedData.getData('nbHosts', refreshInterval, function (data) {
|
||||||
|
$scope.totalHosts = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.hostProblems = sharedData.getData('nbHostsOpenProblems', refreshInterval, function (data) {
|
||||||
|
$scope.hostProblems = data;
|
||||||
|
$scope.hostsRatio = ($scope.totalHosts - $scope.hostProblems) / $scope.totalHosts * 100;
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.totalServices = sharedData.getData('nbServices', refreshInterval, function (data) {
|
||||||
|
$scope.totalServices = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.serviceProblems = sharedData.getData('nbServicesOpenProblems', refreshInterval, function (data) {
|
||||||
|
$scope.serviceProblems = data;
|
||||||
|
$scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Togglable tabs
|
||||||
|
// Don't follow hyperlinks
|
||||||
|
$('a[data-toggle="tab"]').on('click', function (evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
@ -21,6 +21,6 @@ angular.module('bansho.tactical.top_alert_producers', ['ngRoute' ])
|
|||||||
.directive('banshoTopAlertProducers', function () {
|
.directive('banshoTopAlertProducers', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: 'components/tactical/top_alert_producers/top_alert_producers.html'
|
templateUrl: 'components/directive/tactical/top_alert_producers/top_alert_producers.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
14
app/components/directive/title/title.html
Normal file
14
app/components/directive/title/title.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<div class="tab-content">
|
||||||
|
<header class="main__content__header clearfix">
|
||||||
|
<h2 class="main__content__title">{{options.attributes.title}}</h2>
|
||||||
|
|
||||||
|
<p data-ng-show="isBannerShown" class="main__content__alert state--error">
|
||||||
|
There
|
||||||
|
<ng-pluralize count="{{data}}" when="{'0':'is', '1': 'is', 'other': 'are'}">
|
||||||
|
</ng-pluralize>
|
||||||
|
are {{data}} {{item}}
|
||||||
|
<ng-pluralize count="data" when="{'0':'problem', '1': 'problem', 'other': 'problems'}">
|
||||||
|
</ng-pluralize>
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
</div>
|
22
app/components/directive/title/title.js
Normal file
22
app/components/directive/title/title.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('bansho.title', [])
|
||||||
|
.directive('banshoTitle', ['sharedData', function (sharedData) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
templateUrl: 'components/directive/title/title.html',
|
||||||
|
scope: {
|
||||||
|
options: '='
|
||||||
|
},
|
||||||
|
link: function (scope) {
|
||||||
|
if (scope.options.attributes.item) {
|
||||||
|
scope.item = scope.options.attributes.item;
|
||||||
|
scope.data = sharedData.getData(scope.options.attributes.provider, 30000, function (data) {
|
||||||
|
scope.data = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
scope.isBannerShown = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}]);
|
@ -1,17 +0,0 @@
|
|||||||
<article ng-controller="HostCtrl">
|
|
||||||
<section class="main__content tabpanel" ng-if="data.live && data.config">
|
|
||||||
<bansho-host-main></bansho-host-main>
|
|
||||||
|
|
||||||
<bansho-host-live></bansho-host-live>
|
|
||||||
|
|
||||||
<bansho-host-load></bansho-host-load>
|
|
||||||
|
|
||||||
<bansho-host-cpu></bansho-host-cpu>
|
|
||||||
|
|
||||||
<bansho-host-info></bansho-host-info>
|
|
||||||
|
|
||||||
<bansho-host-services-list></bansho-host-services-list>
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
|
||||||
</article>
|
|
@ -1,68 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('bansho.host', ['bansho.surveil',
|
|
||||||
'bansho.host.main',
|
|
||||||
'bansho.host.live',
|
|
||||||
'bansho.host.load',
|
|
||||||
'bansho.host.cpu',
|
|
||||||
'bansho.host.info',
|
|
||||||
'bansho.host.services_list'])
|
|
||||||
|
|
||||||
.value('hostConfig', {})
|
|
||||||
|
|
||||||
.controller('HostCtrl', ['$scope', 'hostConfig', 'surveilStatus', function ($scope, hostConfig, surveilStatus) {
|
|
||||||
var objectType = 'host',
|
|
||||||
objectIdentifier = {};
|
|
||||||
|
|
||||||
objectIdentifier.host_name = hostConfig.hostName;
|
|
||||||
surveilStatus.getHost(objectType, objectIdentifier).then(function (data) {
|
|
||||||
$scope.host = data;
|
|
||||||
$scope.data = data;
|
|
||||||
|
|
||||||
surveilStatus.getServicesByHost($scope.hostName).success(function (data) {
|
|
||||||
var i,
|
|
||||||
service;
|
|
||||||
|
|
||||||
$scope.host.services = data;
|
|
||||||
|
|
||||||
for (i = 0; i < $scope.host.services.length;) {
|
|
||||||
service = $scope.host.services[i];
|
|
||||||
if (service.service_description === "cpu") {
|
|
||||||
$scope.host.cpuService = service;
|
|
||||||
$scope.host.services.splice(i, 1);
|
|
||||||
} else if (service.service_description === "load") {
|
|
||||||
$scope.host.loadService = service;
|
|
||||||
$scope.host.services.splice(i, 1);
|
|
||||||
} else {
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}])
|
|
||||||
|
|
||||||
.directive('banshoHost', ['$http', '$compile', 'surveilStatus', 'hostConfig',
|
|
||||||
function ($http, $compile, surveilStatus, hostConfig) {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
compile: function () {
|
|
||||||
return function (scope, element, attrs) {
|
|
||||||
|
|
||||||
var template = 'components/host/host.html';
|
|
||||||
|
|
||||||
if (!attrs.hostName) {
|
|
||||||
throw new Error('<bansho-host> "host-name" attribute must be defined');
|
|
||||||
}
|
|
||||||
|
|
||||||
hostConfig.hostName = {};
|
|
||||||
hostConfig.hostName = attrs.hostName;
|
|
||||||
|
|
||||||
$http.get(template, { cache: true })
|
|
||||||
.success(function (data) {
|
|
||||||
var elem = $compile(data)(scope);
|
|
||||||
element.append(elem);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}]);
|
|
@ -1,15 +0,0 @@
|
|||||||
<div data-ng-show="host.cpuService" class="subcomponent__live subcomponent__small">
|
|
||||||
<h2>Cpu</h2>
|
|
||||||
<table class="data-table">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>State</td>
|
|
||||||
<td><bansho-service-state-icon state="host.cpuService.state"></bansho-service-state-icon> {{host.cpuService.state}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Output</td>
|
|
||||||
<td>{{host.cpuService.plugin_output}}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
@ -1,12 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
angular.module('bansho.host.cpu', ['bansho.surveil'])
|
|
||||||
.directive('banshoHostCpu', function () {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
compile: function (scope, element, attrs) {
|
|
||||||
scope.host = attrs.host;
|
|
||||||
},
|
|
||||||
templateUrl: 'components/host/host_cpu/host_cpu.html'
|
|
||||||
};
|
|
||||||
});
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user