Service view uses adg-service
This commit is contained in:
parent
f3eb0fa831
commit
fff43cd26f
12
Gruntfile.js
12
Gruntfile.js
@ -115,10 +115,12 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.app %>/components/host/host_load/host_load.js',
|
'<%= project.app %>/components/host/host_load/host_load.js',
|
||||||
'<%= project.app %>/components/host/host_main/host_main.js',
|
'<%= project.app %>/components/host/host_main/host_main.js',
|
||||||
'<%= project.app %>/components/host/host_services_list/host_services_list.js',
|
'<%= project.app %>/components/host/host_services_list/host_services_list.js',
|
||||||
|
'<%= project.app %>/components/service/service.js',
|
||||||
'<%= project.app %>/routing_view/routing_view.js',
|
'<%= project.app %>/routing_view/routing_view.js',
|
||||||
'<%= project.app %>/templates/dashboard/dashboard.js',
|
'<%= project.app %>/templates/dashboard/dashboard.js',
|
||||||
'<%= project.app %>/templates/single_table/single_table.js',
|
'<%= project.app %>/templates/single_table/single_table.js',
|
||||||
'<%= project.app %>/templates/host/host.js'
|
'<%= project.app %>/templates/host/host.js',
|
||||||
|
'<%= project.app %>/templates/service/service.js'
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
options: {
|
options: {
|
||||||
@ -157,11 +159,13 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.build %>/components/host/host_load/host_load.js': '<%= project.app %>/components/host/host_load/host_load.js',
|
'<%= project.build %>/components/host/host_load/host_load.js': '<%= project.app %>/components/host/host_load/host_load.js',
|
||||||
'<%= project.build %>/components/host/host_main/host_main.js': '<%= project.app %>/components/host/host_main/host_main.js',
|
'<%= project.build %>/components/host/host_main/host_main.js': '<%= project.app %>/components/host/host_main/host_main.js',
|
||||||
'<%= project.build %>/components/host/host_services_list/host_services_list.js': '<%= project.app %>/components/host/host_services_list/host_services_list.js',
|
'<%= project.build %>/components/host/host_services_list/host_services_list.js': '<%= project.app %>/components/host/host_services_list/host_services_list.js',
|
||||||
|
'<%= project.build %>/components/service/service.js': '<%= project.app %>/components/service/service.js',
|
||||||
|
|
||||||
'<%= project.build %>/routing_view/routing_view.js': '<%= project.app %>/routing_view/routing_view.js',
|
'<%= project.build %>/routing_view/routing_view.js': '<%= project.app %>/routing_view/routing_view.js',
|
||||||
'<%= project.build %>/templates/dashboard/dashboard.js': '<%= project.app %>/templates/dashboard/dashboard.js',
|
'<%= project.build %>/templates/dashboard/dashboard.js': '<%= project.app %>/templates/dashboard/dashboard.js',
|
||||||
'<%= project.build %>/templates/single_table/single_table.js' : '<%= project.app %>/templates/single_table/single_table.js',
|
'<%= project.build %>/templates/single_table/single_table.js' : '<%= project.app %>/templates/single_table/single_table.js',
|
||||||
'<%= project.build %>/templates/host/host.js' : '<%= project.app %>/templates/host/host.js'
|
'<%= project.build %>/templates/host/host.js': '<%= project.app %>/templates/host/host.js',
|
||||||
|
'<%= project.build %>/templates/service/service.js': '<%= project.app %>/templates/service/service.js'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<%= project.build %>/js/adagios.min.js' : [
|
'<%= project.build %>/js/adagios.min.js' : [
|
||||||
@ -193,10 +197,12 @@ module.exports = function (grunt) {
|
|||||||
'<%= project.build %>/components/host/host_load/host_load.js',
|
'<%= project.build %>/components/host/host_load/host_load.js',
|
||||||
'<%= project.build %>/components/host/host_main/host_main.js',
|
'<%= project.build %>/components/host/host_main/host_main.js',
|
||||||
'<%= project.build %>/components/host/host_services_list/host_services_list.js',
|
'<%= project.build %>/components/host/host_services_list/host_services_list.js',
|
||||||
|
'<%= project.build %>/components/service/service.js',
|
||||||
'<%= project.build %>/routing_view/routing_view.js',
|
'<%= project.build %>/routing_view/routing_view.js',
|
||||||
'<%= project.build %>/templates/dashboard/dashboard.js',
|
'<%= project.build %>/templates/dashboard/dashboard.js',
|
||||||
'<%= project.build %>/templates/single_table/single_table.js',
|
'<%= project.build %>/templates/single_table/single_table.js',
|
||||||
'<%= project.build %>/templates/host/host.js'
|
'<%= project.build %>/templates/host/host.js',
|
||||||
|
'<%= project.build %>/templates/service/service.js'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -19,10 +19,12 @@ angular.module('adagios', [
|
|||||||
'adagios.topbar',
|
'adagios.topbar',
|
||||||
'adagios.sidebar',
|
'adagios.sidebar',
|
||||||
'adagios.host',
|
'adagios.host',
|
||||||
|
'adagios.service',
|
||||||
'adagios.view',
|
'adagios.view',
|
||||||
'adagios.view.dashboard',
|
'adagios.view.dashboard',
|
||||||
'adagios.view.singleTable',
|
'adagios.view.singleTable',
|
||||||
'adagios.view.host'
|
'adagios.view.host',
|
||||||
|
'adagios.view.service'
|
||||||
])
|
])
|
||||||
|
|
||||||
.config(['$routeProvider', function ($routeProvider) {
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
@ -210,5 +210,10 @@
|
|||||||
"title": "Host",
|
"title": "Host",
|
||||||
"refreshInterval": 0,
|
"refreshInterval": 0,
|
||||||
"template": "host"
|
"template": "host"
|
||||||
|
},
|
||||||
|
"service": {
|
||||||
|
"title": "Service",
|
||||||
|
"refreshInterval": 0,
|
||||||
|
"template": "service"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,16 @@ angular.module('adagios.live')
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
.service('getService', ['$http',
|
||||||
|
function ($http) {
|
||||||
|
return function (hostName, description) {
|
||||||
|
return $http.get('/rest/status/json/services/?host_name=' + hostName + '&description=' + description)
|
||||||
|
.error(function () {
|
||||||
|
throw new Error('getService : GET Request failed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
// This service is used to count the number of host open problems
|
// This service is used to count the number of host open problems
|
||||||
.service('getHostOpenProblems', ['$http', 'getObjects',
|
.service('getHostOpenProblems', ['$http', 'getObjects',
|
||||||
function ($http, getObjects) {
|
function ($http, getObjects) {
|
||||||
|
5
app/components/service/service.html
Normal file
5
app/components/service/service.html
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<article ng-controller="ServiceCtrl">
|
||||||
|
<section class="main__content tabpanel">
|
||||||
|
<h2>{{data}}</h2>
|
||||||
|
</section>
|
||||||
|
</article>
|
46
app/components/service/service.js
Normal file
46
app/components/service/service.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('adagios.service', ['adagios.live'])
|
||||||
|
|
||||||
|
.value('serviceConfig', {})
|
||||||
|
|
||||||
|
.controller('ServiceCtrl', ['$scope', 'serviceConfig', 'getService',
|
||||||
|
function ($scope, serviceConfig, getService) {
|
||||||
|
var objectType = 'service',
|
||||||
|
hostName = serviceConfig.hostName,
|
||||||
|
description = serviceConfig.description;
|
||||||
|
|
||||||
|
getService(hostName, description).success(function (data) {
|
||||||
|
$scope.data = data;
|
||||||
|
console.log($scope.data);
|
||||||
|
});
|
||||||
|
}])
|
||||||
|
|
||||||
|
.directive('adgService', ['$http', '$compile', 'serviceConfig',
|
||||||
|
function ($http, $compile, serviceConfig) {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
compile: function () {
|
||||||
|
return function (scope, element, attrs) {
|
||||||
|
|
||||||
|
var template = 'components/service/service.html';
|
||||||
|
|
||||||
|
if (!attrs.hostName && !!attrs.description) {
|
||||||
|
throw new Error('<adg-service> "host-name" and "description" attributes must be defined');
|
||||||
|
}
|
||||||
|
|
||||||
|
serviceConfig.hostName = '';
|
||||||
|
serviceConfig.hostName = attrs.hostName;
|
||||||
|
|
||||||
|
serviceConfig.description = '';
|
||||||
|
serviceConfig.description = attrs.description;
|
||||||
|
|
||||||
|
$http.get(template, { cache: true })
|
||||||
|
.success(function (data) {
|
||||||
|
var elem = $compile(data)(scope);
|
||||||
|
element.append(elem);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}]);
|
@ -1,7 +1,7 @@
|
|||||||
<td class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
<td class="data-table__service {{state}}" ng-controller="CellServiceCheckCtrl">
|
||||||
<dl class="data-table__data">
|
<dl class="data-table__data">
|
||||||
<dt class="data-table__service__name">
|
<dt class="data-table__service__name">
|
||||||
<a href="#/object_view?object_type=service&host_name={{entry.host_name}}&description={{entry.description}}">{{entry.description}}</a>
|
<a href="#/view?view=service&host_name={{entry.host_name}}&description={{entry.description}}">{{entry.description}}</a>
|
||||||
</dt>
|
</dt>
|
||||||
<dd class="data-table__service__summary">{{entry.plugin_output}}</dd>
|
<dd class="data-table__service__summary">{{entry.plugin_output}}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
'use strict';
|
"use strict";
|
||||||
|
|
||||||
angular.module('adagios.view.service', ['adagios.live'])
|
angular.module("adagios.view.service", [ "adagios.live" ]).controller("ServiceViewCtrl", [ "$scope", "$routeParams", function($scope, $routeParams) {
|
||||||
|
if (!$routeParams.host_name || !$routeParams.description) throw new Error("ERROR :'host_name' and 'description' GET parameters must be set");
|
||||||
.controller('ServiceViewCtrl', ['$scope', '$routeParams',
|
$scope.hostName = $routeParams.host_name, $scope.description = $routeParams.description;
|
||||||
function ($scope, $routeParams) {
|
} ]);
|
||||||
if (!!$routeParams.host_name && !!$routeParams.description) {
|
|
||||||
$scope.hostName = $routeParams.host_name;
|
|
||||||
$scope.description = $routeParams.description;
|
|
||||||
} else {
|
|
||||||
throw new Error("ERROR :'host_name' and 'description' GET parameters must be set");
|
|
||||||
}
|
|
||||||
}]);
|
|
Loading…
Reference in New Issue
Block a user