From 844d9e0e6ea77b279ee0b714e70c8793094b79d9 Mon Sep 17 00:00:00 2001 From: Vincent Fournier Date: Tue, 25 Aug 2015 00:38:01 -0400 Subject: [PATCH] Clean config.js and remove container Change-Id: Ieeb6980232c02ec72a6a0caa707dddbacb008a6f --- app/app.js | 7 +- app/components/config/componentsConfig.json | 48 +-- .../config/defaultLayoutConfig.json | 345 +++++++----------- .../custom_directive/container/container.html | 6 - .../custom_directive/container/container.js | 154 -------- .../container/host_cpu/host_cpu.html | 15 - .../container/host_cpu/host_cpu.js | 13 - .../container/host_live/host_live.js | 13 - .../container/host_load/host_load.html | 16 - .../container/host_load/host_load.js | 13 - .../container/host_main/host_main.html | 9 - .../container/host_main/host_main.js | 13 - .../host_services_list/host_services_list.js | 13 - .../custom_directive/container/info/info.html | 13 - .../custom_directive/container/info/info.js | 21 -- .../service_graphs/service_graphs.html | 6 - .../service_graphs/service_graphs.js | 13 - .../container/service_info/service_info.js | 13 - .../container/service_live/service_live.js | 13 - .../container/service_main/service_main.js | 13 - .../service_metrics/service_metrics.html | 3 - .../service_metrics/service_metrics.js | 13 - .../custom_directive/custom_directive.js | 4 +- .../custom_directive/host_tree/host_tree.js | 2 +- .../custom_directive/tab_panel/tab_panel.js | 2 +- .../custom_directive/table/table.js | 2 +- .../current_health/current_health.html | 1 - .../tactical/current_health/current_health.js | 9 +- .../custom_directive/tactical/tactical.js | 10 +- .../tile/host_cpu/host_cpu.html | 15 + .../tile/host_cpu/host_cpu.js | 19 + .../host_live/host_live.html | 6 +- .../tile/host_live/host_live.js | 15 + .../tile/host_load/host_load.html | 16 + .../tile/host_load/host_load.js | 20 + .../tile/host_main/host_main.html | 9 + .../tile/host_main/host_main.js | 15 + .../host_services_list.html | 4 +- .../host_services_list/host_services_list.js | 21 ++ .../custom_directive/tile/info/info.html | 11 + .../custom_directive/tile/info/info.js | 20 + .../service_info/service_info.html | 6 +- .../tile/service_info/service_info.js | 15 + .../service_live/service_live.html | 6 +- .../tile/service_live/service_live.js | 15 + .../service_main/service_main.html | 4 +- .../tile/service_main/service_main.js | 15 + .../tile/service_metrics/service_metrics.html | 4 + .../tile/service_metrics/service_metrics.js | 29 ++ app/components/custom_directive/tile/tile.js | 1 + .../custom_directive/title/title.js | 3 +- app/components/datasource/datasource.js | 123 ++----- app/components/surveil/config.js | 160 +++----- app/components/surveil/status.js | 127 ++----- app/components/topbar/topbar.html | 2 +- app/components/topbar/topbar.js | 10 +- app/index.html | 25 +- app/templates/template.js | 13 +- 58 files changed, 579 insertions(+), 953 deletions(-) delete mode 100644 app/components/custom_directive/container/container.html delete mode 100644 app/components/custom_directive/container/container.js delete mode 100644 app/components/custom_directive/container/host_cpu/host_cpu.html delete mode 100644 app/components/custom_directive/container/host_cpu/host_cpu.js delete mode 100644 app/components/custom_directive/container/host_live/host_live.js delete mode 100644 app/components/custom_directive/container/host_load/host_load.html delete mode 100644 app/components/custom_directive/container/host_load/host_load.js delete mode 100644 app/components/custom_directive/container/host_main/host_main.html delete mode 100644 app/components/custom_directive/container/host_main/host_main.js delete mode 100644 app/components/custom_directive/container/host_services_list/host_services_list.js delete mode 100644 app/components/custom_directive/container/info/info.html delete mode 100644 app/components/custom_directive/container/info/info.js delete mode 100644 app/components/custom_directive/container/service_graphs/service_graphs.html delete mode 100644 app/components/custom_directive/container/service_graphs/service_graphs.js delete mode 100644 app/components/custom_directive/container/service_info/service_info.js delete mode 100644 app/components/custom_directive/container/service_live/service_live.js delete mode 100644 app/components/custom_directive/container/service_main/service_main.js delete mode 100644 app/components/custom_directive/container/service_metrics/service_metrics.html delete mode 100644 app/components/custom_directive/container/service_metrics/service_metrics.js create mode 100644 app/components/custom_directive/tile/host_cpu/host_cpu.html create mode 100644 app/components/custom_directive/tile/host_cpu/host_cpu.js rename app/components/custom_directive/{container => tile}/host_live/host_live.html (56%) create mode 100644 app/components/custom_directive/tile/host_live/host_live.js create mode 100644 app/components/custom_directive/tile/host_load/host_load.html create mode 100644 app/components/custom_directive/tile/host_load/host_load.js create mode 100644 app/components/custom_directive/tile/host_main/host_main.html create mode 100644 app/components/custom_directive/tile/host_main/host_main.js rename app/components/custom_directive/{container => tile}/host_services_list/host_services_list.html (83%) create mode 100644 app/components/custom_directive/tile/host_services_list/host_services_list.js create mode 100644 app/components/custom_directive/tile/info/info.html create mode 100644 app/components/custom_directive/tile/info/info.js rename app/components/custom_directive/{container => tile}/service_info/service_info.html (57%) create mode 100644 app/components/custom_directive/tile/service_info/service_info.js rename app/components/custom_directive/{container => tile}/service_live/service_live.html (54%) create mode 100644 app/components/custom_directive/tile/service_live/service_live.js rename app/components/custom_directive/{container => tile}/service_main/service_main.html (57%) create mode 100644 app/components/custom_directive/tile/service_main/service_main.js create mode 100644 app/components/custom_directive/tile/service_metrics/service_metrics.html create mode 100644 app/components/custom_directive/tile/service_metrics/service_metrics.js create mode 100644 app/components/custom_directive/tile/tile.js diff --git a/app/app.js b/app/app.js index e67bd98..32f1b4d 100644 --- a/app/app.js +++ b/app/app.js @@ -26,11 +26,12 @@ angular.module('bansho', [ }]) // Reinitialise objects on url change - .run(['$rootScope', 'templateManager', 'reinitDrupalTiles', 'reinitDrupalInfo', 'componentsConfig', - function ($rootScope, templateManager, reinitDrupalTiles, reinitDrupalInfo, componentsConfig) { + .run(['$rootScope', 'templateManager', 'sharedData', 'reinitDrupalTiles', 'reinitDrupalInfo', 'componentsConfig', + function ($rootScope, templateManager, sharedData, reinitDrupalTiles, reinitDrupalInfo, componentsConfig) { componentsConfig.load(); $rootScope.$on('$locationChangeStart', function () { - templateManager.clearIntervals(); + sharedData.clear(false); + templateManager.clearIntervals(false); reinitDrupalTiles(); reinitDrupalInfo(); }); diff --git a/app/components/config/componentsConfig.json b/app/components/config/componentsConfig.json index 930ca79..3550b30 100644 --- a/app/components/config/componentsConfig.json +++ b/app/components/config/componentsConfig.json @@ -204,7 +204,7 @@ "hosts": { "is": { "register": [ - "0" + "0" ] } } @@ -216,11 +216,11 @@ "hosts": { "isnot": { "register": [ - "0" + "0" ] } } - } + } }, "all": { "name": "All", @@ -233,42 +233,42 @@ } }, "inputSource": { - "hostOpenProblems": { + "statusHostsOpenProblems": { "provider": "status", "endpoint": "hosts", "filter": "allHostOpenProblems" }, - "serviceOpenProblems": { + "statusServicesOpenProblems": { "provider": "status", "endpoint": "services", "filter": "allServiceOpenProblems" }, - "serviceOpenProblemsOnly": { + "statusServicesOpenProblemsOnly": { "provider": "status", "endpoint": "services", "filter": "allServiceOpenProblemsOnly" }, - "hostsProblems": { + "statusHostsProblems": { "provider": "status", "endpoint": "hosts", "filter": "allHostsProblems" }, - "servicesProblems": { + "statusServicesProblems": { "provider": "status", "endpoint": "services", "filter": "allServicesProblems" }, - "events": { + "statusEvents": { "provider": "status", "endpoint": "events", "filter": "all" }, - "hosts": { + "statusHosts": { "provider": "status", "endpoint": "hosts", "filter": "all" }, - "services": { + "statusServices": { "provider": "status", "endpoint": "services", "filter": "all" @@ -278,67 +278,67 @@ "endpoint": "services", "filter": "all" }, - "hostsConfig": { + "configHost": { "provider": "config", "endpoint": "hosts", "filter": "allHostConfigWithoutTemplate" }, - "hostsConfigTemplate": { + "configHostTemplate": { "provider": "config", "endpoint": "hosts", "filter": "allHostConfigTemplate" }, - "commands": { + "configCommands": { "provider": "config", "endpoint": "commands", "filter": "all" }, - "businessImpactModulations": { + "configBusinessImpactModulations": { "provider": "config", "endpoint": "businessimpactmodulations", "filter": "all" }, - "checkModulations": { + "configCheckModulations": { "provider": "config", "endpoint": "checkmodulations", "filter": "all" }, - "contactGroups": { + "configContactGroups": { "provider": "config", "endpoint": "contactgroups", "filter": "all" }, - "contacts": { + "configContacts": { "provider": "config", "endpoint": "contacts", "filter": "all" }, - "hostGroups": { + "configHostGroups": { "provider": "config", "endpoint": "hostgroups", "filter": "all" }, - "macroModulations": { + "configMacroModulations": { "provider": "config", "endpoint": "macromodulations", "filter": "all" }, - "notificationWays": { + "configNotificationWays": { "provider": "config", "endpoint": "notificationways", "filter": "all" }, - "realms": { + "configRealms": { "provider": "config", "endpoint": "realms", "filter": "all" }, - "serviceGroups": { + "configServiceGroups": { "provider": "config", "endpoint": "servicegroups", "filter": "all" }, - "timePeriods": { + "configTimePeriods": { "provider": "config", "endpoint": "timeperiods", "filter": "all" diff --git a/app/components/config/defaultLayoutConfig.json b/app/components/config/defaultLayoutConfig.json index 55e3051..17d9f07 100644 --- a/app/components/config/defaultLayoutConfig.json +++ b/app/components/config/defaultLayoutConfig.json @@ -12,11 +12,11 @@ "navigation": { "openProblems": { "title": "Open Problems", - "provider": "nbServicesHostsOpenProblems" + "inputSource": "statusServicesOpenProblems" }, "allProblems": { "title": "All Problems", - "provider": "nbServicesHostsProblems" + "inputSource": "statusServicesOpenProblems" } } }, @@ -31,8 +31,8 @@ "type": "host-tree", "attributes": { "inputSource": [ - "hostOpenProblems", - "serviceOpenProblemsOnly" + "statusHostsOpenProblems", + "statusServicesOpenProblemsOnly" ] } } @@ -48,7 +48,7 @@ "type": "host-tree", "attributes": { "inputSource": [ - "servicesProblems" + "statusServicesProblems" ] } } @@ -76,11 +76,11 @@ "navigation": { "openProblems": { "title": "Open Problems", - "provider": "nbServicesHostsOpenProblems" + "inputSource": "statusServicesOpenProblems" }, "allProblems": { "title": "All Problems", - "provider": "nbServicesHostsOpenProblemsDoubleCount" + "inputSource": "statusServicesOpenProblems" } } }, @@ -146,14 +146,14 @@ "attributes": { "title": "Open Hosts Problems", "item": "host", - "provider": "nbHostsOpenProblems" + "inputSource": "statusHostsOpenProblems" } }, { "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "hostOpenProblems", + "inputSource": "statusHostsOpenProblems", "headerFollow": false, "isWrappable": false, "checkColumn": true, @@ -208,14 +208,14 @@ "attributes": { "title": "Open Service Problems", "item": "service", - "provider": "nbServicesOpenProblemsOnly" + "inputSource": "statusServicesOpenProblemsOnly" } }, { "type": "table", "attributes": { "datasourceId": 1, - "inputSource": "serviceOpenProblemsOnly", + "inputSource": "statusServicesOpenProblemsOnly", "headerFollow": false, "isWrappable": true, "checkColumn": true, @@ -276,8 +276,7 @@ { "type": "panel", "attributes": { - "panelId": "allProblems", - "provider": "nbServicesHostsOpenProblems" + "panelId": "allProblems" }, "components": [ { @@ -335,14 +334,14 @@ "attributes": { "title": "Hosts Problems", "item": "host", - "provider": "nbHostsOpenProblems" + "inputSource": "statusHostsProblems" } }, { "type": "table", "attributes": { "datasourceId": 2, - "inputSource": "hostsProblems", + "inputSource": "statusHostsProblems", "headerFollow": false, "isWrappable": false, "checkColumn": true, @@ -397,14 +396,14 @@ "attributes": { "title": "Services Problems", "item": "service", - "provider": "nbServicesOpenProblems" + "inputSource": "statusServicesProblems" } }, { "type": "table", "attributes": { "datasourceId": 3, - "inputSource": "servicesProblems", + "inputSource": "statusServicesProblems", "headerFollow": false, "isWrappable": true, "checkColumn": true, @@ -531,7 +530,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "hosts", + "inputSource": "statusHosts", "headerFollow": true, "isWrappable": false, "noRepeatCell": "", @@ -653,7 +652,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "services", + "inputSource": "statusServices", "headerFollow": true, "isWrappable": false, "checkColumn": true, @@ -766,7 +765,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "events", + "inputSource": "statusEvents", "headerFollow": true, "isWrappable": false, "checkColumn": false, @@ -835,37 +834,31 @@ "type": "panel", "components": [ { - "type": "container", - "components": [ - { - "type": "host-main", - "attributes": {} - }, - { - "type": "host-live", - "attributes": {} - }, - { - "type": "host-load", - "attributes": {} - }, - { - "type": "host-cpu", - "attributes": {} - }, - { - "type": "host-services-list", - "attributes": {} - }, - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configHost" - } - } - } - ] + "type": "tile-host-main", + "attributes": {} + }, + { + "type": "tile-host-live", + "attributes": {} + }, + { + "type": "tile-host-load", + "attributes": {} + }, + { + "type": "tile-host-cpu", + "attributes": {} + }, + { + "type": "tile-host-services-list", + "attributes": {} + }, + { + "type": "tile-info", + "attributes": { + "inputSource": "configHost", + "title": "Configuration" + } } ] } @@ -955,7 +948,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "hostsConfig", + "inputSource": "configHost", "headerFollow": false, "isWrappable": false, "noRepeatCell": "", @@ -1051,7 +1044,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "hostsConfigTemplate", + "inputSource": "configHostTemplate", "headerFollow": false, "isWrappable": false, "noRepeatCell": "", @@ -1123,7 +1116,7 @@ "type": "table", "attributes": { "datasourceId": 0, - "inputSource": "commands", + "inputSource": "configCommands", "headerFollow": true, "isWrappable": false, "noRepeatCell": "", @@ -1180,17 +1173,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configCommand" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configCommands", + "title": "Configuration" + } } ] } @@ -1231,7 +1218,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "businessImpactModulations", + "inputSource": "configBusinessImpactModulations", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1289,17 +1276,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configBusinessImpactModulation" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configBusinessImpactModulations", + "title": "Configuration" + } } ] } @@ -1340,7 +1321,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "checkModulations", + "inputSource": "configCheckModulations", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1398,17 +1379,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configCheckModulation" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configCheckModulations", + "title": "Configuration" + } } ] } @@ -1449,7 +1424,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "contactGroups", + "inputSource": "configContactGroups", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1529,17 +1504,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configContactGroup" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configContactGroups", + "title": "Configuration" + } } ] } @@ -1580,7 +1549,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "contacts", + "inputSource": "configContacts", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1668,17 +1637,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configContact" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configContacts", + "title": "Configuration" + } } ] } @@ -1719,7 +1682,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "hostGroups", + "inputSource": "configHostGroups", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1801,17 +1764,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configHostGroup" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configHostGroups", + "title": "Configuration" + } } ] } @@ -1852,7 +1809,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "macroModulations", + "inputSource": "configMacroModulations", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -1901,17 +1858,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configMacroModulation" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configMacroModulations", + "title": "Configuration" + } } ] } @@ -1952,7 +1903,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "notificationWays", + "inputSource": "configNotificationWays", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -2024,17 +1975,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configNotificationWay" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configNotificationWays", + "title": "Configuration" + } } ] } @@ -2079,7 +2024,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "realms", + "inputSource": "configRealms", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -2137,17 +2082,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Command": "configRealm" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configRealms", + "title": "Command" + } } ] } @@ -2188,7 +2127,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "serviceGroups", + "inputSource": "configServiceGroups", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -2259,17 +2198,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configServiceGroup" - } - } - } - ] + "type": "tile-info", + "attributes": { + "inputSource": "configServiceGroups", + "title": "Configuration" + } } ] } @@ -2310,7 +2243,7 @@ "attributes": { "datasourceId": 0, "headerFollow": true, - "inputSource": "timePeriods", + "inputSource": "configTimePeriods", "isWrappable": false, "noRepeatCell": "", "checkColumn": false, @@ -2368,17 +2301,11 @@ } }, { - "type": "container", - "components": [ - { - "type": "info", - "attributes": { - "inputSource": { - "Configuration": "configTimePeriod" - } - } - } - ] + "type": "tile-info", + "attributes": { + "title": "Configuration", + "inputSource": "configTimePeriods" + } } ] } @@ -2495,33 +2422,27 @@ "type": "panel", "components": [ { - "type": "container", - "components": [ - { - "type": "service-main", - "attributes": {} - }, - { - "type": "service-live", - "attributes": {} - }, - { - "type": "service-info", - "attributes": {} - }, - { - "type": "service-graphs", - "attributes": {} - }, - { - "type": "info", - "attributes": { - "inputSource": { - "Service configuration": "configService" - } - } - } - ] + "type": "tile-service-main", + "attributes": {} + }, + { + "type": "tile-service-live", + "attributes": {} + }, + { + "type": "tile-service-info", + "attributes": {} + }, + { + "type": "tile-service-metrics", + "attributes": {} + }, + { + "type": "tile-info", + "attributes": { + "title": "Service configuration", + "inputSource": "configServices" + } } ] } diff --git a/app/components/custom_directive/container/container.html b/app/components/custom_directive/container/container.html deleted file mode 100644 index 2683465..0000000 --- a/app/components/custom_directive/container/container.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
- -
-
- diff --git a/app/components/custom_directive/container/container.js b/app/components/custom_directive/container/container.js deleted file mode 100644 index 9c45e48..0000000 --- a/app/components/custom_directive/container/container.js +++ /dev/null @@ -1,154 +0,0 @@ -'use strict'; - -angular.module('bansho.container', []) - .directive('banshoContainer', function () { - return { - restrict: 'E', - scope: { - options: '=' - }, - templateUrl: 'components/custom_directive/container/container.html', - controller: ['$scope', 'templateManager', 'surveilStatus', 'surveilConfig', 'iframeUrl', - function ($scope, templateManager, surveilStatus, surveilConfig, iframeUrl) { - $scope.param = { }; - - $scope.addDirectiveParamRequirements = function (param) { - if ($scope.param[param] === undefined) { - fillParams[param](); - } - }; - - var fillParams = { - "configBusinessImpactModulation": function () { - surveilConfig.getBusinessImpactModulation(templateManager.getPageParam('business_impact_modulation_name')) - .then(function (data) { - $scope.param.configBusinessImpactModulation = data[0]; - }); - }, - "configCheckModulation": function () { - surveilConfig.getCheckModulation(templateManager.getPageParam('checkmodulation_name')) - .then(function (data) { - $scope.param.configCheckModulation = data[0]; - }); - }, - "configContactGroup": function () { - surveilConfig.getContactGroup(templateManager.getPageParam('contactgroup_name')) - .then(function (data) { - $scope.param.configContactGroup = data[0]; - }); - }, - "configContact": function () { - surveilConfig.getContact(templateManager.getPageParam('contact_name')) - .then(function (data) { - $scope.param.configContact = data[0]; - }); - }, - "configHostGroup": function () { - surveilConfig.getHostGroup(templateManager.getPageParam('hostgroup_name')) - .then(function (data) { - $scope.param.configHostGroup = data[0]; - }); - }, - "configMacroModulation": function () { - surveilConfig.getMacroModulationName(templateManager.getPageParam('macromodulation_name')) - .then(function (data) { - $scope.param.configMacroModulation = data[0]; - }); - }, - "configNotificationWay": function () { - surveilConfig.getNotificationWay(templateManager.getPageParam('notificationway_name')) - .then(function (data) { - $scope.param.configNotificationWay = data[0]; - }); - }, - "configRealm": function () { - surveilConfig.getRealm(templateManager.getPageParam('realm_name')) - .then(function (data) { - $scope.param.configRealm = data[0]; - }); - }, - "configServiceGroup": function () { - surveilConfig.getServiceGroup(templateManager.getPageParam('servicegroup_name')) - .then(function (data) { - $scope.param.configServiceGroup = data[0]; - }); - }, - "configTimePeriod": function () { - surveilConfig.getTimePeriod(templateManager.getPageParam('timeperiod_name')) - .then(function (data) { - $scope.param.configTimePeriod = data[0]; - }); - }, - "configService": function () { - surveilConfig.getService(templateManager.getPageParam('host_name'),templateManager.getPageParam('service_description')) - .then(function (data) { - $scope.param.configService = data[0]; - }); - }, - "configHost": function () { - surveilConfig.getHost(templateManager.getPageParam('host_name')) - .then(function (data) { - $scope.param.configHost = data[0]; - }); - }, - "configCommand": function () { - surveilConfig.getCommand(templateManager.getPageParam('command_name')) - .then(function (data) { - $scope.param.configCommand = data[0]; - }); - }, - "host": function () { - var hostname = templateManager.getPageParam('host_name'); - - surveilStatus.getHost(templateManager.getPageParam('host_name')).then(function (data) { - surveilStatus.getService(templateManager.getPageParam('host_name')).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); - } - }); - }); - }); - }, - "hostMetrics": function () { - var hostname = templateManager.getPageParam('host_name'); - - surveilStatus.getHostMetricNames(hostname).then(function (metrics) { - $scope.param.host.metrics = metrics; - angular.forEach(metrics, function (metric) { - surveilStatus.getHostMetric(hostname, metric).then(function (data) { - // TODO: waiting for ORBER BY DESC support in InfluxDB - }); - }); - }); - }, - "service": function () { - var hostname = templateManager.getPageParam('host_name'), - serviceDescription = templateManager.getPageParam('service_description'); - - 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 (metricName) { - $scope.param.service.iframeUrls[metricName] = iframeUrl.getIFrameUrl("metric_" + metricName, hostname, serviceDescription); - surveilStatus.getServiceMetric(hostname, serviceDescription).then(function(data) { - // TODO: waiting for ORBER BY DESC support in InfluxDB - }); - }); - }); - }); - } - }; - - $scope.components = $scope.options.components; - }] - }; - }); diff --git a/app/components/custom_directive/container/host_cpu/host_cpu.html b/app/components/custom_directive/container/host_cpu/host_cpu.html deleted file mode 100644 index 71e99ca..0000000 --- a/app/components/custom_directive/container/host_cpu/host_cpu.html +++ /dev/null @@ -1,15 +0,0 @@ -
-

Cpu

- - - - - - - - - - - -
State {{param.host.cpu.state}}
Output{{param.host.cpu.plugin_output}}
-
diff --git a/app/components/custom_directive/container/host_cpu/host_cpu.js b/app/components/custom_directive/container/host_cpu/host_cpu.js deleted file mode 100644 index b76e852..0000000 --- a/app/components/custom_directive/container/host_cpu/host_cpu.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoHostCpu', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/host_cpu/host_cpu.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('host'); - } - }; - }); diff --git a/app/components/custom_directive/container/host_live/host_live.js b/app/components/custom_directive/container/host_live/host_live.js deleted file mode 100644 index d9ee185..0000000 --- a/app/components/custom_directive/container/host_live/host_live.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoHostLive', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/host_live/host_live.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('host'); - } - }; - }); diff --git a/app/components/custom_directive/container/host_load/host_load.html b/app/components/custom_directive/container/host_load/host_load.html deleted file mode 100644 index f675270..0000000 --- a/app/components/custom_directive/container/host_load/host_load.html +++ /dev/null @@ -1,16 +0,0 @@ -
-

Load

- - - - - - - - - - - - -
State {{param.host.load.state}}
Output{{param.host.load.plugin_output}}
-
diff --git a/app/components/custom_directive/container/host_load/host_load.js b/app/components/custom_directive/container/host_load/host_load.js deleted file mode 100644 index bcee48a..0000000 --- a/app/components/custom_directive/container/host_load/host_load.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoHostLoad', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/host_load/host_load.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('host'); - } - }; - }); diff --git a/app/components/custom_directive/container/host_main/host_main.html b/app/components/custom_directive/container/host_main/host_main.html deleted file mode 100644 index 445e4eb..0000000 --- a/app/components/custom_directive/container/host_main/host_main.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-

- {{param.host.host_host_name}} - (param.host.host_config_alias) - {{param.host.host_address}} -

-
-
diff --git a/app/components/custom_directive/container/host_main/host_main.js b/app/components/custom_directive/container/host_main/host_main.js deleted file mode 100644 index 3c2323c..0000000 --- a/app/components/custom_directive/container/host_main/host_main.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoHostMain', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/host_main/host_main.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('host'); - } - }; - }); diff --git a/app/components/custom_directive/container/host_services_list/host_services_list.js b/app/components/custom_directive/container/host_services_list/host_services_list.js deleted file mode 100644 index a54d541..0000000 --- a/app/components/custom_directive/container/host_services_list/host_services_list.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoHostServicesList', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/host_services_list/host_services_list.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('host'); - } - }; - }); diff --git a/app/components/custom_directive/container/info/info.html b/app/components/custom_directive/container/info/info.html deleted file mode 100644 index b82efe8..0000000 --- a/app/components/custom_directive/container/info/info.html +++ /dev/null @@ -1,13 +0,0 @@ - -
-

