Clean config.js and remove container

Change-Id: Ieeb6980232c02ec72a6a0caa707dddbacb008a6f
This commit is contained in:
Vincent Fournier 2015-08-25 00:38:01 -04:00
parent 5d87fdaacd
commit 844d9e0e6e
58 changed files with 579 additions and 953 deletions

View File

@ -26,11 +26,12 @@ angular.module('bansho', [
}]) }])
// Reinitialise objects on url change // Reinitialise objects on url change
.run(['$rootScope', 'templateManager', 'reinitDrupalTiles', 'reinitDrupalInfo', 'componentsConfig', .run(['$rootScope', 'templateManager', 'sharedData', 'reinitDrupalTiles', 'reinitDrupalInfo', 'componentsConfig',
function ($rootScope, templateManager, reinitDrupalTiles, reinitDrupalInfo, componentsConfig) { function ($rootScope, templateManager, sharedData, reinitDrupalTiles, reinitDrupalInfo, componentsConfig) {
componentsConfig.load(); componentsConfig.load();
$rootScope.$on('$locationChangeStart', function () { $rootScope.$on('$locationChangeStart', function () {
templateManager.clearIntervals(); sharedData.clear(false);
templateManager.clearIntervals(false);
reinitDrupalTiles(); reinitDrupalTiles();
reinitDrupalInfo(); reinitDrupalInfo();
}); });

View File

@ -204,7 +204,7 @@
"hosts": { "hosts": {
"is": { "is": {
"register": [ "register": [
"0" "0"
] ]
} }
} }
@ -216,11 +216,11 @@
"hosts": { "hosts": {
"isnot": { "isnot": {
"register": [ "register": [
"0" "0"
] ]
} }
} }
} }
}, },
"all": { "all": {
"name": "All", "name": "All",
@ -233,42 +233,42 @@
} }
}, },
"inputSource": { "inputSource": {
"hostOpenProblems": { "statusHostsOpenProblems": {
"provider": "status", "provider": "status",
"endpoint": "hosts", "endpoint": "hosts",
"filter": "allHostOpenProblems" "filter": "allHostOpenProblems"
}, },
"serviceOpenProblems": { "statusServicesOpenProblems": {
"provider": "status", "provider": "status",
"endpoint": "services", "endpoint": "services",
"filter": "allServiceOpenProblems" "filter": "allServiceOpenProblems"
}, },
"serviceOpenProblemsOnly": { "statusServicesOpenProblemsOnly": {
"provider": "status", "provider": "status",
"endpoint": "services", "endpoint": "services",
"filter": "allServiceOpenProblemsOnly" "filter": "allServiceOpenProblemsOnly"
}, },
"hostsProblems": { "statusHostsProblems": {
"provider": "status", "provider": "status",
"endpoint": "hosts", "endpoint": "hosts",
"filter": "allHostsProblems" "filter": "allHostsProblems"
}, },
"servicesProblems": { "statusServicesProblems": {
"provider": "status", "provider": "status",
"endpoint": "services", "endpoint": "services",
"filter": "allServicesProblems" "filter": "allServicesProblems"
}, },
"events": { "statusEvents": {
"provider": "status", "provider": "status",
"endpoint": "events", "endpoint": "events",
"filter": "all" "filter": "all"
}, },
"hosts": { "statusHosts": {
"provider": "status", "provider": "status",
"endpoint": "hosts", "endpoint": "hosts",
"filter": "all" "filter": "all"
}, },
"services": { "statusServices": {
"provider": "status", "provider": "status",
"endpoint": "services", "endpoint": "services",
"filter": "all" "filter": "all"
@ -278,67 +278,67 @@
"endpoint": "services", "endpoint": "services",
"filter": "all" "filter": "all"
}, },
"hostsConfig": { "configHost": {
"provider": "config", "provider": "config",
"endpoint": "hosts", "endpoint": "hosts",
"filter": "allHostConfigWithoutTemplate" "filter": "allHostConfigWithoutTemplate"
}, },
"hostsConfigTemplate": { "configHostTemplate": {
"provider": "config", "provider": "config",
"endpoint": "hosts", "endpoint": "hosts",
"filter": "allHostConfigTemplate" "filter": "allHostConfigTemplate"
}, },
"commands": { "configCommands": {
"provider": "config", "provider": "config",
"endpoint": "commands", "endpoint": "commands",
"filter": "all" "filter": "all"
}, },
"businessImpactModulations": { "configBusinessImpactModulations": {
"provider": "config", "provider": "config",
"endpoint": "businessimpactmodulations", "endpoint": "businessimpactmodulations",
"filter": "all" "filter": "all"
}, },
"checkModulations": { "configCheckModulations": {
"provider": "config", "provider": "config",
"endpoint": "checkmodulations", "endpoint": "checkmodulations",
"filter": "all" "filter": "all"
}, },
"contactGroups": { "configContactGroups": {
"provider": "config", "provider": "config",
"endpoint": "contactgroups", "endpoint": "contactgroups",
"filter": "all" "filter": "all"
}, },
"contacts": { "configContacts": {
"provider": "config", "provider": "config",
"endpoint": "contacts", "endpoint": "contacts",
"filter": "all" "filter": "all"
}, },
"hostGroups": { "configHostGroups": {
"provider": "config", "provider": "config",
"endpoint": "hostgroups", "endpoint": "hostgroups",
"filter": "all" "filter": "all"
}, },
"macroModulations": { "configMacroModulations": {
"provider": "config", "provider": "config",
"endpoint": "macromodulations", "endpoint": "macromodulations",
"filter": "all" "filter": "all"
}, },
"notificationWays": { "configNotificationWays": {
"provider": "config", "provider": "config",
"endpoint": "notificationways", "endpoint": "notificationways",
"filter": "all" "filter": "all"
}, },
"realms": { "configRealms": {
"provider": "config", "provider": "config",
"endpoint": "realms", "endpoint": "realms",
"filter": "all" "filter": "all"
}, },
"serviceGroups": { "configServiceGroups": {
"provider": "config", "provider": "config",
"endpoint": "servicegroups", "endpoint": "servicegroups",
"filter": "all" "filter": "all"
}, },
"timePeriods": { "configTimePeriods": {
"provider": "config", "provider": "config",
"endpoint": "timeperiods", "endpoint": "timeperiods",
"filter": "all" "filter": "all"

View File

@ -12,11 +12,11 @@
"navigation": { "navigation": {
"openProblems": { "openProblems": {
"title": "Open Problems", "title": "Open Problems",
"provider": "nbServicesHostsOpenProblems" "inputSource": "statusServicesOpenProblems"
}, },
"allProblems": { "allProblems": {
"title": "All Problems", "title": "All Problems",
"provider": "nbServicesHostsProblems" "inputSource": "statusServicesOpenProblems"
} }
} }
}, },
@ -31,8 +31,8 @@
"type": "host-tree", "type": "host-tree",
"attributes": { "attributes": {
"inputSource": [ "inputSource": [
"hostOpenProblems", "statusHostsOpenProblems",
"serviceOpenProblemsOnly" "statusServicesOpenProblemsOnly"
] ]
} }
} }
@ -48,7 +48,7 @@
"type": "host-tree", "type": "host-tree",
"attributes": { "attributes": {
"inputSource": [ "inputSource": [
"servicesProblems" "statusServicesProblems"
] ]
} }
} }
@ -76,11 +76,11 @@
"navigation": { "navigation": {
"openProblems": { "openProblems": {
"title": "Open Problems", "title": "Open Problems",
"provider": "nbServicesHostsOpenProblems" "inputSource": "statusServicesOpenProblems"
}, },
"allProblems": { "allProblems": {
"title": "All Problems", "title": "All Problems",
"provider": "nbServicesHostsOpenProblemsDoubleCount" "inputSource": "statusServicesOpenProblems"
} }
} }
}, },
@ -146,14 +146,14 @@
"attributes": { "attributes": {
"title": "Open Hosts Problems", "title": "Open Hosts Problems",
"item": "host", "item": "host",
"provider": "nbHostsOpenProblems" "inputSource": "statusHostsOpenProblems"
} }
}, },
{ {
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "hostOpenProblems", "inputSource": "statusHostsOpenProblems",
"headerFollow": false, "headerFollow": false,
"isWrappable": false, "isWrappable": false,
"checkColumn": true, "checkColumn": true,
@ -208,14 +208,14 @@
"attributes": { "attributes": {
"title": "Open Service Problems", "title": "Open Service Problems",
"item": "service", "item": "service",
"provider": "nbServicesOpenProblemsOnly" "inputSource": "statusServicesOpenProblemsOnly"
} }
}, },
{ {
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 1, "datasourceId": 1,
"inputSource": "serviceOpenProblemsOnly", "inputSource": "statusServicesOpenProblemsOnly",
"headerFollow": false, "headerFollow": false,
"isWrappable": true, "isWrappable": true,
"checkColumn": true, "checkColumn": true,
@ -276,8 +276,7 @@
{ {
"type": "panel", "type": "panel",
"attributes": { "attributes": {
"panelId": "allProblems", "panelId": "allProblems"
"provider": "nbServicesHostsOpenProblems"
}, },
"components": [ "components": [
{ {
@ -335,14 +334,14 @@
"attributes": { "attributes": {
"title": "Hosts Problems", "title": "Hosts Problems",
"item": "host", "item": "host",
"provider": "nbHostsOpenProblems" "inputSource": "statusHostsProblems"
} }
}, },
{ {
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 2, "datasourceId": 2,
"inputSource": "hostsProblems", "inputSource": "statusHostsProblems",
"headerFollow": false, "headerFollow": false,
"isWrappable": false, "isWrappable": false,
"checkColumn": true, "checkColumn": true,
@ -397,14 +396,14 @@
"attributes": { "attributes": {
"title": "Services Problems", "title": "Services Problems",
"item": "service", "item": "service",
"provider": "nbServicesOpenProblems" "inputSource": "statusServicesProblems"
} }
}, },
{ {
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 3, "datasourceId": 3,
"inputSource": "servicesProblems", "inputSource": "statusServicesProblems",
"headerFollow": false, "headerFollow": false,
"isWrappable": true, "isWrappable": true,
"checkColumn": true, "checkColumn": true,
@ -531,7 +530,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "hosts", "inputSource": "statusHosts",
"headerFollow": true, "headerFollow": true,
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
@ -653,7 +652,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "services", "inputSource": "statusServices",
"headerFollow": true, "headerFollow": true,
"isWrappable": false, "isWrappable": false,
"checkColumn": true, "checkColumn": true,
@ -766,7 +765,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "events", "inputSource": "statusEvents",
"headerFollow": true, "headerFollow": true,
"isWrappable": false, "isWrappable": false,
"checkColumn": false, "checkColumn": false,
@ -835,37 +834,31 @@
"type": "panel", "type": "panel",
"components": [ "components": [
{ {
"type": "container", "type": "tile-host-main",
"components": [ "attributes": {}
{ },
"type": "host-main", {
"attributes": {} "type": "tile-host-live",
}, "attributes": {}
{ },
"type": "host-live", {
"attributes": {} "type": "tile-host-load",
}, "attributes": {}
{ },
"type": "host-load", {
"attributes": {} "type": "tile-host-cpu",
}, "attributes": {}
{ },
"type": "host-cpu", {
"attributes": {} "type": "tile-host-services-list",
}, "attributes": {}
{ },
"type": "host-services-list", {
"attributes": {} "type": "tile-info",
}, "attributes": {
{ "inputSource": "configHost",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configHost"
}
}
}
]
} }
] ]
} }
@ -955,7 +948,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "hostsConfig", "inputSource": "configHost",
"headerFollow": false, "headerFollow": false,
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
@ -1051,7 +1044,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "hostsConfigTemplate", "inputSource": "configHostTemplate",
"headerFollow": false, "headerFollow": false,
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
@ -1123,7 +1116,7 @@
"type": "table", "type": "table",
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"inputSource": "commands", "inputSource": "configCommands",
"headerFollow": true, "headerFollow": true,
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
@ -1180,17 +1173,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configCommands",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configCommand"
}
}
}
]
} }
] ]
} }
@ -1231,7 +1218,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "businessImpactModulations", "inputSource": "configBusinessImpactModulations",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1289,17 +1276,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configBusinessImpactModulations",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configBusinessImpactModulation"
}
}
}
]
} }
] ]
} }
@ -1340,7 +1321,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "checkModulations", "inputSource": "configCheckModulations",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1398,17 +1379,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configCheckModulations",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configCheckModulation"
}
}
}
]
} }
] ]
} }
@ -1449,7 +1424,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "contactGroups", "inputSource": "configContactGroups",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1529,17 +1504,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configContactGroups",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configContactGroup"
}
}
}
]
} }
] ]
} }
@ -1580,7 +1549,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "contacts", "inputSource": "configContacts",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1668,17 +1637,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configContacts",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configContact"
}
}
}
]
} }
] ]
} }
@ -1719,7 +1682,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "hostGroups", "inputSource": "configHostGroups",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1801,17 +1764,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configHostGroups",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configHostGroup"
}
}
}
]
} }
] ]
} }
@ -1852,7 +1809,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "macroModulations", "inputSource": "configMacroModulations",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -1901,17 +1858,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configMacroModulations",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configMacroModulation"
}
}
}
]
} }
] ]
} }
@ -1952,7 +1903,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "notificationWays", "inputSource": "configNotificationWays",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -2024,17 +1975,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configNotificationWays",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configNotificationWay"
}
}
}
]
} }
] ]
} }
@ -2079,7 +2024,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "realms", "inputSource": "configRealms",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -2137,17 +2082,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configRealms",
"type": "info", "title": "Command"
"attributes": { }
"inputSource": {
"Command": "configRealm"
}
}
}
]
} }
] ]
} }
@ -2188,7 +2127,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "serviceGroups", "inputSource": "configServiceGroups",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -2259,17 +2198,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "inputSource": "configServiceGroups",
"type": "info", "title": "Configuration"
"attributes": { }
"inputSource": {
"Configuration": "configServiceGroup"
}
}
}
]
} }
] ]
} }
@ -2310,7 +2243,7 @@
"attributes": { "attributes": {
"datasourceId": 0, "datasourceId": 0,
"headerFollow": true, "headerFollow": true,
"inputSource": "timePeriods", "inputSource": "configTimePeriods",
"isWrappable": false, "isWrappable": false,
"noRepeatCell": "", "noRepeatCell": "",
"checkColumn": false, "checkColumn": false,
@ -2368,17 +2301,11 @@
} }
}, },
{ {
"type": "container", "type": "tile-info",
"components": [ "attributes": {
{ "title": "Configuration",
"type": "info", "inputSource": "configTimePeriods"
"attributes": { }
"inputSource": {
"Configuration": "configTimePeriod"
}
}
}
]
} }
] ]
} }
@ -2495,33 +2422,27 @@
"type": "panel", "type": "panel",
"components": [ "components": [
{ {
"type": "container", "type": "tile-service-main",
"components": [ "attributes": {}
{ },
"type": "service-main", {
"attributes": {} "type": "tile-service-live",
}, "attributes": {}
{ },
"type": "service-live", {
"attributes": {} "type": "tile-service-info",
}, "attributes": {}
{ },
"type": "service-info", {
"attributes": {} "type": "tile-service-metrics",
}, "attributes": {}
{ },
"type": "service-graphs", {
"attributes": {} "type": "tile-info",
}, "attributes": {
{ "title": "Service configuration",
"type": "info", "inputSource": "configServices"
"attributes": { }
"inputSource": {
"Service configuration": "configService"
}
}
}
]
} }
] ]
} }

