Browse Source

Remember last dashboard

Torkel Ödegaard 11 years ago
parent
commit
72974719ac

+ 1 - 1
src/app/features/grafanaDatasource/partials/query.editor.html

@@ -6,7 +6,7 @@
 
 
 		<p>
 		<p>
 		This is just a test data source that generates random walk series. If this is your only data source
 		This is just a test data source that generates random walk series. If this is your only data source
-		open the left side menu and goto data sources admin screen and add your data sources. You can change
+		open the left side menu and navigate to the data sources admin screen and add your data sources. You can change
 		data source using the button to the left of the <strong>Add query</strong> button.
 		data source using the button to the left of the <strong>Add query</strong> button.
 		</p>
 		</p>
 	</div>
 	</div>

+ 0 - 4
src/app/partials/sidemenu.html

@@ -24,10 +24,6 @@
 		<i class="icon-sitemap"></i>
 		<i class="icon-sitemap"></i>
 		Data sources
 		Data sources
 	</a>
 	</a>
-	<a class="pro-sidemenu-link" href="admin">
-		<i class="icon-tasks"></i>
-		Global options
-	</a>
 	<a class="pro-sidemenu-link" href="account">
 	<a class="pro-sidemenu-link" href="account">
 		<i class="icon-user"></i>
 		<i class="icon-user"></i>
 		Account settings
 		Account settings

+ 9 - 1
src/app/routes/backend/dashboard.js

@@ -33,6 +33,9 @@ function (angular, store) {
       });
       });
   });
   });
 
 
+  // remember previous dashboard
+  var prevDashPath = null;
+
   module.controller('DashFromDBProvider', function(
   module.controller('DashFromDBProvider', function(
         $scope, $rootScope, datasourceSrv, $routeParams,
         $scope, $rootScope, datasourceSrv, $routeParams,
         alertSrv, $http, $location) {
         alertSrv, $http, $location) {
@@ -41,8 +44,12 @@ function (angular, store) {
     var isTemp = window.location.href.indexOf('dashboard/temp') !== -1;
     var isTemp = window.location.href.indexOf('dashboard/temp') !== -1;
 
 
     if (!$routeParams.id) {
     if (!$routeParams.id) {
-      var savedRoute = store.get('grafanaDashboardDefault');
+      // do we have a previous dash
+      if (prevDashPath) {
+        $location.path(prevDashPath);
+      }
 
 
+      var savedRoute = store.get('grafanaDashboardDefault');
       if (!savedRoute) {
       if (!savedRoute) {
         $http.get("app/dashboards/default.json?" + new Date().getTime()).then(function(result) {
         $http.get("app/dashboards/default.json?" + new Date().getTime()).then(function(result) {
           var dashboard = angular.fromJson(result.data);
           var dashboard = angular.fromJson(result.data);
@@ -61,6 +68,7 @@ function (angular, store) {
 
 
     db.getDashboard($routeParams.id, isTemp)
     db.getDashboard($routeParams.id, isTemp)
       .then(function(dashboard) {
       .then(function(dashboard) {
+        prevDashPath = $location.path();
         $scope.initDashboard(dashboard, $scope);
         $scope.initDashboard(dashboard, $scope);
       }).then(null, function(err) {
       }).then(null, function(err) {
         $scope.appEvent('alert-error', ['Load dashboard failed', err]);
         $scope.appEvent('alert-error', ['Load dashboard failed', err]);