1 define(['common/general/common.general.module'], function(general) {
3 general.directive('stateIcon', function() {
10 template: '<span class="glyphicon glyphicon-{{stateIcon}}-sign"></span>',
11 controller: ['$scope', function ($scope) {
12 var value = $scope.stateValue;
14 var icons = {1: 'ok', 0: 'exclamation'};
15 var textStates = {'true': 1, 'false': 0};
17 if (_.isString(value) && !value.match('^[0-9]$')) {
18 value = textStates[value];
20 $scope.stateIcon = icons[value];
26 general.directive('portState', function() {
33 template: '<span ng-style="{color: stateColor}">{{stateString}}</span>',
34 controller: ['$scope', function ($scope) {
35 var states = {0: 'DOWN', 1: 'UP'};
36 var colors = {0: 'red', 1: 'green'};
38 $scope.stateString = states[$scope.stateValue];
39 $scope.stateColor = colors[$scope.stateValue];