View File

@ -1,6 +0,0 @@
<article>
<section class="main__content tabpanel">
<bansho-components components="components"></bansho-components>
</section>
</article>

View File

@ -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;
}]
};
});

View File

@ -1,15 +0,0 @@
<div data-ng-show="param.host.cpu" class="subcomponent__live subcomponent__small">
<h2>Cpu</h2>
<table class="data-table">
<tbody>
<tr>
<td>State</td>
<td><bansho-service-state-icon state="param.host.cpu.state"></bansho-service-state-icon> {{param.host.cpu.state}}</td>
</tr>
<tr>
<td>Output</td>
<td>{{param.host.cpu.plugin_output}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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');
}
};
});

View File

@ -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');
}
};
});

View File

@ -1,16 +0,0 @@
<div data-ng-show="param.host.load" class="subcomponent__live subcomponent__small">
<h2>Load</h2>
<iframe src="{{param.host.load.iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
<table class="data-table">
<tbody>
<tr>
<td>State</td>
<td><bansho-service-state-icon state="param.host.load.state"></bansho-service-state-icon> {{param.host.load.state}}</td>
</tr>
<tr>
<td>Output</td>
<td>{{param.host.load.plugin_output}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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');
}
};
});

View File

@ -1,9 +0,0 @@
<div class="subcomponent__live subcomponent__title">
<header class="main__content__header clearfix">
<h1 class="main__content__title">
{{param.host.host_host_name}}
<span class="subtitle" ng-show="param.host.host_config_alias">(param.host.host_config_alias)</span>
<span class="subtitle">{{param.host.host_address}}</span>
</h1>
</header>
</div>

