2015-04-24 11:27:00 -04:00

29 lines
984 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
angular.module('bansho.table.cell_host_status', ['bansho.table'])
.controller('CellHostStatusCtrl', ['$scope', function ($scope) {
$scope.entry.host_status = "";
$scope.alert_level = "";
if ($scope.entry.last_check === 0) {
$scope.alert_level = "alert alert-info";
$scope.entry.host_status = "Pending";
} else if ($scope.entry.state === 0) {
$scope.alert_level = "alert alert-success";
$scope.entry.host_status = "Host UP";
} else {
$scope.alert_level = "alert alert-danger";
if ($scope.entry.childs.length !== 0) {
$scope.entry.host_status = "Host down";
} else {
$scope.entry.host_status = "Network outage";
}
}
}])
.run(['tableGlobalConfig', function (tableGlobalConfig) {
tableGlobalConfig.cellToFieldsMap.host_status = ['state', 'last_check', 'childs'];
}]);