Merge "Add all config object page"

This commit is contained in:
Jenkins 2015-08-19 14:34:08 +00:00 committed by Gerrit Code Review
commit 707ecabddb
7 changed files with 1575 additions and 63 deletions

View File

@ -273,6 +273,11 @@
"endpoint": "services",
"filter": "all"
},
"configServices": {
"provider": "config",
"endpoint": "services",
"filter": "all"
},
"hostsConfig": {
"provider": "config",
"endpoint": "hosts",
@ -287,6 +292,56 @@
"provider": "config",
"endpoint": "commands",
"filter": "all"
},
"businessimpactmodulations": {
"provider": "config",
"endpoint": "businessimpactmodulations",
"filter": "all"
},
"checkmodulations": {
"provider": "config",
"endpoint": "checkmodulations",
"filter": "all"
},
"contactgroups": {
"provider": "config",
"endpoint": "contactgroups",
"filter": "all"
},
"contacts": {
"provider": "config",
"endpoint": "contacts",
"filter": "all"
},
"hostgroups": {
"provider": "config",
"endpoint": "hostgroups",
"filter": "all"
},
"macromodulations": {
"provider": "config",
"endpoint": "macromodulations",
"filter": "all"
},
"notificationways": {
"provider": "config",
"endpoint": "notificationways",
"filter": "all"
},
"realms": {
"provider": "config",
"endpoint": "realms",
"filter": "all"
},
"servicegroups": {
"provider": "config",
"endpoint": "servicegroups",
"filter": "all"
},
"timeperiods": {
"provider": "config",
"endpoint": "timeperiods",
"filter": "all"
}
}
}

View File

@ -2,7 +2,7 @@
"env": "production",
"username":"",
"password":"",
"useStoredConfig": true,
"useStoredConfig": false,
"surveilApiUrl": "surveil/v2",
"surveilAuthUrl": "surveil/v2/auth",
"refreshInterval": -1

File diff suppressed because it is too large Load Diff

View File

@ -10,9 +10,7 @@ angular.module('bansho.container', [])
templateUrl: 'components/directive/container/container.html',
controller: ['$scope', 'templateManager', 'surveilStatus', 'surveilConfig', 'iframeUrl',
function ($scope, templateManager, surveilStatus, surveilConfig, iframeUrl) {
$scope.param = {
//host: {}
};
$scope.param = { };
$scope.addDirectiveParamRequirements = function (param) {
if ($scope.param[param] === undefined) {
@ -21,16 +19,83 @@ angular.module('bansho.container', [])
};
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 () {
console.log('Hey, listen!')
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];
});
},
"command": function () {
"configCommand": function () {
surveilConfig.getCommand(templateManager.getPageParam('command_name'))
.then(function (data) {
$scope.param.command = data[0];
$scope.param.configCommand = data[0];
});
},
"host": function () {
@ -69,6 +134,8 @@ angular.module('bansho.container', [])
var hostname = templateManager.getPageParam('host_name'),
serviceDescription = templateManager.getPageParam('service_description');
console.log('hostname ')
console.log(hostname)
surveilStatus.getService(hostname, serviceDescription).then(function (data) {
$scope.param.service = data[0];
surveilStatus.getServiceMetricNames(hostname, serviceDescription).then(function(metric_names) {

View File

@ -236,12 +236,14 @@ angular.module('bansho.table', ['bansho.datasource',
function calculateThreshold() {
// Get YThreshold
staticHeadYOffset = $(staticHead).position().top;
if (actionBar) {
yThreshold = Math.min(staticActionBarYOffset, staticHeadYOffset);
}
else {
yThreshold = staticHeadYOffset;
if ($(staticHead) && $(staticHead).position()) {
staticHeadYOffset = $(staticHead).position().top;
if (actionBar) {
yThreshold = Math.min(staticActionBarYOffset, staticHeadYOffset);
}
else {
yThreshold = staticHeadYOffset;
}
}
}

View File

@ -39,7 +39,15 @@
<ul class="sidebar__sublist collapse in" id="configList">
<li class="sidebar__subitem"><a href="#/view?view=configHosts">Host</a></li>
<li class="sidebar__subitem"><a href="#/view?view=configHostsTemplate">Templates</a></li>
<li class="sidebar__subitem"><a href="#/view?view=configServices">Services</a></li>
<li class="sidebar__subitem"><a href="#/view?view=commands">Commands</a></li>
<li class="sidebar__subitem"><a href="#/view?view=businessimpactmodulations">BusinessImpactModulation</a></li>
<li class="sidebar__subitem"><a href="#/view?view=checkmodulations">CheckModulation</a></li>
<li class="sidebar__subitem"><a href="#/view?view=contacts">Contacts</a></li>
<li class="sidebar__subitem"><a href="#/view?view=macromodulations">Macromodulation</a></li>
<li class="sidebar__subitem"><a href="#/view?view=notificationways">Notification Way</a></li>
<li class="sidebar__subitem"><a href="#/view?view=realms">Realm</a></li>
<li class="sidebar__subitem"><a href="#/view?view=timeperiods">Time periods</a></li>
</ul>
</li>
<li class="sidebar__item">
@ -70,9 +78,9 @@
</button>
<ul class="sidebar__sublist collapse in" id="groupsList">
<li class="sidebar__subitem"><a href="#">Hostgroups</a></li>
<li class="sidebar__subitem"><a href="#">Servicegroups</a></li>
<li class="sidebar__subitem"><a href="#">Contactgroups</a></li>
<li class="sidebar__subitem"><a href="#/view?view=hostgroups">Host groups</a></li>
<li class="sidebar__subitem"><a href="#/view?view=servicegroups">Service Groups</a></li>
<li class="sidebar__subitem"><a href="#/view?view=contactgroups">Contact Groups</a></li>
</ul>
</li>
<li class="sidebar__item">

View File

@ -30,8 +30,20 @@ angular.module('bansho.surveil')
};
var validEndpoint = {
"businessimpactmodulations": true,
"checkmodulations": true,
"commands": true,
"contacts": true,
"contactgroups": true,
"hosts": true,
"commands": true
"hostgroups": true,
"macromodulations": true,
"notificationways": true,
"realms": true,
"services": true,
"servicegroups": true,
"timeperiods": true
};
var queryEndpoint = function (endpoint, fields, filters, paging, callback) {
@ -53,9 +65,17 @@ angular.module('bansho.surveil')
return {
getData: getData,
getHost: function (hostname) {
var promise = $q.defer(), query = {"hosts": {"is": {"host_name": [ hostname ] } } };
getData([], query, "hosts")
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);
});
@ -68,6 +88,91 @@ angular.module('bansho.surveil')
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) {
query.services = { "is": { "service_description": [ serviceDescription ] } };
}
getData([], query, "services")
.then(function (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;
}
};
}]);