View File

@ -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');
}
};
});

View File

@ -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');
}
};
});

View File

@ -1,13 +0,0 @@
<span data-ng-repeat="(key, inputSource) in inputSources">
<div data-ng-show="param[inputSource]" class="subcomponent__live">
<h2>{{key}}</h2>
<table class="data-table">
<tbody data-ng-repeat="(key, value) in param[inputSource]">
<tr>
<td>{{key}}</td>
<td>{{value}}</td>
</tr>
</tbody>
</table>
</div>
</span>

View File

@ -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);
});
}
};
});

View File

@ -1,6 +0,0 @@
<div data-ng-repeat="(metric, iframeUrl) in param.service.iframeUrls" class="subcomponent__live subcomponent__small">
<h2>Graph - {{metric}}</h2>
<iframe src="{{iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
<table class="data-table">
</table>
</div>

View File

@ -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');
}
};
});

View File

@ -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');
}
};
});

View File

@ -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');
}
};
});

View File

@ -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');
}
};
});

View File

@ -1,3 +0,0 @@
<div>
<h2>Metrics</h2>
</div>

View File

@ -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');
}
};
});

View File

@ -2,12 +2,12 @@
angular.module('bansho.customDirective', [ angular.module('bansho.customDirective', [
'bansho.actionbar', 'bansho.actionbar',
'bansho.textArea',
'bansho.container',
'bansho.hostTree', 'bansho.hostTree',
'bansho.stateIcon', 'bansho.stateIcon',
'bansho.table', 'bansho.table',
'bansho.tabpanel', 'bansho.tabpanel',
'bansho.tactical', 'bansho.tactical',
'bansho.textArea',
'bansho.tile',
'bansho.title' 'bansho.title'
]); ]);

