diff --git a/app/app.js b/app/app.js index 52ff750b4..bf795ccc6 100644 --- a/app/app.js +++ b/app/app.js @@ -16,6 +16,7 @@ angular.module('portainer').run([ EndpointProvider.initialize(); $rootScope.$state = $state; + $rootScope.defaultTitle = document.title; // Workaround to prevent the loading bar from going backward // https://github.com/chieffancypants/angular-loading-bar/issues/273 diff --git a/app/portainer/views/sidebar/sidebarController.js b/app/portainer/views/sidebar/sidebarController.js index f9ff1cf89..24b357fec 100644 --- a/app/portainer/views/sidebar/sidebarController.js +++ b/app/portainer/views/sidebar/sidebarController.js @@ -1,4 +1,5 @@ angular.module('portainer.app').controller('SidebarController', [ + '$rootScope', '$q', '$scope', '$transitions', @@ -7,7 +8,7 @@ angular.module('portainer.app').controller('SidebarController', [ 'Authentication', 'UserService', 'EndpointProvider', - function ($q, $scope, $transitions, StateManager, Notifications, Authentication, UserService, EndpointProvider) { + function ($rootScope, $q, $scope, $transitions, StateManager, Notifications, Authentication, UserService, EndpointProvider) { function checkPermissions(memberships) { var isLeader = false; angular.forEach(memberships, function (membership) { @@ -52,6 +53,10 @@ angular.module('portainer.app').controller('SidebarController', [ $transitions.onEnter({}, async () => { $scope.showStacks = await shouldShowStacks(); + + if ($scope.applicationState.endpoint.name) { + document.title = `${$rootScope.defaultTitle} | ${$scope.applicationState.endpoint.name}`; + } }); }, ]);