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.event_output}}