View File

@ -13,7 +13,7 @@ angular.module('bansho.hostTree', ['bansho.datasource'])
function ($scope, sharedData) { function ($scope, sharedData) {
$scope.sources = {}; $scope.sources = {};
angular.forEach($scope.options.attributes.inputSource, function (source) { 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; $scope.sources[source] = data;
}); });
}); });

View File

@ -17,7 +17,7 @@ angular.module('bansho.tabpanel', [])
}; };
angular.forEach(scope.navigation, function (panel) { 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; panel.right = data;
}); });
}); });

View File

@ -50,7 +50,7 @@ angular.module('bansho.table', ['bansho.datasource',
$scope.entries = data; $scope.entries = data;
}); });
datasource.refreshTableData($scope.datasourceId); datasource.refreshTableData($scope.datasourceId);
templateManager.addInterval(function refreshTable () { templateManager.addInterval(false, function refreshTable () {
datasource.refreshTableData($scope.datasourceId); datasource.refreshTableData($scope.datasourceId);
}); });

View File

@ -3,7 +3,6 @@
<thead> <thead>
<tr> <tr>
<th>Current health</th> <th>Current health</th>
<th>&nbsp;</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -7,12 +7,11 @@ angular.module('bansho.tactical.current_health', ['bansho.surveil',
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'components/custom_directive/tactical/current_health/current_health.html', templateUrl: 'components/custom_directive/tactical/current_health/current_health.html',
link: function (scope, element) { controller: ['$scope', '$element', function (scope, element) {
$rootScope.$watch('themeClassSize', function( sizeclass) { $rootScope.$watch('themeClassSize', function(sizeclass) {
scope.themeClassSize = sizeclass; scope.themeClassSize = sizeclass;
$compile(element.contents())(scope); //$compile(element.contents())(scope);
}); });
} }]
}; };
}]); }]);