{{key}}

- - - - - - - -
{{key}}{{value}}
-
-
diff --git a/app/components/custom_directive/container/info/info.js b/app/components/custom_directive/container/info/info.js deleted file mode 100644 index e29a9c5..0000000 --- a/app/components/custom_directive/container/info/info.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoInfo', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/info/info.html', - link: function (scope) { - scope.param = scope.$parent.param; - angular.forEach(scope.components, function(component) { - if (component.type === 'info') { - scope.inputSources = component.attributes.inputSource; - } - }); - - angular.forEach(scope.inputSources, function (inputSource) { - scope.$parent.addDirectiveParamRequirements(inputSource); - }); - } - }; - }); diff --git a/app/components/custom_directive/container/service_graphs/service_graphs.html b/app/components/custom_directive/container/service_graphs/service_graphs.html deleted file mode 100644 index 1814901..0000000 --- a/app/components/custom_directive/container/service_graphs/service_graphs.html +++ /dev/null @@ -1,6 +0,0 @@ -
-

Graph - {{metric}}

- - -
-
diff --git a/app/components/custom_directive/container/service_graphs/service_graphs.js b/app/components/custom_directive/container/service_graphs/service_graphs.js deleted file mode 100644 index 1008fc3..0000000 --- a/app/components/custom_directive/container/service_graphs/service_graphs.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoServiceGraphs', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/service_graphs/service_graphs.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('service'); - } - }; - }); diff --git a/app/components/custom_directive/container/service_info/service_info.js b/app/components/custom_directive/container/service_info/service_info.js deleted file mode 100644 index cc8704a..0000000 --- a/app/components/custom_directive/container/service_info/service_info.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoServiceInfo', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/service_info/service_info.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('service'); - } - }; - }); diff --git a/app/components/custom_directive/container/service_live/service_live.js b/app/components/custom_directive/container/service_live/service_live.js deleted file mode 100644 index 9031010..0000000 --- a/app/components/custom_directive/container/service_live/service_live.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoServiceLive', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/service_live/service_live.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('service'); - } - }; - }); diff --git a/app/components/custom_directive/container/service_main/service_main.js b/app/components/custom_directive/container/service_main/service_main.js deleted file mode 100644 index 0ab4daf..0000000 --- a/app/components/custom_directive/container/service_main/service_main.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoServiceMain', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/service_main/service_main.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('service'); - } - }; - }); diff --git a/app/components/custom_directive/container/service_metrics/service_metrics.html b/app/components/custom_directive/container/service_metrics/service_metrics.html deleted file mode 100644 index 40918a8..0000000 --- a/app/components/custom_directive/container/service_metrics/service_metrics.html +++ /dev/null @@ -1,3 +0,0 @@ -
-

