diff --git a/public/js/app.js b/public/js/app.js index ba2cf1aa757b49e9537a5a94fc8413f3ef352d5d..1c8914571088929c3e95eb47dd90e070f87ab2ee 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -3008,9 +3008,6 @@ angular.module('cerebro').factory('ModalService', ['$sce', function($sce) { angular.module('cerebro').factory('PageService', ['DataService', '$rootScope', '$document', function(DataService, $rootScope, $document) { - var clusterName; - var clusterStatus; - var link = $document[0].querySelector('link[rel~=\'icon\']'); var colors = { @@ -3020,35 +3017,30 @@ angular.module('cerebro').factory('PageService', ['DataService', '$rootScope', black: 'img/black-favicon.png' }; - this.setup = function(newName, newStatus) { - setPageTitle(newName); - setFavIconColor(newStatus); + this.setup = function(name, status) { + setPageTitle(name, status); + setFavIconColor(status); }; - var setPageTitle = function(newClusterName) { - if (clusterName !== newClusterName) { - if (newClusterName) { - clusterName = newClusterName; - $rootScope.title = 'cerebro[' + clusterName + ']'; - } else { - clusterName = undefined; - $rootScope.title = 'cerebro - no connection'; - } + var setPageTitle = function(name, status) { + if (name) { + $rootScope.title = name + '[' + status + ']'; + } else { + $rootScope.title = 'cerebro - no connection'; } }; - var setFavIconColor = function(newClusterStatus) { + var setFavIconColor = function(status) { if (link) { - clusterStatus = newClusterStatus; - var url = clusterStatus ? colors[clusterStatus] : colors.black; link.type = 'image/png'; - link.href = url; + link.href = colors[status] || colors.black; } }; return this; - }]); + } +]); angular.module('cerebro').factory('RefreshService', function($rootScope, $timeout) { diff --git a/public/navbar.html b/public/navbar.html index adceb08994e1d25bd48eb7cccbef1b93126212ea..b1a84786629a365e6b1af8603c9c27c13c14a6f2 100644 --- a/public/navbar.html +++ b/public/navbar.html @@ -77,7 +77,7 @@ </li> <li class="hidden-xs"> <a class="nav-item nav-link"> - <span ng-show="host">{{host}}</span> + <span ng-show="host">{{host}} [{{status}}]</span> </a> </li> <li> diff --git a/src/app/shared/services/page.js b/src/app/shared/services/page.js index 4b3c878d47755963ae5ce4973961f053de07b2ff..b128484362316ef888223bdceed8f60e630b04e5 100644 --- a/src/app/shared/services/page.js +++ b/src/app/shared/services/page.js @@ -1,9 +1,6 @@ angular.module('cerebro').factory('PageService', ['DataService', '$rootScope', '$document', function(DataService, $rootScope, $document) { - var clusterName; - var clusterStatus; - var link = $document[0].querySelector('link[rel~=\'icon\']'); var colors = { @@ -13,32 +10,27 @@ angular.module('cerebro').factory('PageService', ['DataService', '$rootScope', black: 'img/black-favicon.png' }; - this.setup = function(newName, newStatus) { - setPageTitle(newName); - setFavIconColor(newStatus); + this.setup = function(name, status) { + setPageTitle(name, status); + setFavIconColor(status); }; - var setPageTitle = function(newClusterName) { - if (clusterName !== newClusterName) { - if (newClusterName) { - clusterName = newClusterName; - $rootScope.title = 'cerebro[' + clusterName + ']'; - } else { - clusterName = undefined; - $rootScope.title = 'cerebro - no connection'; - } + var setPageTitle = function(name, status) { + if (name) { + $rootScope.title = name + '[' + status + ']'; + } else { + $rootScope.title = 'cerebro - no connection'; } }; - var setFavIconColor = function(newClusterStatus) { + var setFavIconColor = function(status) { if (link) { - clusterStatus = newClusterStatus; - var url = clusterStatus ? colors[clusterStatus] : colors.black; link.type = 'image/png'; - link.href = url; + link.href = colors[status] || colors.black; } }; return this; - }]); + } +]);