View File

@ -21,20 +21,22 @@ angular.module('bansho.tactical', ['bansho.surveil',
$scope.currentHealth = $scope.options.attributes.currentHealth; $scope.currentHealth = $scope.options.attributes.currentHealth;
$scope.topAlertProducers = $scope.options.attributes.topAlertProducers; $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.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.hostProblems = data;
$scope.hostsRatio = ($scope.totalHosts - $scope.hostProblems) / $scope.totalHosts * 100; $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.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.serviceProblems = data;
$scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100; $scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100;
}); });

View File

@ -0,0 +1,15 @@
<div data-ng-show="cpu" class="subcomponent__live subcomponent__small">
<h2>Cpu</h2>
<table class="data-table">
<tbody>
<tr>
<td>State</td>
<td><bansho-service-state-icon state="cpu.service_state"></bansho-service-state-icon> {{cpu.service_state}}</td>
</tr>
<tr>
<td>Output</td>
<td>{{cpu.service_plugin_output}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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;
}
});
});
}]
};
});

View File

@ -4,13 +4,13 @@
<tbody> <tbody>
<tr> <tr>
<td>State</td> <td>State</td>
<td bansho-host-state-icon state="param.host.host_state"> <td bansho-host-state-icon state="host[0].host_state">
<span class="data-table__data">{{param.host.host_state}}</span> <span class="data-table__data">{{host[0].host_state}}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Output</td> <td>Output</td>
<td>{{param.host.host_plugin_output}}</td> <td>{{host[0].host_plugin_output}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -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;
});
}]
};
});

View File

@ -0,0 +1,16 @@
<div data-ng-show="load" class="subcomponent__live subcomponent__small">
<h2>Load</h2>
<iframe src="{{iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
<table class="data-table">
<tbody>
<tr>
<td>State</td>
<td><bansho-service-state-icon state="load.service_state"></bansho-service-state-icon> {{load.service_state}}</td>
</tr>
<tr>
<td>Output</td>
<td>{{load.service_plugin_output}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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");
}
});
});
}]
};
});

View File

@ -0,0 +1,9 @@
<div class="subcomponent__live subcomponent__title">
<header class="main__content__header clearfix">
<h1 class="main__content__title">
{{host[0].host_host_name}}
<span class="subtitle" data-ng-show="host[0].host_config_alias">(host[0].host_config_alias)</span>
<span class="subtitle">{{host[0].host_address}}</span>
</h1>
</header>
</div>

View File

@ -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;
});
}]
};
});

View File