Metrics

-
diff --git a/app/components/custom_directive/container/service_metrics/service_metrics.js b/app/components/custom_directive/container/service_metrics/service_metrics.js deleted file mode 100644 index 94319e6..0000000 --- a/app/components/custom_directive/container/service_metrics/service_metrics.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -angular.module('bansho.container') - .directive('banshoServiceMetrics', function () { - return { - restrict: 'E', - templateUrl: 'components/custom_directive/container/service_metrics/service_metrics.html', - link: function (scope) { - scope.param = scope.$parent.param; - scope.$parent.addDirectiveParamRequirements('service'); - } - }; - }); diff --git a/app/components/custom_directive/custom_directive.js b/app/components/custom_directive/custom_directive.js index 5a5f53a..69cd0c4 100644 --- a/app/components/custom_directive/custom_directive.js +++ b/app/components/custom_directive/custom_directive.js @@ -2,12 +2,12 @@ angular.module('bansho.customDirective', [ 'bansho.actionbar', - 'bansho.textArea', - 'bansho.container', 'bansho.hostTree', 'bansho.stateIcon', 'bansho.table', 'bansho.tabpanel', 'bansho.tactical', + 'bansho.textArea', + 'bansho.tile', 'bansho.title' ]); diff --git a/app/components/custom_directive/host_tree/host_tree.js b/app/components/custom_directive/host_tree/host_tree.js index d53ac14..d66c5f1 100644 --- a/app/components/custom_directive/host_tree/host_tree.js +++ b/app/components/custom_directive/host_tree/host_tree.js @@ -13,7 +13,7 @@ angular.module('bansho.hostTree', ['bansho.datasource']) function ($scope, sharedData) { $scope.sources = {}; angular.forEach($scope.options.attributes.inputSource, function (source) { - $scope.sources[source] = sharedData.getDataFromInputSource(source, function (data) { + $scope.sources[source] = sharedData.getDataFromInputSource(source, false, null, false, function (data) { $scope.sources[source] = data; }); }); diff --git a/app/components/custom_directive/tab_panel/tab_panel.js b/app/components/custom_directive/tab_panel/tab_panel.js index 26e106c..226acdc 100644 --- a/app/components/custom_directive/tab_panel/tab_panel.js +++ b/app/components/custom_directive/tab_panel/tab_panel.js @@ -17,7 +17,7 @@ angular.module('bansho.tabpanel', []) }; angular.forEach(scope.navigation, function (panel) { - panel.right = sharedData.getData(panel.provider, function (data) { + panel.right = sharedData.getDataFromInputSource(panel.inputSource, true, null, false, function (data) { panel.right = data; }); }); diff --git a/app/components/custom_directive/table/table.js b/app/components/custom_directive/table/table.js index 48f0953..249c6a8 100644 --- a/app/components/custom_directive/table/table.js +++ b/app/components/custom_directive/table/table.js @@ -50,7 +50,7 @@ angular.module('bansho.table', ['bansho.datasource', $scope.entries = data; }); datasource.refreshTableData($scope.datasourceId); - templateManager.addInterval(function refreshTable () { + templateManager.addInterval(false, function refreshTable () { datasource.refreshTableData($scope.datasourceId); }); diff --git a/app/components/custom_directive/tactical/current_health/current_health.html b/app/components/custom_directive/tactical/current_health/current_health.html index 3c17aef..1f7d7a5 100644 --- a/app/components/custom_directive/tactical/current_health/current_health.html +++ b/app/components/custom_directive/tactical/current_health/current_health.html @@ -3,7 +3,6 @@ Current health -   diff --git a/app/components/custom_directive/tactical/current_health/current_health.js b/app/components/custom_directive/tactical/current_health/current_health.js index 2525bf4..d257426 100644 --- a/app/components/custom_directive/tactical/current_health/current_health.js +++ b/app/components/custom_directive/tactical/current_health/current_health.js @@ -7,12 +7,11 @@ angular.module('bansho.tactical.current_health', ['bansho.surveil', return { restrict: 'E', templateUrl: 'components/custom_directive/tactical/current_health/current_health.html', - link: function (scope, element) { - $rootScope.$watch('themeClassSize', function( sizeclass) { + controller: ['$scope', '$element', function (scope, element) { + $rootScope.$watch('themeClassSize', function(sizeclass) { scope.themeClassSize = sizeclass; - $compile(element.contents())(scope); + //$compile(element.contents())(scope); }); - } - + }] }; }]); diff --git a/app/components/custom_directive/tactical/tactical.js b/app/components/custom_directive/tactical/tactical.js index 528efe3..487f0ac 100644 --- a/app/components/custom_directive/tactical/tactical.js +++ b/app/components/custom_directive/tactical/tactical.js @@ -21,20 +21,22 @@ angular.module('bansho.tactical', ['bansho.surveil', $scope.currentHealth = $scope.options.attributes.currentHealth; $scope.topAlertProducers = $scope.options.attributes.topAlertProducers; - $scope.totalHosts = sharedData.getData('nbHosts', function (data) { + $scope.totalHosts = sharedData.getDataFromInputSource('statusHosts', true, null, false, function (data) { $scope.totalHosts = data; + $scope.hostsRatio = ($scope.totalHosts - $scope.hostProblems) / $scope.totalHosts * 100; }); - $scope.hostProblems = sharedData.getData('nbHostsOpenProblems', function (data) { + $scope.hostProblems = sharedData.getDataFromInputSource('statusHostsOpenProblems', true, null, false, function (data) { $scope.hostProblems = data; $scope.hostsRatio = ($scope.totalHosts - $scope.hostProblems) / $scope.totalHosts * 100; }); - $scope.totalServices = sharedData.getData('nbServices', function (data) { + $scope.totalServices = sharedData.getDataFromInputSource('statusServices', true, null, false, function (data) { $scope.totalServices = data; + $scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100; }); - $scope.serviceProblems = sharedData.getData('nbServicesOpenProblems', function (data) { + $scope.serviceProblems = sharedData.getDataFromInputSource('statusServicesOpenProblems', true, null, false, function (data) { $scope.serviceProblems = data; $scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100; }); diff --git a/app/components/custom_directive/tile/host_cpu/host_cpu.html b/app/components/custom_directive/tile/host_cpu/host_cpu.html new file mode 100644 index 0000000..2c20ac2 --- /dev/null +++ b/app/components/custom_directive/tile/host_cpu/host_cpu.html @@ -0,0 +1,15 @@ +
+

Cpu

+ + + + + + + + + + + +
State {{cpu.service_state}}
Output{{cpu.service_plugin_output}}
+
diff --git a/app/components/custom_directive/tile/host_cpu/host_cpu.js b/app/components/custom_directive/tile/host_cpu/host_cpu.js new file mode 100644 index 0000000..58b80ae --- /dev/null +++ b/app/components/custom_directive/tile/host_cpu/host_cpu.js @@ -0,0 +1,19 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileHostCpu', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/host_cpu/host_cpu.html', + controller: ['$scope', 'sharedData', 'templateManager', function ($scope, sharedData, templateManager) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (services) { + angular.forEach(services, function (service) { + if (service.service_service_description === 'cpu') { + $scope.cpu = service; + } + }); + }); + }] + }; + }); diff --git a/app/components/custom_directive/container/host_live/host_live.html b/app/components/custom_directive/tile/host_live/host_live.html similarity index 56% rename from app/components/custom_directive/container/host_live/host_live.html rename to app/components/custom_directive/tile/host_live/host_live.html index 1355169..d0b59ae 100644 --- a/app/components/custom_directive/container/host_live/host_live.html +++ b/app/components/custom_directive/tile/host_live/host_live.html @@ -4,13 +4,13 @@ State - - {{param.host.host_state}} + + {{host[0].host_state}} Output - {{param.host.host_plugin_output}} + {{host[0].host_plugin_output}} diff --git a/app/components/custom_directive/tile/host_live/host_live.js b/app/components/custom_directive/tile/host_live/host_live.js new file mode 100644 index 0000000..fa79000 --- /dev/null +++ b/app/components/custom_directive/tile/host_live/host_live.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileHostLive', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/host_live/host_live.html', + controller: ['$scope', 'sharedData', 'templateManager', function (scope, sharedData, templateManager) { + scope.host = sharedData.getDataFromInputSource('statusHosts', false, + templateManager.getAllPageParams(), false, function (host) { + scope.host = host; + }); + }] + }; + }); diff --git a/app/components/custom_directive/tile/host_load/host_load.html b/app/components/custom_directive/tile/host_load/host_load.html new file mode 100644 index 0000000..2b71ef2 --- /dev/null +++ b/app/components/custom_directive/tile/host_load/host_load.html @@ -0,0 +1,16 @@ +
+

Load

+ + + + + + + + + + + + +
State {{load.service_state}}
Output{{load.service_plugin_output}}
+
diff --git a/app/components/custom_directive/tile/host_load/host_load.js b/app/components/custom_directive/tile/host_load/host_load.js new file mode 100644 index 0000000..c163d1d --- /dev/null +++ b/app/components/custom_directive/tile/host_load/host_load.js @@ -0,0 +1,20 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileHostLoad', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/host_load/host_load.html', + controller: ['$scope', 'sharedData', 'templateManager', 'iframeUrl', function ($scope, sharedData, templateManager, iframeUrl) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (services) { + angular.forEach(services, function (service) { + if (service.service_service_description === 'load') { + $scope.load = service; + $scope.iframeUrl = iframeUrl.getIFrameUrl("metric_load1", service.host_host_name, "load"); + } + }); + }); + }] + }; + }); diff --git a/app/components/custom_directive/tile/host_main/host_main.html b/app/components/custom_directive/tile/host_main/host_main.html new file mode 100644 index 0000000..0885e92 --- /dev/null +++ b/app/components/custom_directive/tile/host_main/host_main.html @@ -0,0 +1,9 @@ +
+
+

+ {{host[0].host_host_name}} + (host[0].host_config_alias) + {{host[0].host_address}} +

+
+
diff --git a/app/components/custom_directive/tile/host_main/host_main.js b/app/components/custom_directive/tile/host_main/host_main.js new file mode 100644 index 0000000..a3015d7 --- /dev/null +++ b/app/components/custom_directive/tile/host_main/host_main.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileHostMain', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/host_main/host_main.html', + controller: ['$scope', 'sharedData', 'templateManager', function (scope, sharedData, templateManager) { + scope.host = sharedData.getDataFromInputSource('statusHosts', false, + templateManager.getAllPageParams(), false, function (host) { + scope.host = host; + }); + }] + }; + }); diff --git a/app/components/custom_directive/container/host_services_list/host_services_list.html b/app/components/custom_directive/tile/host_services_list/host_services_list.html similarity index 83% rename from app/components/custom_directive/container/host_services_list/host_services_list.html rename to app/components/custom_directive/tile/host_services_list/host_services_list.html index 204670f..4141d17 100644 --- a/app/components/custom_directive/container/host_services_list/host_services_list.html +++ b/app/components/custom_directive/tile/host_services_list/host_services_list.html @@ -1,4 +1,4 @@ -
+

