Commit 34427f34 by Torkel Ödegaard

side menu visible by default after login

parent 344812f1
...@@ -8,9 +8,15 @@ define([], function() { ...@@ -8,9 +8,15 @@ define([], function() {
set: function(key, value) { set: function(key, value) {
window.localStorage[key] = value; window.localStorage[key] = value;
}, },
getBool: function(key) { getBool: function(key, def) {
if (def !== void 0 && !this.exists(key)) {
return def;
}
return window.localStorage[key] === 'true' ? true : false; return window.localStorage[key] === 'true' ? true : false;
}, },
exists: function(key) {
return window.localStorage[key] !== void 0;
},
delete: function(key) { delete: function(key) {
window.localStorage.removeItem(key); window.localStorage.removeItem(key);
} }
......
...@@ -42,13 +42,14 @@ function (angular, config, _, $, store) { ...@@ -42,13 +42,14 @@ function (angular, config, _, $, store) {
} }
$scope.onAppEvent('logged-out', function() { $scope.onAppEvent('logged-out', function() {
$scope.showProSideMenu = false; $scope.grafana.sidemenu = false;
$scope.grafana.user = {}; $scope.grafana.user = {};
}); });
$scope.onAppEvent('logged-in', function(evt, user) { $scope.onAppEvent('logged-in', function(evt, user) {
$scope.grafana.sidemenu = store.getBool('grafana.sidemenu'); $scope.grafana.sidemenu = store.getBool('grafana.sidemenu', true);
$scope.grafana.user = user; $scope.grafana.user = user;
store.set('grafana.sidemenu', $scope.grafana.sidemenu);
}); });
}; };
...@@ -56,7 +57,7 @@ function (angular, config, _, $, store) { ...@@ -56,7 +57,7 @@ function (angular, config, _, $, store) {
$controller('DashboardCtrl', { $scope: viewScope }).init(dashboardData); $controller('DashboardCtrl', { $scope: viewScope }).init(dashboardData);
}; };
$scope.toggleProSideMenu = function() { $scope.toggleSideMenu = function() {
$scope.grafana.sidemenu = !$scope.grafana.sidemenu; $scope.grafana.sidemenu = !$scope.grafana.sidemenu;
store.set('grafana.sidemenu', $scope.grafana.sidemenu); store.set('grafana.sidemenu', $scope.grafana.sidemenu);
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container-fluid"> <div class="container-fluid">
<span class="brand"> <span class="brand">
<a ng-click="toggleProSideMenu()"> <a ng-click="toggleSideMenu()">
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img> <img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
</a> </a>
<span class="page-title">{{dashboard.title}}</span> <span class="page-title">{{dashboard.title}}</span>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container-fluid"> <div class="container-fluid">
<span class="brand"> <span class="brand">
<a ng-click="toggleProSideMenu()"> <a ng-click="toggleSideMenu()">
<img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img> <img class="logo-icon" src="img/fav32.png" bs-tooltip="'Grafana'" data-placement="bottom"></img>
</a> </a>
<span class="page-title">{{pageTitle}}</span> <span class="page-title">{{pageTitle}}</span>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="login-box"> <div class="login-box">
<div class="login-box-logo"> <div class="login-box-logo">
<img src="/img/logo_transparent_200x75.png"> <img src="img/logo_transparent_200x75.png">
</div> </div>
<div class="text-center" style="margin-bottom: 50px"> <div class="text-center" style="margin-bottom: 50px">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<li><a href="/login?logout">Logout</a></li> <li><a href="/login?logout">Logout</a></li>
</ul> </ul>
</div> </div>
<a class="pro-sidemenu-link" ng-href="{{appSubUrl}}"> <a class="pro-sidemenu-link" ng-href="{{appSubUrl}}/">
<i class="icon-th-large"></i> <i class="icon-th-large"></i>
Dashboards Dashboards
</a> </a>
......
...@@ -39,7 +39,6 @@ function (angular, store) { ...@@ -39,7 +39,6 @@ function (angular, store) {
var db = datasourceSrv.getGrafanaDB(); var db = datasourceSrv.getGrafanaDB();
var isTemp = window.location.href.indexOf('dashboard/temp') !== -1; var isTemp = window.location.href.indexOf('dashboard/temp') !== -1;
console.log('default route');
if (!$routeParams.id) { if (!$routeParams.id) {
var savedRoute = store.get('grafanaDashboardDefault'); var savedRoute = store.get('grafanaDashboardDefault');
......
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