diff --git a/app/components/authentication/authentication.js b/app/components/authentication/authentication.js index 2673b70..421d246 100644 --- a/app/components/authentication/authentication.js +++ b/app/components/authentication/authentication.js @@ -55,14 +55,14 @@ angular.module('bansho.authentication', []) }]) - .factory('authService', [ '$http', '$location', '$rootScope', 'session', 'configManager', 'themeManager', 'surveilConfig', - function ($http, $location, $rootScope, session, configManager, themeManager, surveilConfig) { + .factory('authService', [ '$http', '$location', '$rootScope', 'session', 'configManager', 'themeManager', 'surveilApiConfig', + function ($http, $location, $rootScope, session, configManager, themeManager, surveilApiConfig) { var authService = {}, onLogin = []; authService.login = function (credentials) { return $http - .post(surveilConfig.getAuthUrl() + '/tokens/', credentials) + .post(surveilApiConfig.getAuthUrl() + '/tokens/', credentials) .success(function (data) { $rootScope.isAuthenticated = true; diff --git a/app/components/config/componentsConfig.json b/app/components/config/componentsConfig.json index d44907b..a8bd56e 100644 --- a/app/components/config/componentsConfig.json +++ b/app/components/config/componentsConfig.json @@ -198,6 +198,30 @@ } } }, + "allHostConfigTemplate": { + "name": "Host config template", + "filter": { + "hosts": { + "is": { + "register": [ + "0" + ] + } + } + } + }, + "allHostConfigWithoutTemplate": { + "name": "Host config without template", + "filter": { + "hosts": { + "isnot": { + "register": [ + "0" + ] + } + } + } + }, "all": { "name": "All", "filter": { @@ -247,6 +271,16 @@ "provider": "status", "endpoint": "services", "filter": "all" + }, + "hostsConfig": { + "provider": "config", + "endpoint": "hosts", + "filter": "allHostConfigWithoutTemplate" + }, + "hostsConfigTemplate": { + "provider": "config", + "endpoint": "hosts", + "filter": "allHostConfigTemplate" } } } diff --git a/app/components/config/config.js b/app/components/config/config.js index 91fff63..de522bb 100644 --- a/app/components/config/config.js +++ b/app/components/config/config.js @@ -114,8 +114,8 @@ angular.module('bansho.config', []) }; }]) - .service('configManager', ['$http', '$q', 'componentsConfig', 'surveilConfig', - function ($http, $q, componentsConfig, surveilConfig) { + .service('configManager', ['$http', '$q', 'componentsConfig', 'surveilApiConfig', + function ($http, $q, componentsConfig, surveilApiConfig) { var layoutConfig = {}, config = {}; @@ -125,8 +125,8 @@ angular.module('bansho.config', []) $http.get('components/config/config.json') .success(function (c) { config = c; - surveilConfig.setSurveilApiUrl(c.surveilApiUrl); - surveilConfig.setAuthUrl(c.surveilAuthUrl); + surveilApiConfig.setSurveilApiUrl(c.surveilApiUrl); + surveilApiConfig.setAuthUrl(c.surveilAuthUrl); promise.resolve(); }) .error(function() { @@ -185,7 +185,7 @@ angular.module('bansho.config', []) var saveLayoutConfig = function () { var responsePromise = $q.defer(); - $http.post(surveilConfig.endpoint('appConfig'), JSON.stringify(layoutConfig.data)) + $http.post(surveilApiConfig.endpoint('appConfig'), JSON.stringify(layoutConfig.data)) .success(function () { responsePromise.resolve(); }) @@ -201,14 +201,14 @@ angular.module('bansho.config', []) componentsConfig.load(); - $http.get(surveilConfig.endpoint('appConfig')) + $http.get(surveilApiConfig.endpoint('appConfig')) .success(function (conf) { if (!useStoredConfig || jQuery.isEmptyObject(conf)) { $http.get('components/config/defaultLayoutConfig.json') .success(function (conf) { layoutConfig.data = conf; - $http.post(surveilConfig.endpoint('appConfig'), JSON.stringify(conf)) + $http.post(surveilApiConfig.endpoint('appConfig'), JSON.stringify(conf)) .success(function () { responsePromise.resolve(); }) diff --git a/app/components/config/defaultLayoutConfig.json b/app/components/config/defaultLayoutConfig.json index 2d96cca..5fc2f1c 100644 --- a/app/components/config/defaultLayoutConfig.json +++ b/app/components/config/defaultLayoutConfig.json @@ -692,5 +692,158 @@ }, "config": { "template": "config" + }, + "configHosts": { + "template": "page", + "components": [ + { + "type": "panel", + "components": [ + { + "type": "title", + "attributes": { + "title": "ConfigHosts" + } + }, + { + "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-more", + "attributes": {} + }, + { + "type": "actionbar-search-filter", + "attributes": {} + } + ] + }, + { + "type": "table", + "attributes": { + "tableId": 0, + "refreshInterval": 30, + "cells": { + "text": [ + "Host", + "Address", + "Use", + "Enable" + ], + "name": [ + "config_host", + "config_host_address", + "config_host_use", + "config_host_register" + ] + }, + "headerFollow": false, + "inputSource": "hostsConfig", + "isWrappable": false, + "noRepeatCell": "", + "checkColumn": false + } + } + ] + } + ] + }, + "configHostsTemplate": { + "template": "page", + "components": [ + { + "type": "panel", + "components": [ + { + "type": "title", + "attributes": { + "title": "Hosts Template" + } + }, + { + "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-more", + "attributes": {} + }, + { + "type": "actionbar-search-filter", + "attributes": {} + } + ] + }, + { + "type": "table", + "attributes": { + "tableId": 0, + "cells": { + "text": [ + "Template", + "Use" + ], + "name": [ + "config_host_name", + "config_host_use" + ] + }, + "headerFollow": false, + "inputSource": "hostsConfigTemplate", + "isWrappable": false, + "noRepeatCell": "", + "checkColumn": false + } + } + ] + } + ] } } diff --git a/app/components/datasource/datasource.js b/app/components/datasource/datasource.js index c16cf7a..767e817 100644 --- a/app/components/datasource/datasource.js +++ b/app/components/datasource/datasource.js @@ -3,10 +3,11 @@ angular.module('bansho.datasource', ['bansho.surveil']) .value('tableGlobalConfig', {'cellToFieldsMap': {}, 'cellWrappableField': {}}) - .service('datasource', ['$filter', 'surveilStatus', 'surveilQuery', 'componentsConfig', 'tableGlobalConfig', - function ($filter, surveilStatus, surveilQuery, componentsConfig, tableGlobalConfig) { + .service('datasource', ['$filter', 'surveilStatus', 'surveilConfig', 'surveilQuery', 'componentsConfig', 'tableGlobalConfig', + function ($filter, surveilStatus, surveilConfig, surveilQuery, componentsConfig, tableGlobalConfig) { var providerServices = { - status: surveilStatus + status: surveilStatus, + config: surveilConfig }, config = [], data = [], diff --git a/app/components/directive/table/cell_config_host/cell_config_host.html b/app/components/directive/table/cell_config_host/cell_config_host.html new file mode 100644 index 0000000..455deae --- /dev/null +++ b/app/components/directive/table/cell_config_host/cell_config_host.html @@ -0,0 +1,3 @@ + + {{entry.host_name}} + diff --git a/app/components/directive/table/cell_config_host/cell_config_host.js b/app/components/directive/table/cell_config_host/cell_config_host.js new file mode 100644 index 0000000..d4004f1 --- /dev/null +++ b/app/components/directive/table/cell_config_host/cell_config_host.js @@ -0,0 +1,12 @@ +'use strict'; + +angular.module('bansho.table.cell_config_host', ['bansho.table']) + + .controller('CellConfigHostCtrl', ['$scope', function ($scope) { + $scope.cell_name = 'host'; + }]) + + .run(['tableGlobalConfig', function (tableGlobalConfig) { + tableGlobalConfig.cellToFieldsMap.config_host = ['host_name']; + tableGlobalConfig.cellWrappableField.config_host = 'host_name'; + }]); diff --git a/app/components/directive/table/cell_config_host_address/cell_config_host_address.html b/app/components/directive/table/cell_config_host_address/cell_config_host_address.html new file mode 100644 index 0000000..c883bdc --- /dev/null +++ b/app/components/directive/table/cell_config_host_address/cell_config_host_address.html @@ -0,0 +1,3 @@ + + {{entry.address}} + diff --git a/app/components/directive/table/cell_config_host_address/cell_config_host_address.js b/app/components/directive/table/cell_config_host_address/cell_config_host_address.js new file mode 100644 index 0000000..70feecc --- /dev/null +++ b/app/components/directive/table/cell_config_host_address/cell_config_host_address.js @@ -0,0 +1,11 @@ +'use strict'; + +angular.module('bansho.table.cell_config_host_address', ['bansho.table']) + + .controller('CellConfigHostAddressCtrl', [function () { + angular.noop(); + }]) + + .run(['tableGlobalConfig', function (tableGlobalConfig) { + tableGlobalConfig.cellToFieldsMap.config_host_address = ['address']; + }]); diff --git a/app/components/directive/table/cell_config_host_name/cell_config_host_name.html b/app/components/directive/table/cell_config_host_name/cell_config_host_name.html new file mode 100644 index 0000000..6eb392e --- /dev/null +++ b/app/components/directive/table/cell_config_host_name/cell_config_host_name.html @@ -0,0 +1,3 @@ + + {{entry.name}} + diff --git a/app/components/directive/table/cell_config_host_name/cell_config_host_name.js b/app/components/directive/table/cell_config_host_name/cell_config_host_name.js new file mode 100644 index 0000000..6d58901 --- /dev/null +++ b/app/components/directive/table/cell_config_host_name/cell_config_host_name.js @@ -0,0 +1,11 @@ +'use strict'; + +angular.module('bansho.table.cell_config_host_name', ['bansho.table']) + + .controller('CellConfigHostNameCtrl', [function () { + angular.noop(); + }]) + + .run(['tableGlobalConfig', function (tableGlobalConfig) { + tableGlobalConfig.cellToFieldsMap.config_host_use = ['name']; + }]); diff --git a/app/components/directive/table/cell_config_host_register/cell_config_host_register.html b/app/components/directive/table/cell_config_host_register/cell_config_host_register.html new file mode 100644 index 0000000..ff22217 --- /dev/null +++ b/app/components/directive/table/cell_config_host_register/cell_config_host_register.html @@ -0,0 +1,3 @@ + + + diff --git a/app/components/directive/table/cell_config_host_register/cell_config_host_register.js b/app/components/directive/table/cell_config_host_register/cell_config_host_register.js new file mode 100644 index 0000000..73462bf --- /dev/null +++ b/app/components/directive/table/cell_config_host_register/cell_config_host_register.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.table.cell_config_host_register', ['bansho.table']) + + .controller('CellConfigHostRegisterCtrl', ['$scope', function ($scope) { + if ($scope.register === 0) { + $scope.activityClass = 'fa-times-circle-o'; + } else { + $scope.activityClass = 'fa-check-circle-o'; + } + }]) + + .run(['tableGlobalConfig', function (tableGlobalConfig) { + tableGlobalConfig.cellToFieldsMap.config_host_register = ['register']; + }]); diff --git a/app/components/directive/table/cell_config_host_use/cell_config_host_use.html b/app/components/directive/table/cell_config_host_use/cell_config_host_use.html new file mode 100644 index 0000000..f9589b4 --- /dev/null +++ b/app/components/directive/table/cell_config_host_use/cell_config_host_use.html @@ -0,0 +1,3 @@ + + {{entry.use}} + diff --git a/app/components/directive/table/cell_config_host_use/cell_config_host_use.js b/app/components/directive/table/cell_config_host_use/cell_config_host_use.js new file mode 100644 index 0000000..3c28ec6 --- /dev/null +++ b/app/components/directive/table/cell_config_host_use/cell_config_host_use.js @@ -0,0 +1,11 @@ +'use strict'; + +angular.module('bansho.table.cell_config_host_use', ['bansho.table']) + + .controller('CellConfigHostUseCtrl', [function () { + angular.noop(); + }]) + + .run(['tableGlobalConfig', function (tableGlobalConfig) { + tableGlobalConfig.cellToFieldsMap.config_host_use = ['use']; + }]); diff --git a/app/components/directive/table/cell_status_event_output/cell_status_event_output.html b/app/components/directive/table/cell_status_event_output/cell_status_event_output.html index d14cf25..d136026 100644 --- a/app/components/directive/table/cell_status_event_output/cell_status_event_output.html +++ b/app/components/directive/table/cell_status_event_output/cell_status_event_output.html @@ -1,3 +1,3 @@ - +

{{entry.event_output}}

diff --git a/app/components/directive/table/cell_status_host_status/cell_status_host_status.js b/app/components/directive/table/cell_status_host_status/cell_status_host_status.js index f564368..a52a057 100644 --- a/app/components/directive/table/cell_status_host_status/cell_status_host_status.js +++ b/app/components/directive/table/cell_status_host_status/cell_status_host_status.js @@ -8,4 +8,4 @@ angular.module('bansho.table.cell_status_host_status', ['bansho.table']) .run(['tableGlobalConfig', function (tableGlobalConfig) { tableGlobalConfig.cellToFieldsMap.status_host_status = ['state', 'last_check', 'parents']; - }]); + }]); \ No newline at end of file diff --git a/app/components/directive/table/table.js b/app/components/directive/table/table.js index 4e9fbd3..edf5c2d 100644 --- a/app/components/directive/table/table.js +++ b/app/components/directive/table/table.js @@ -5,15 +5,12 @@ angular.module('bansho.table', ['bansho.datasource', 'bansho.filters', 'bansho.table.cell_status_host', 'bansho.table.cell_status_event', - 'bansho.table.cell_status_event_event_type', - 'bansho.table.cell_status_event_output', - 'bansho.table.cell_status_event_host_name', - 'bansho.table.cell_status_event_service', - 'bansho.table.cell_status_duration', 'bansho.table.cell_status_service_check', 'bansho.table.cell_status_last_check', 'bansho.table.cell_status_host_address', 'bansho.table.cell_status_host_status', + 'bansho.table.cell_config_host', + 'bansho.table.cell_config_host_register', 'ngMaterial' ]) diff --git a/app/components/sidebar/sidebar.html b/app/components/sidebar/sidebar.html index 89a5e81..0ec4e08 100644 --- a/app/components/sidebar/sidebar.html +++ b/app/components/sidebar/sidebar.html @@ -27,6 +27,20 @@ +