Commit 72974719 by Torkel Ödegaard

Remember last dashboard

parent 49b18e17
......@@ -6,7 +6,7 @@
<p>
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.
</p>
</div>
......
......@@ -24,10 +24,6 @@
<i class="icon-sitemap"></i>
Data sources
</a>
<a class="pro-sidemenu-link" href="admin">
<i class="icon-tasks"></i>
Global options
</a>
<a class="pro-sidemenu-link" href="account">
<i class="icon-user"></i>
Account settings
......
......@@ -33,6 +33,9 @@ function (angular, store) {
});
});
// remember previous dashboard
var prevDashPath = null;
module.controller('DashFromDBProvider', function(
$scope, $rootScope, datasourceSrv, $routeParams,
alertSrv, $http, $location) {
......@@ -41,8 +44,12 @@ function (angular, store) {
var isTemp = window.location.href.indexOf('dashboard/temp') !== -1;
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) {
$http.get("app/dashboards/default.json?" + new Date().getTime()).then(function(result) {
var dashboard = angular.fromJson(result.data);
......@@ -61,6 +68,7 @@ function (angular, store) {
db.getDashboard($routeParams.id, isTemp)
.then(function(dashboard) {
prevDashPath = $location.path();
$scope.initDashboard(dashboard, $scope);
}).then(null, function(err) {
$scope.appEvent('alert-error', ['Load dashboard failed', err]);
......
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