Commit 8aef297e by Anthony Woods

show sidemenu when admin user logs in the first time. #54

parent 7a8851c5
...@@ -14,7 +14,7 @@ function (angular, config) { ...@@ -14,7 +14,7 @@ function (angular, config) {
password: '', password: '',
}; };
contextSrv.setSideMenuState(false); contextSrv.sidemenu = false;
$scope.googleAuthEnabled = config.googleAuthEnabled; $scope.googleAuthEnabled = config.googleAuthEnabled;
$scope.githubAuthEnabled = config.githubAuthEnabled; $scope.githubAuthEnabled = config.githubAuthEnabled;
......
...@@ -36,7 +36,9 @@ function (angular, _, kbn, moment, $) { ...@@ -36,7 +36,9 @@ function (angular, _, kbn, moment, $) {
}); });
module.controller('DashFromSnapshotCtrl', function($scope, $routeParams, backendSrv) { module.controller('DashFromSnapshotCtrl', function($scope, $routeParams, backendSrv, contextSrv) {
//don't show the sidemenu in snapshots.
contextSrv.sidemenu = false;
backendSrv.get('/api/snapshots/' + $routeParams.key).then(function(result) { backendSrv.get('/api/snapshots/' + $routeParams.key).then(function(result) {
$scope.initDashboard(result, $scope); $scope.initDashboard(result, $scope);
}, function() { }, function() {
......
...@@ -45,7 +45,19 @@ function (angular, _, store, config) { ...@@ -45,7 +45,19 @@ function (angular, _, store, config) {
this.user = new User(); this.user = new User();
this.isSignedIn = this.user.isSignedIn; this.isSignedIn = this.user.isSignedIn;
this.isGrafanaAdmin = this.user.isGrafanaAdmin; this.isGrafanaAdmin = this.user.isGrafanaAdmin;
this.sidemenu = store.getBool('grafana.sidemenu', true); var sidemenuDefault = false;
if (this.hasRole('Admin')) {
sidemenuDefault = true;
}
this.sidemenu = store.getBool('grafana.sidemenu', sidemenuDefault);
if (this.isSignedIn && !store.exists('grafana.sidemenu')) {
// If the sidemnu has never been set before, set it to false.
// This will result in this.sidemenu and the localStorage grafana.sidemenu
// to be out of sync if the user has an admin role. But this is
// intentional and results in the user seeing the sidemenu only on
// their first login.
store.set('grafana.sidemenu', false);
}
this.isEditor = this.hasRole('Editor') || this.hasRole('Admin'); this.isEditor = this.hasRole('Editor') || this.hasRole('Admin');
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment