diff --git a/src/app/features/profile/partials/profile.html b/src/app/features/profile/partials/profile.html index 0330ee2fb17..d8758ae9c09 100644 --- a/src/app/features/profile/partials/profile.html +++ b/src/app/features/profile/partials/profile.html @@ -52,7 +52,7 @@ UI Theme
  • - +
  • diff --git a/src/app/features/profile/profileCtrl.js b/src/app/features/profile/profileCtrl.js index 820866da6be..fd7af74834d 100644 --- a/src/app/features/profile/profileCtrl.js +++ b/src/app/features/profile/profileCtrl.js @@ -7,7 +7,7 @@ function (angular, config) { var module = angular.module('grafana.controllers'); - module.controller('ProfileCtrl', function($scope, backendSrv) { + module.controller('ProfileCtrl', function($scope, backendSrv, contextSrv, $location) { $scope.init = function() { $scope.getUser(); @@ -18,6 +18,7 @@ function (angular, config) { backendSrv.get('/api/user').then(function(user) { $scope.user = user; $scope.user.theme = user.theme || 'dark'; + $scope.old_theme = $scope.user.theme; }); }; @@ -35,7 +36,13 @@ function (angular, config) { $scope.update = function() { if (!$scope.userForm.$valid) { return; } - backendSrv.put('/api/user/', $scope.user); + + backendSrv.put('/api/user/', $scope.user).then(function() { + contextSrv.user.name = $scope.user.name || $scope.user.login; + if ($scope.old_theme !== $scope.user.theme) { + window.location.href = config.appSubUrl + $location.path(); + } + }); }; $scope.init(); diff --git a/src/app/partials/sidemenu.html b/src/app/partials/sidemenu.html index 782ef427f07..5ecd29f7738 100644 --- a/src/app/partials/sidemenu.html +++ b/src/app/partials/sidemenu.html @@ -38,10 +38,7 @@