diff --git a/public/js/app.js b/public/js/app.js index ba2cf1aa..1c891457 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 adceb089..b1a84786 100644 --- a/public/navbar.html +++ b/public/navbar.html @@ -77,7 +77,7 @@
  • diff --git a/src/app/shared/services/page.js b/src/app/shared/services/page.js index 4b3c878d..b1284843 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; - }]); + } +]);