@ -1,4 +1,4 @@
<div ng-show="param.host.services.length >= 1" class="subcomponent__live"> <div ng-show="services.length >= 1" class="subcomponent__live">
<h2>Services</h2> <h2>Services</h2>
<table class="data-table"> <table class="data-table">
<thead> <thead>
@ -9,7 +9,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="service in param.host.services"> <tr ng-repeat="service in services">
<td><a href="#/view?view=service&host_name={{service.service_host_name}}&service_description={{service.service_service_description}}">{{service.service_service_description}}</a> <td><a href="#/view?view=service&host_name={{service.service_host_name}}&service_description={{service.service_service_description}}">{{service.service_service_description}}</a>
<td>{{service.service_acknowledged ? "Yes" : "No"}}</td> <td>{{service.service_acknowledged ? "Yes" : "No"}}</td>
<td bansho-service-state-icon state="service.service_state"> <td bansho-service-state-icon state="service.service_state">

View File

@ -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);
}
});
});
}]
};
});

View File

@ -0,0 +1,11 @@
<div data-ng-show="data[0]" class="subcomponent__live">
<h2>{{title}}</h2>
<table class="data-table">
<tbody data-ng-repeat="(key, value) in data[0]">
<tr>
<td>{{key}}</td>
<td>{{value}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -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;
}
);
}]
};
});

View File

@ -4,15 +4,15 @@
<tbody> <tbody>
<tr> <tr>
<td>Last check</td> <td>Last check</td>
<td>{{param.service.service_last_check|timeElapsed}}</td> <td>{{service[0].service_last_check|timeElapsed}}</td>
</tr> </tr>
<tr> <tr>
<td>Last state change</td> <td>Last state change</td>
<td>{{param.service.service_last_state_change|timeElapsed}}</td> <td>{{service[0].service_last_state_change|timeElapsed}}</td>
</tr> </tr>
<tr> <tr>
<td>Acknowledged</td> <td>Acknowledged</td>
<td>{{param.service.service_acknowledged ? "Yes" : "No"}}</td> <td>{{service[0].service_acknowledged ? "Yes" : "No"}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -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;
});
}]
};
});

View File

@ -4,13 +4,13 @@
<tbody> <tbody>
<tr> <tr>
<td>State</td> <td>State</td>
<td bansho-service-state-icon state="param.service.service_state"> <td bansho-service-state-icon state="service[0].service_state">
<span class="data-table__data">{{param.service.service_state}}</span> <span class="data-table__data">{{service[0].service_state}}</span>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Output</td> <td>Output</td>
<td>{{param.service.service_plugin_output}}</td> <td>{{service[0].service_plugin_output}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -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;
});
}]
};
});

View File

@ -1,7 +1,7 @@
<div class="subcomponent__live subcomponent__title"> <div class="subcomponent__live subcomponent__title">
<h1>{{param.service.service_service_description}} <h1>{{service[0].service_service_description}}
<span class="subtitle"> <span class="subtitle">
<a class="data-table__data" href="#/view?view=host&host_name={{param.service.service_host_name}}">{{param.service.host_host_name}}</a> <a class="data-table__data" href="#/view?view=host&host_name={{service[0].service_host_name}}">{{service[0].host_host_name}}</a>
</span> </span>
</h1> </h1>
</div> </div>

View File

@ -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;
});
}]
};
});

View File

@ -0,0 +1,4 @@
<div data-ng-repeat="metric in metrics" class="subcomponent__live subcomponent__small">
<h2>Graph - {{metric.title}}</h2>
<iframe src="{{metric.iframeUrl}}" width="450" height="200" frameborder="0"></iframe>
</div>

View File

@ -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
});
});
});
}]
};
});

View File

@ -0,0 +1 @@
angular.module('bansho.tile', []);

View File

@ -11,7 +11,8 @@ angular.module('bansho.title', [])
link: function (scope) { link: function (scope) {
if (scope.options.attributes.item) { if (scope.options.attributes.item) {
scope.item = 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; scope.data = data;
}); });

View File

