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

View File

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

View File

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

View File

@ -1,38 +1,5 @@
<div ng-controller="ServiceInfoCtrl">
<table>
<tbody>
<tr>
<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>
<p>Last check: {{service.last_check|timeElapsed}}</p>
<p>Last state change: {{service.last_state_change|timeElapsed}}</p>
<p>Acknowledged: {{isAcknowledged}}</p>
</div>

View File

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

View File

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

View File

@ -9,6 +9,11 @@ angular.module('bansho.service.main', [])
.directive('banshoServiceMain', function () {
return {
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 () {
return {
restrict: 'E',
scope: {
service: '=service'
},
templateUrl: 'components/service/service_metrics/service_metrics.html'
};
});

View File

@ -27,7 +27,7 @@
margin: 0px;
line-height: 35px;
cursor: pointer;
/*
/*
.collapsed{
.arrow:before{
font-family: FontAwesome;
@ -143,4 +143,3 @@ body {
margin: 0px;
padding: 0px;
}

View File

@ -27,7 +27,7 @@
margin: 0px;
line-height: 35px;
cursor: pointer;
/*
/*
.collapsed{
.arrow:before{
font-family: FontAwesome;
@ -143,4 +143,3 @@ body {
margin: 0px;
padding: 0px;
}