Services

@@ -9,7 +9,7 @@ - + - + - + - +
{{service.service_service_description}} {{service.service_acknowledged ? "Yes" : "No"}} diff --git a/app/components/custom_directive/tile/host_services_list/host_services_list.js b/app/components/custom_directive/tile/host_services_list/host_services_list.js new file mode 100644 index 0000000..d661fd7 --- /dev/null +++ b/app/components/custom_directive/tile/host_services_list/host_services_list.js @@ -0,0 +1,21 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileHostServicesList', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/host_services_list/host_services_list.html', + controller: ['$scope', 'sharedData', 'templateManager', 'iframeUrl', function ($scope, sharedData, templateManager, iframeUrl) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (services) { + $scope.services = []; + angular.forEach(services, function (service) { + if (service.service_service_description !== 'load' && + service.service_service_description !== 'cpu') { + $scope.services.push(service); + } + }); + }); + }] + }; + }); diff --git a/app/components/custom_directive/tile/info/info.html b/app/components/custom_directive/tile/info/info.html new file mode 100644 index 0000000..0646b04 --- /dev/null +++ b/app/components/custom_directive/tile/info/info.html @@ -0,0 +1,11 @@ +
+

{{title}}

+ + + + + + + +
{{key}}{{value}}
+
diff --git a/app/components/custom_directive/tile/info/info.js b/app/components/custom_directive/tile/info/info.js new file mode 100644 index 0000000..d36e590 --- /dev/null +++ b/app/components/custom_directive/tile/info/info.js @@ -0,0 +1,20 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileInfo', function () { + return { + restrict: 'E', + scope: { + options: '=' + }, + templateUrl: 'components/custom_directive/tile/info/info.html', + controller: ['$scope', 'sharedData', 'templateManager', 'iframeUrl', function ($scope, sharedData, templateManager, iframeUrl) { + $scope.title = $scope.options.attributes.title; + sharedData.getDataFromInputSource($scope.options.attributes.inputSource, false, + templateManager.getAllPageParams(), false, function (data) { + $scope.data = data; + } + ); + }] + }; + }); diff --git a/app/components/custom_directive/container/service_info/service_info.html b/app/components/custom_directive/tile/service_info/service_info.html similarity index 57% rename from app/components/custom_directive/container/service_info/service_info.html rename to app/components/custom_directive/tile/service_info/service_info.html index 29eaa56..5ac2474 100644 --- a/app/components/custom_directive/container/service_info/service_info.html +++ b/app/components/custom_directive/tile/service_info/service_info.html @@ -4,15 +4,15 @@
Last check{{param.service.service_last_check|timeElapsed}}{{service[0].service_last_check|timeElapsed}}
Last state change{{param.service.service_last_state_change|timeElapsed}}{{service[0].service_last_state_change|timeElapsed}}
Acknowledged{{param.service.service_acknowledged ? "Yes" : "No"}}{{service[0].service_acknowledged ? "Yes" : "No"}}
diff --git a/app/components/custom_directive/tile/service_info/service_info.js b/app/components/custom_directive/tile/service_info/service_info.js new file mode 100644 index 0000000..09d9f57 --- /dev/null +++ b/app/components/custom_directive/tile/service_info/service_info.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileServiceInfo', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/service_info/service_info.html', + controller: ['$scope', 'sharedData', 'templateManager', function ($scope, sharedData, templateManager, iframeUrl) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (service) { + $scope.service = service; + }); + }] + }; + }); diff --git a/app/components/custom_directive/container/service_live/service_live.html b/app/components/custom_directive/tile/service_live/service_live.html similarity index 54% rename from app/components/custom_directive/container/service_live/service_live.html rename to app/components/custom_directive/tile/service_live/service_live.html index 990a7b2..dc6e0d6 100644 --- a/app/components/custom_directive/container/service_live/service_live.html +++ b/app/components/custom_directive/tile/service_live/service_live.html @@ -4,13 +4,13 @@ State - - {{param.service.service_state}} + + {{service[0].service_state}} Output - {{param.service.service_plugin_output}} + {{service[0].service_plugin_output}} diff --git a/app/components/custom_directive/tile/service_live/service_live.js b/app/components/custom_directive/tile/service_live/service_live.js new file mode 100644 index 0000000..a56b8a2 --- /dev/null +++ b/app/components/custom_directive/tile/service_live/service_live.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileServiceLive', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/service_live/service_live.html', + controller: ['$scope', 'sharedData', 'templateManager', function ($scope, sharedData, templateManager, iframeUrl) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (service) { + $scope.service = service; + }); + }] + }; + }); diff --git a/app/components/custom_directive/container/service_main/service_main.html b/app/components/custom_directive/tile/service_main/service_main.html similarity index 57% rename from app/components/custom_directive/container/service_main/service_main.html rename to app/components/custom_directive/tile/service_main/service_main.html index a8ccc74..77922b9 100644 --- a/app/components/custom_directive/container/service_main/service_main.html +++ b/app/components/custom_directive/tile/service_main/service_main.html @@ -1,7 +1,7 @@
-

{{param.service.service_service_description}} +

{{service[0].service_service_description}} - {{param.service.host_host_name}} + {{service[0].host_host_name}}

diff --git a/app/components/custom_directive/tile/service_main/service_main.js b/app/components/custom_directive/tile/service_main/service_main.js new file mode 100644 index 0000000..ac463a9 --- /dev/null +++ b/app/components/custom_directive/tile/service_main/service_main.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileServiceMain', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/service_main/service_main.html', + controller: ['$scope', 'sharedData', 'templateManager', function ($scope, sharedData, templateManager, iframeUrl) { + sharedData.getDataFromInputSource('statusServices', false, + templateManager.getAllPageParams(), false, function (service) { + $scope.service = service; + }); + }] + }; + }); diff --git a/app/components/custom_directive/tile/service_metrics/service_metrics.html b/app/components/custom_directive/tile/service_metrics/service_metrics.html new file mode 100644 index 0000000..8b81940 --- /dev/null +++ b/app/components/custom_directive/tile/service_metrics/service_metrics.html @@ -0,0 +1,4 @@ +
+

Graph - {{metric.title}}

+ +
diff --git a/app/components/custom_directive/tile/service_metrics/service_metrics.js b/app/components/custom_directive/tile/service_metrics/service_metrics.js new file mode 100644 index 0000000..b9ecb31 --- /dev/null +++ b/app/components/custom_directive/tile/service_metrics/service_metrics.js @@ -0,0 +1,29 @@ +'use strict'; + +angular.module('bansho.tile') + .directive('banshoTileServiceMetrics', function () { + return { + restrict: 'E', + templateUrl: 'components/custom_directive/tile/service_metrics/service_metrics.html', + controller: ['$scope', 'templateManager', 'surveilStatus', 'iframeUrl', + function ($scope, templateManager, surveilStatus, iframeUrl) { + var hostname = templateManager.getPageParam('host_name'), + serviceDescription = templateManager.getPageParam('service_description'); + + $scope.metrics = []; + surveilStatus.getServiceMetricNames(hostname, serviceDescription).then(function (metricNames) { + angular.forEach(metricNames, function (metricName) { + $scope.metrics.push({ + title: metricName, + iframeUrl: iframeUrl.getIFrameUrl("metric_" + metricName, hostname, serviceDescription) + }); + + surveilStatus.getServiceMetric(hostname, serviceDescription, metricName).then(function (data) { + // TODO: waiting for ORBER BY DESC support in InfluxDB + }); + }); + }); + + }] + }; + }); diff --git a/app/components/custom_directive/tile/tile.js b/app/components/custom_directive/tile/tile.js new file mode 100644 index 0000000..3ab82df --- /dev/null +++ b/app/components/custom_directive/tile/tile.js @@ -0,0 +1 @@ +angular.module('bansho.tile', []); diff --git a/app/components/custom_directive/title/title.js b/app/components/custom_directive/title/title.js index 7587a4b..3c00789 100644 --- a/app/components/custom_directive/title/title.js +++ b/app/components/custom_directive/title/title.js @@ -11,7 +11,8 @@ angular.module('bansho.title', []) link: function (scope) { if (scope.options.attributes.item) { scope.item = scope.options.attributes.item; - scope.data = sharedData.getData(scope.options.attributes.provider, function (data) { + + scope.data = sharedData.getDataFromInputSource(scope.options.attributes.inputSource, true, null, false, function (data) { scope.data = data; }); diff --git a/app/components/datasource/datasource.js b/app/components/datasource/datasource.js index fa6f20d..b71d9d1 100644 --- a/app/components/datasource/datasource.js +++ b/app/components/datasource/datasource.js @@ -35,7 +35,7 @@ angular.module('bansho.datasource', ['bansho.surveil']) filter = componentsConfig.mergeFilters([config[datasourceId].queryFilter, filter]); } - promise = providerServices[inputSource.provider].getData([], filter, inputSource.endpoint, conf.queryPaging); + promise = providerServices[inputSource.provider].getDataFromInputSource([], inputSource, null, {count: false}, conf.queryPaging); promise.then(function (newData) { data[datasourceId] = newData; @@ -132,112 +132,59 @@ angular.module('bansho.datasource', ['bansho.surveil']) }; }]) - .service('sharedData', ['templateManager', 'surveilStatus', 'componentsConfig', - function (templateManager, surveilStatus, componentsConfig) { - var providerServices = { - status: surveilStatus + .service('sharedData', ['templateManager', 'surveilStatus', 'surveilConfig', 'componentsConfig', + function (templateManager, surveilStatus, surveilConfig, componentsConfig) { + var providers = { + status: surveilStatus, + config: surveilConfig }, - sharedData = {}, - listeners = {}, - providers = { - 'nbServicesHostsProblems': function () { - surveilStatus.getNbHostsProblems().then(function (nbHosts) { - surveilStatus.getNbServicesProblems().then(function (nbServices) { - sharedData.nbServicesHostsProblems = nbHosts + nbServices; - notifyListeners('nbServicesHostsProblems'); - }); - }); - }, - 'nbHostsOpenProblems': function () { - surveilStatus.getNbHostOpenProblems().then(function (nbHostProblems) { - sharedData.nbHostsOpenProblems = nbHostProblems; - notifyListeners('nbHostsOpenProblems'); - }); - }, - 'nbServicesOpenProblems': function () { - surveilStatus.getNbServiceOpenProblems().then(function (nbServiceProblems) { - sharedData.nbServicesOpenProblems = nbServiceProblems; - notifyListeners('nbServicesOpenProblems'); - }); - }, - 'nbHosts': function () { - surveilStatus.getNbHosts().then(function (nbHosts) { - sharedData.nbHosts = nbHosts; - notifyListeners('nbHosts'); - }); - - }, - 'nbServices': function () { - surveilStatus.getNbServices().then(function (nbServices) { - sharedData.nbServices = nbServices; - notifyListeners('nbServices'); - }); - }, - 'nbServicesOpenProblemsOnly': function () { - surveilStatus.getNbServiceOpenProblemsOnly().then(function (nbServices) { - sharedData.nbServicesOpenProblemsOnly = nbServices; - notifyListeners('nbServicesOpenProblemsOnly'); - }); - }, - 'nbServicesHostsOpenProblems': function () { - surveilStatus.getNbHostsProblems().then(function (nbHosts) { - surveilStatus.getNbServiceOpenProblemsOnly().then(function (nbServices) { - sharedData.nbServicesHostsOpenProblems = nbHosts + nbServices; - notifyListeners('nbServicesHostsOpenProblems'); - }); - }); - }, - 'nbServicesHostsOpenProblemsDoubleCount': function () { - surveilStatus.getNbHostsProblems().then(function (nbHosts) { - surveilStatus.getNbServiceOpenProblems().then(function (nbServices) { - sharedData.nbServicesHostsOpenProblemsDoubleCount = nbHosts + nbServices; - notifyListeners('nbServicesHostsOpenProblemsDoubleCount'); - }); - }); - } - }; + data = {}; var notifyListeners = function (key) { - angular.forEach(listeners[key], function (onChange) { - onChange(sharedData[key]); + angular.forEach(data[key].onChange, function (onChange) { + onChange(data[key].value); }); }; return { - getData: function (key, onChange) { - if (listeners[key] === undefined) { - listeners[key] = [onChange]; - templateManager.addInterval(providers[key]); - providers[key](); - } else { - listeners[key].push(onChange); - } - - return sharedData[key]; + clear: function (isGlobalCleared) { + angular.forEach(data, function (datasource, key) { + if (!isGlobalCleared && !datasource.isGlobal || isGlobalCleared) { + delete data[key]; + } + }); }, - getDataFromInputSource: function (source, onChange) { - if (listeners[source] === undefined) { - listeners[source] = [onChange]; + getDataFromInputSource: function (source, isCount, keys, isGlobal, onChange) { + var listenerKey = source + isCount + JSON.stringify(keys); + if (data[listenerKey] === undefined) { + data[listenerKey] = { + onChange: [onChange], + isGlobal: isGlobal, + value: null + }; var inputSource = componentsConfig.getInputSource(source); - providers[source] = function () { - providerServices[inputSource.provider].getData([], componentsConfig.getFilter(inputSource.filter).filter, inputSource.endpoint) + var update = function () { + providers[inputSource.provider].getDataFromInputSource([], inputSource, keys, {count: isCount}) .then(function (newData) { - sharedData[source] = newData; - notifyListeners(source); + data[listenerKey].value = newData; + notifyListeners(listenerKey); }, function (error) { throw new Error('getTableData : Query failed' + error); }); }; - - templateManager.addInterval(providers[source]); - providers[source](); + update(); + templateManager.addInterval(isGlobal, update); } else { - listeners[source].push(onChange); + if (isGlobal) { + data[listenerKey].isGlobal = true; + } + data[listenerKey].onChange.push(onChange); + notifyListeners(listenerKey); } - return sharedData[source]; + return data[listenerKey].value; } }; }]); diff --git a/app/components/surveil/config.js b/app/components/surveil/config.js index f069b6c..7055111 100644 --- a/app/components/surveil/config.js +++ b/app/components/surveil/config.js @@ -29,21 +29,21 @@ angular.module('bansho.surveil') return promise.promise; }; + // All the valid endpoint with their var validEndpoint = { - "businessimpactmodulations": true, - "checkmodulations": true, - "commands": true, - "contacts": true, - "contactgroups": true, - "hosts": true, - "hostgroups": true, - "macromodulations": true, - "notificationways": true, - "realms": true, - "services": true, - "servicegroups": true, - "timeperiods": true - + "businessimpactmodulations": "business_impact_modulation_name", + "checkmodulations": "checkmodulation_name", + "commands": "command_name", + "contacts": "contact_name", + "contactgroups": "contact_group_name", + "hosts": "host_name", + "hostgroups": "hostgroup_name", + "macromodulations": "macromodulations_name", + "notificationways": "notificationway_name", + "realms": "realm_name", + "services": "service_description", + "servicegroups": "servicegroup_name", + "timeperiods": "timeperiods_name" }; var queryEndpoint = function (endpoint, fields, filters, paging, callback) { @@ -65,113 +65,39 @@ angular.module('bansho.surveil') return { getData: getData, - getBusinessImpactModulation: function (businessimpactmodulationName) { - var promise = $q.defer(), query = {"businessimpactmodulations": {"is": {"business_impact_modulation_name": [ businessimpactmodulationName ] } } }; - getData([], query, "businessimpactmodulations") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getCheckModulation: function (checkmodulationName) { - var promise = $q.defer(), query = {"checkmodulations": {"is": {"checkmodulation_name": [ checkmodulationName ] } } }; - getData([], query, "checkmodulations") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getCommand: function (commandName) { - var promise = $q.defer(), query = {"commands": {"is": {"command_name": [ commandName ] } } }; - getData([], query, "commands") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getContactGroup: function (contactgroupName) { - var promise = $q.defer(), query = {"contactgroups": {"is": {"contactgroup_name": [ contactgroupName ] } } }; - getData([], query, "contactgroups") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getContact: function (contactName) { - var promise = $q.defer(), query = {"contacts": {"is": {"contact_name": [ contactName ] } } }; - getData([], query, "contacts") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getHost: function (hostName) { - var promise = $q.defer(), query = {"hosts": {"is": {"host_name": [ hostName ] } } }; - getData([], query, "hosts") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getHostGroup: function (hostgroupName) { - var promise = $q.defer(), query = {"hostgroups": {"is": {"hostgroup_name": [ hostgroupName ] } } }; - getData([], query, "hostgroups") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getMacroModulationName: function (macromodulationName) { - var promise = $q.defer(), query = {"macromodulations": {"is": {"macromodulation_name": [ macromodulationName ] } } }; - getData([], query, "macromodulations") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getNotificationWay: function (notificationwayName) { - var promise = $q.defer(), query = {"notificationways": {"is": {"notificationway_name": [notificationwayName] } } }; - getData([], query, "notificationways") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getRealm: function (realmName) { - var promise = $q.defer(), query = {"realms": {"is": {"realm_name": [realmName] } } }; - getData([], query, "realms") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getServiceGroup: function (servicegroupName) { - var promise = $q.defer(), query = {"servicegroups": {"is": {"servicegroup_name": [servicegroupName] } } }; - getData([], query, "servicegroups") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getService: function (hostname, serviceDescription) { - var promise = $q.defer(), query = { "hosts": { "is": { "host_name": [hostname] } }, "services": {"is": {"host_name": [hostname] } } }; + getDataFromInputSource: function (fields, inputSource, keys, operations, paging) { + // Todo merge filter function + var promise = $q.defer(), + filter = componentsConfig.getFilter(inputSource.filter).filter, + endpoint = inputSource.endpoint; - if (serviceDescription) { - query.services = { "is": { "service_description": [ serviceDescription ] } }; + if (endpoint === "services" && + keys && keys.host_name) { + filter = { + "hosts": {"is": {"host_name": [keys.host_name]}}, + "services": {"is": {"host_name": [keys.host_name]}} + }; + + if (keys.service_description) { + filter.services.is.service_description = [keys.service_description]; + } + } else if (keys && keys[validEndpoint[endpoint]]) { + var key = validEndpoint[endpoint], + value = keys[key]; + + filter = {}; + filter[endpoint] = {"is": {}}; + filter[endpoint].is[key] = [value]; } - getData([], query, "services") - .then(function (data) { + queryEndpoint(endpoint, fields, filter, paging, function (data) { + if (operations && operations.count) { + promise.resolve(data.length); + } else { promise.resolve(data); - }); - return promise.promise; - }, - getTimePeriod: function (timeperiodName) { - var promise = $q.defer(), query = {"timeperiods": {"is": {"timeperiod_name": [timeperiodName] } } }; - getData([], query, "timeperiods") - .then(function (data) { - promise.resolve(data); - }); + } + }); + return promise.promise; } }; diff --git a/app/components/surveil/status.js b/app/components/surveil/status.js index d7ae25d..d48a909 100644 --- a/app/components/surveil/status.js +++ b/app/components/surveil/status.js @@ -58,20 +58,6 @@ angular.module('bansho.surveil') }); }; - var getData = function (fields, filters, endpoint, paging) { - var promise = $q.defer(); - - if (!queryEndpoint[endpoint]) { - throw new Error('getData in surveilStatus : Invalid endpoint ' + endpoint); - } - - queryEndpoint[endpoint](fields, filters, paging, function (data) { - promise.resolve(data); - }); - - return promise.promise; - }; - var queryHostsServices = function (fields, filters, paging, callback) { var hostQuery = surveilQuery(fields, filters.hosts, paging), serviceQuery = surveilQuery(fields, filters.services, paging); @@ -158,83 +144,50 @@ angular.module('bansho.surveil') } }; - return { - getData: getData, - getHost: function (hostname) { - var promise = $q.defer(), query = {"hosts": {"is": {"host_name": [ hostname ] } } }; - getData([], query, "hosts") - .then(function (data) { - promise.resolve(data); - }); - return promise.promise; - }, - getNbHosts: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("all").filter, "hosts") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getNbHostOpenProblems: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allHostOpenProblems").filter, "hosts") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getNbHostsProblems: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allHostsProblems").filter, "hosts") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getService: function (hostname, serviceDescription) { - var promise = $q.defer(), query = { "hosts": { "is": { "host_name": [hostname] } }, "services": {"is": {"host_name": [hostname] } } }; + var validEndpoint = { + "events": "event_name", + "hosts": "host_name", + "services": "service_description" + }; - if (serviceDescription) { - query.services = { "is": { "service_description": [ serviceDescription ] } }; + return { + getDataFromInputSource: function (fields, inputSource, keys, operations, paging) { + // Todo merge filter function + var promise = $q.defer(), + filter = componentsConfig.getFilter(inputSource.filter).filter, + endpoint = inputSource.endpoint; + + if (endpoint === "services" && + keys && keys.host_name) { + filter = { + "hosts": {"is": {"host_name": [keys.host_name]}}, + "services": {"is": {"host_name": [keys.host_name]}} + }; + + if (keys.service_description) { + filter.services.is.service_description = [keys.service_description]; + } + } else if (keys && keys[validEndpoint[endpoint]]) { + var key = validEndpoint[endpoint], + value = keys[key]; + + filter = {}; + filter[endpoint] = {"is": {}}; + filter[endpoint].is[key] = [value]; } - getData([], query, "services") - .then(function (data) { + if (!queryEndpoint[endpoint]) { + throw new Error('getData in surveilStatus : Invalid endpoint ' + endpoint); + } + + queryEndpoint[endpoint](fields, filter, paging, function (data) { + if (operations && operations.count) { + promise.resolve(data.length); + } else { promise.resolve(data); - }); - return promise.promise; - }, - getNbServices: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allServices").filter, "services") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getNbServiceOpenProblems: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allServiceOpenProblems").filter, "services") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getNbServiceOpenProblemsOnly: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allServiceOpenProblemsOnly").filter, "services") - .then(function (data) { - promise.resolve(data.length); - }); - return promise.promise; - }, - getNbServicesProblems: function () { - var promise = $q.defer(); - getData([], componentsConfig.getFilter("allServicesProblems").filter, "services") - .then(function (data) { - promise.resolve(data.length); - }); + } + }); + return promise.promise; }, getHostMetric: function (host, metric) { diff --git a/app/components/topbar/topbar.html b/app/components/topbar/topbar.html index 5cae0e9..ea3b96c 100644 --- a/app/components/topbar/topbar.html +++ b/app/components/topbar/topbar.html @@ -20,7 +20,7 @@ aria-expanded="true" aria-controls="notificationsPanel"> Voir les notifications - +
diff --git a/app/components/topbar/topbar.js b/app/components/topbar/topbar.js index a986b7a..f734ab6 100644 --- a/app/components/topbar/topbar.js +++ b/app/components/topbar/topbar.js @@ -21,8 +21,14 @@ angular.module('bansho.topbar', ['bansho.surveil']) }; authService.registerOnLogin(function () { - $scope.allProblems = sharedData.getData('nbServicesHostsOpenProblems', function (data) { - $scope.allProblems = data; + $scope.nbHosts = sharedData.getDataFromInputSource('statusHostsOpenProblems', true, null, true, function (nbHosts) { + $scope.nbHosts = nbHosts; + $scope.allProblems = $scope.nbServices + $scope.nbHosts; + }); + + sharedData.getDataFromInputSource('statusServicesOpenProblems', true, null, true, function (nbServices) { + $scope.nbServices = nbServices; + $scope.allProblems = $scope.nbServices + $scope.nbHosts; }); $scope.components = configManager.getConfigData('topbar').components; diff --git a/app/index.html b/app/index.html index 4f9e7bb..1f5ea5d 100644 --- a/app/index.html +++ b/app/index.html @@ -5,7 +5,7 @@ - + @@ -95,18 +95,17 @@ - - - - - - - - - - - - + + + + + + + + + + + diff --git a/app/templates/template.js b/app/templates/template.js index 68f8fd7..bf1a1df 100644 --- a/app/templates/template.js +++ b/app/templates/template.js @@ -18,19 +18,24 @@ angular.module('bansho.view') getLayoutComponents: function () { return layout.components; }, - addInterval: function (callback) { + addInterval: function (isGlobal, callback) { if (refreshInterval !== NO_REFRESH) { - intervals.push($interval(callback, refreshInterval * 1000)); + intervals.push({isGlobal: isGlobal, interval: $interval(callback, refreshInterval * 1000)}); } }, - clearIntervals: function () { + clearIntervals: function (isGlobalCleared) { angular.forEach(intervals, function (i) { - $interval.cancel(i); + if (!isGlobalCleared && !i.isGlobal || isGlobalCleared) { + $interval.cancel(i.interval); + } }); }, setPageParam: function (key, value) { pageParam[key] = value; }, + getAllPageParams: function () { + return pageParam; + }, getPageParam: function (key) { if (pageParam[key] === undefined) { throw new Error("ERROR :'" + key + "' GET parameter must be set in url");