Improve service page

Change-Id: Icca92862209442cd74177113ba2348e1159c7677
This commit is contained in:
flavien.peyre 2015-05-20 09:22:44 -04:00 committed by Vincent Fournier
parent 7e1d9c1260
commit eb36bd3bfe
10 changed files with 32 additions and 58 deletions

View File

@ -48,7 +48,7 @@ angular.module('bansho.live', [])
filters = { filters = {
'is': { 'is': {
'host_name': [hostName], 'host_name': [hostName],
'description': [description] 'service_description': [description]
} }
}; };
@ -70,7 +70,7 @@ angular.module('bansho.live', [])
.error(function () { .error(function () {
throw new Error('getService : POST Request failed'); throw new Error('getService : POST Request failed');
}); });
} };
var getHostOpenProblems = function () { var getHostOpenProblems = function () {
var fields = ['state'], var fields = ['state'],

View File

@ -1,8 +1,10 @@
<article ng-controller="ServiceCtrl"> <article ng-controller="ServiceCtrl">
<h2>Service</h2> <section class="main__content tabpanel">
<section class="main__content tabpanel" ng-if="data"> <h1>{{service.service_description}}</h1>
<bansho-service-main></bansho-service-main> <bansho-service-main service='service'></bansho-service-main>
<bansho-service-info></bansho-service-info> <h2> Info</h2>
<bansho-service-metrics></bansho-service-metrics> <bansho-service-info service='service'></bansho-service-info>
<h2> Metrics</h2>
<bansho-service-metrics service='service'></bansho-service-metrics>
</section> </section>
</article> </article>

View File

@ -13,7 +13,7 @@ angular.module('bansho.service', ['bansho.live',
description = serviceConfig.description; description = serviceConfig.description;
backendClient.getService(hostName, description).success(function (data) { backendClient.getService(hostName, description).success(function (data) {
$scope.data = data; $scope.service = data[0];
}); });
}]) }])

View File

@ -1,38 +1,5 @@
<div ng-controller="ServiceInfoCtrl"> <div ng-controller="ServiceInfoCtrl">
<table> <p>Last check: {{service.last_check|timeElapsed}}</p>
<tbody> <p>Last state change: {{service.last_state_change|timeElapsed}}</p>
<tr> <p>Acknowledged: {{isAcknowledged}}</p>
<td>Handled :</td>
<td>{{data.0.handled}}</td>
</tr>
<tr>
<td>Tags :</td>
<td>{{data.0.tags}}</td>
</tr>
<tr>
<td>Tags :</td>
<td>{{data.0.tags}}</td>
</tr>
<tr>
<td>Backend :</td>
<td>{{data.0.backend}}</td>
</tr>
<tr>
<td>Last check :</td>
<td>{{data.0.last_check|timeElapsed}}</td>
</tr>
<tr>
<td>Last state change :</td>
<td>{{data.0.last_state_change|timeElapsed}}</td>
</tr>
<tr>
<td>Tags :</td>
<td>{{data.0.tags}}</td>
</tr>
<tr>
<td>Acknowledged :</td>
<td>{{acknowledged}}</td>
</tr>
</tbody>
</table>
</div> </div>

View File

@ -3,12 +3,15 @@
angular.module('bansho.service.info', []) angular.module('bansho.service.info', [])
.controller('ServiceInfoCtrl', ['$scope', function ($scope) { .controller('ServiceInfoCtrl', ['$scope', function ($scope) {
$scope.acknowledged = $scope.data[0].acknowledged === "1" ? "Yes" : "No"; $scope.isAcknowledged = $scope.acknowledged === "1" ? "Yes" : "No";
}]) }])
.directive('banshoServiceInfo', function () { .directive('banshoServiceInfo', function () {
return { return {
restrict: 'E', restrict: 'E',
scope: {
service: '=service'
},
templateUrl: 'components/service/service_info/service_info.html' templateUrl: 'components/service/service_info/service_info.html'
}; };
}); });

View File

@ -1,10 +1,6 @@
<div ng-controller="ServiceMainCtrl"> <div ng-controller="ServiceMainCtrl">
<ul> <p>Description: {{service.description}}</p>
<li>{{data.0.host_name}}</li> <p>Host Name: {{service.host_name}}</p>
<li>{{data.0.description}}</li> <p>Current state: <bansho-table-state-icon service-state="{{service.state}}"></bansho-table-state-icon>{{service.state}}
<li>{{data.0.state}}</li> <p>Live plugin output: {{service.plugin_output}}</p>
<li>{{data.0.plugin_output}}</li>
<li>{{data.0.backend}}</li>
<li>{{data.0.status}}</li>
</ul>
</div> </div>

View File

@ -9,6 +9,11 @@ angular.module('bansho.service.main', [])
.directive('banshoServiceMain', function () { .directive('banshoServiceMain', function () {
return { return {
restrict: 'E', restrict: 'E',
templateUrl: 'components/service/service_main/service_main.html' scope: {
service: '=service'
},
templateUrl: 'components/service/service_main/service_main.html',
controller: 'ServiceMainCtrl'
}; };
}); });

View File

@ -9,6 +9,9 @@ angular.module('bansho.service.metrics', [])
.directive('banshoServiceMetrics', function () { .directive('banshoServiceMetrics', function () {
return { return {
restrict: 'E', restrict: 'E',
scope: {
service: '=service'
},
templateUrl: 'components/service/service_metrics/service_metrics.html' templateUrl: 'components/service/service_metrics/service_metrics.html'
}; };
}); });

View File

@ -143,4 +143,3 @@ body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }

View File

@ -143,4 +143,3 @@ body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }