Vincent Fournier 63f3ad58d6 Improve jshint task and fix errors
Change-Id: I1b9c7d4a7040e3fee66388b9744b553a6fb1da6e
2015-05-20 15:46:08 -04:00

45 lines
1.5 KiB
JavaScript

'use strict';
angular.module('bansho.table.state_icon', [])
.directive('banshoHostStateIcon', function () {
return {
restrict: 'E',
scope: {
state: '=state'
},
templateUrl: 'components/table/state_icon/state_icon.html',
controller: ['$scope', function ($scope) {
if ($scope.state === 'UP') {
$scope.stateClass = 'state--ok';
} else if ($scope.state === 'WARNING') {
$scope.stateClass = 'state--warning';
} else if ($scope.state === '') {
$scope.stateClass = '';
} else {
$scope.stateClass = 'state--error';
}
}]
};
})
.directive('banshoServiceStateIcon', function () {
return {
restrict: 'E',
scope: {
state: '=state'
},
templateUrl: 'components/table/state_icon/state_icon.html',
controller: ['$scope', function ($scope) {
if ($scope.state === 'OK') {
$scope.stateClass = 'state--ok';
} else if ($scope.state === 'WARNING') {
$scope.state = 'state--warning';
} else if ($scope.state === '') {
$scope.stateClass = '';
} else {
$scope.stateClass = 'state--error';
}
}]
};
});