@ -35,7 +35,7 @@ angular.module('bansho.datasource', ['bansho.surveil'])
filter = componentsConfig.mergeFilters([config[datasourceId].queryFilter, filter]); 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) { promise.then(function (newData) {
data[datasourceId] = newData; data[datasourceId] = newData;
@ -132,112 +132,59 @@ angular.module('bansho.datasource', ['bansho.surveil'])
}; };
}]) }])
.service('sharedData', ['templateManager', 'surveilStatus', 'componentsConfig', .service('sharedData', ['templateManager', 'surveilStatus', 'surveilConfig', 'componentsConfig',
function (templateManager, surveilStatus, componentsConfig) { function (templateManager, surveilStatus, surveilConfig, componentsConfig) {
var providerServices = { var providers = {
status: surveilStatus status: surveilStatus,
config: surveilConfig
}, },
sharedData = {}, data = {};
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');
});
});
}
};
var notifyListeners = function (key) { var notifyListeners = function (key) {
angular.forEach(listeners[key], function (onChange) { angular.forEach(data[key].onChange, function (onChange) {
onChange(sharedData[key]); onChange(data[key].value);
}); });
}; };
return { return {
getData: function (key, onChange) { clear: function (isGlobalCleared) {
if (listeners[key] === undefined) { angular.forEach(data, function (datasource, key) {
listeners[key] = [onChange]; if (!isGlobalCleared && !datasource.isGlobal || isGlobalCleared) {
templateManager.addInterval(providers[key]); delete data[key];
providers[key](); }
} else { });
listeners[key].push(onChange);
}
return sharedData[key];
}, },
getDataFromInputSource: function (source, onChange) { getDataFromInputSource: function (source, isCount, keys, isGlobal, onChange) {
if (listeners[source] === undefined) { var listenerKey = source + isCount + JSON.stringify(keys);
listeners[source] = [onChange]; if (data[listenerKey] === undefined) {
data[listenerKey] = {
onChange: [onChange],
isGlobal: isGlobal,
value: null
};
var inputSource = componentsConfig.getInputSource(source); var inputSource = componentsConfig.getInputSource(source);
providers[source] = function () { var update = function () {
providerServices[inputSource.provider].getData([], componentsConfig.getFilter(inputSource.filter).filter, inputSource.endpoint) providers[inputSource.provider].getDataFromInputSource([], inputSource, keys, {count: isCount})
.then(function (newData) { .then(function (newData) {
sharedData[source] = newData; data[listenerKey].value = newData;
notifyListeners(source); notifyListeners(listenerKey);
}, function (error) { }, function (error) {
throw new Error('getTableData : Query failed' + error); throw new Error('getTableData : Query failed' + error);
}); });
}; };
update();
templateManager.addInterval(providers[source]); templateManager.addInterval(isGlobal, update);
providers[source]();
} else { } 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;
} }
}; };
}]); }]);

View File

@ -29,21 +29,21 @@ angular.module('bansho.surveil')
return promise.promise; return promise.promise;
}; };
// All the valid endpoint with their
var validEndpoint = { var validEndpoint = {
"businessimpactmodulations": true, "businessimpactmodulations": "business_impact_modulation_name",
"checkmodulations": true, "checkmodulations": "checkmodulation_name",
"commands": true, "commands": "command_name",
"contacts": true, "contacts": "contact_name",
"contactgroups": true, "contactgroups": "contact_group_name",
"hosts": true, "hosts": "host_name",
"hostgroups": true, "hostgroups": "hostgroup_name",
"macromodulations": true, "macromodulations": "macromodulations_name",
"notificationways": true, "notificationways": "notificationway_name",
"realms": true, "realms": "realm_name",
"services": true, "services": "service_description",
"servicegroups": true, "servicegroups": "servicegroup_name",
"timeperiods": true "timeperiods": "timeperiods_name"
}; };
var queryEndpoint = function (endpoint, fields, filters, paging, callback) { var queryEndpoint = function (endpoint, fields, filters, paging, callback) {
@ -65,113 +65,39 @@ angular.module('bansho.surveil')
return { return {
getData: getData, getData: getData,
getBusinessImpactModulation: function (businessimpactmodulationName) { getDataFromInputSource: function (fields, inputSource, keys, operations, paging) {
var promise = $q.defer(), query = {"businessimpactmodulations": {"is": {"business_impact_modulation_name": [ businessimpactmodulationName ] } } }; // Todo merge filter function
getData([], query, "businessimpactmodulations") var promise = $q.defer(),
.then(function (data) { filter = componentsConfig.getFilter(inputSource.filter).filter,
promise.resolve(data); endpoint = inputSource.endpoint;
});
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] } } };
if (serviceDescription) { if (endpoint === "services" &&
query.services = { "is": { "service_description": [ serviceDescription ] } }; 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") queryEndpoint(endpoint, fields, filter, paging, function (data) {
.then(function (data) { if (operations && operations.count) {
promise.resolve(data.length);
} else {
promise.resolve(data); 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; return promise.promise;
} }
}; };

View File

@ -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 queryHostsServices = function (fields, filters, paging, callback) {
var hostQuery = surveilQuery(fields, filters.hosts, paging), var hostQuery = surveilQuery(fields, filters.hosts, paging),
serviceQuery = surveilQuery(fields, filters.services, paging); serviceQuery = surveilQuery(fields, filters.services, paging);
@ -158,83 +144,50 @@ angular.module('bansho.surveil')
} }
}; };
return { var validEndpoint = {
getData: getData, "events": "event_name",
getHost: function (hostname) { "hosts": "host_name",
var promise = $q.defer(), query = {"hosts": {"is": {"host_name": [ hostname ] } } }; "services": "service_description"
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] } } };
if (serviceDescription) { return {
query.services = { "is": { "service_description": [ serviceDescription ] } }; 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") if (!queryEndpoint[endpoint]) {
.then(function (data) { 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); 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; return promise.promise;
}, },
getHostMetric: function (host, metric) { getHostMetric: function (host, metric) {

View File

@ -20,7 +20,7 @@
aria-expanded="true" aria-expanded="true"
aria-controls="notificationsPanel"> aria-controls="notificationsPanel">
<span class="visuallyhidden">Voir les notifications</span> <span class="visuallyhidden">Voir les notifications</span>
<i class="ico-bell-alt" data-notifications="{{allProblems}}"></i> <i class="ico-bell-alt" data-notifications="{{nbServices + nbHosts}}"></i>
</button> </button>
<div class="topbar__panel--fromleft collapse" id="notificationsPanel"> <div class="topbar__panel--fromleft collapse" id="notificationsPanel">

View File

@ -21,8 +21,14 @@ angular.module('bansho.topbar', ['bansho.surveil'])
}; };
authService.registerOnLogin(function () { authService.registerOnLogin(function () {
$scope.allProblems = sharedData.getData('nbServicesHostsOpenProblems', function (data) { $scope.nbHosts = sharedData.getDataFromInputSource('statusHostsOpenProblems', true, null, true, function (nbHosts) {
$scope.allProblems = data; $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; $scope.components = configManager.getConfigData('topbar').components;

View File

@ -5,7 +5,7 @@
<!--[if gt IE 8]><!--> <html lang="en" class="no-js"> <!--<![endif]--> <!--[if gt IE 8]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge/>
<title>Bansho</title> <title>Bansho</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700,400italic' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Roboto:400,700,400italic' rel='stylesheet' type='text/css'>
@ -95,18 +95,17 @@
<script src="components/custom_directive/tactical/current_health/current_health.js"></script> <script src="components/custom_directive/tactical/current_health/current_health.js"></script>
<script src="components/custom_directive/tactical/top_alert_producers/top_alert_producers.js"></script> <script src="components/custom_directive/tactical/top_alert_producers/top_alert_producers.js"></script>
<script src="components/custom_directive/container/container.js"></script> <script src="components/custom_directive/tile/tile.js"></script>
<script src="components/custom_directive/container/info/info.js"></script> <script src="components/custom_directive/tile/info/info.js"></script>
<script src="components/custom_directive/container/host_cpu/host_cpu.js"></script> <script src="components/custom_directive/tile/host_cpu/host_cpu.js"></script>
<script src="components/custom_directive/container/host_load/host_load.js"></script> <script src="components/custom_directive/tile/host_load/host_load.js"></script>
<script src="components/custom_directive/container/host_main/host_main.js"></script> <script src="components/custom_directive/tile/host_main/host_main.js"></script>
<script src="components/custom_directive/container/host_live/host_live.js"></script> <script src="components/custom_directive/tile/host_live/host_live.js"></script>
<script src="components/custom_directive/container/host_services_list/host_services_list.js"></script> <script src="components/custom_directive/tile/host_services_list/host_services_list.js"></script>
<script src="components/custom_directive/container/service_main/service_main.js"></script> <script src="components/custom_directive/tile/service_main/service_main.js"></script>
<script src="components/custom_directive/container/service_live/service_live.js"></script> <script src="components/custom_directive/tile/service_live/service_live.js"></script>
<script src="components/custom_directive/container/service_info/service_info.js"></script> <script src="components/custom_directive/tile/service_info/service_info.js"></script>
<script src="components/custom_directive/container/service_graphs/service_graphs.js"></script> <script src="components/custom_directive/tile/service_metrics/service_metrics.js"></script>
<script src="components/custom_directive/container/service_metrics/service_metrics.js"></script>
<script src="components/custom_directive/actionbar/actionbar.js"></script> <script src="components/custom_directive/actionbar/actionbar.js"></script>
<script src="components/custom_directive/actionbar/component_acknowledge/acknowledge.js"></script> <script src="components/custom_directive/actionbar/component_acknowledge/acknowledge.js"></script>

View File

@ -18,19 +18,24 @@ angular.module('bansho.view')
getLayoutComponents: function () { getLayoutComponents: function () {
return layout.components; return layout.components;
}, },
addInterval: function (callback) { addInterval: function (isGlobal, callback) {
if (refreshInterval !== NO_REFRESH) { 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) { angular.forEach(intervals, function (i) {
$interval.cancel(i); if (!isGlobalCleared && !i.isGlobal || isGlobalCleared) {
$interval.cancel(i.interval);
}
}); });
}, },
setPageParam: function (key, value) { setPageParam: function (key, value) {
pageParam[key] = value; pageParam[key] = value;
}, },
getAllPageParams: function () {
return pageParam;
},
getPageParam: function (key) { getPageParam: function (key) {
if (pageParam[key] === undefined) { if (pageParam[key] === undefined) {
throw new Error("ERROR :'" + key + "' GET parameter must be set in url"); throw new Error("ERROR :'" + key + "' GET parameter must be set in url");