Commit dee0e5fc by Torkel Ödegaard

final fixes for fullscreen url state, #672

parent 56269758
......@@ -75,6 +75,7 @@ function (angular, _, moment, config) {
.then(function(result) {
alertSrv.set('Dashboard Saved', 'Dashboard has been saved as "' + result.title + '"','success', 5000);
$location.search({});
$location.path(result.url);
$rootScope.$emit('dashboard-saved', $scope.dashboard);
......
......@@ -41,6 +41,7 @@ function (angular, _, config, $) {
var selectedDash = $scope.results.dashboards[$scope.selectedIndex];
if (selectedDash) {
$location.search({});
$location.path("/dashboard/db/" + selectedDash.id);
setTimeout(function() {
$('body').click(); // hack to force dropdown to close;
......
......@@ -52,11 +52,11 @@ function (angular, $, kbn, _) {
p.getNextPanelId = function() {
var i, j, row, panel, max = 0;
for (i = 0; i < this.rows.length; i++) {
row = this.rows[i];
for (j = 0; j < row.panels.length; j++) {
panel = row.panels[j];
if (panel.id > max) { max = panel.id; }
}
row = this.rows[i];
for (j = 0; j < row.panels.length; j++) {
panel = row.panels[j];
if (panel.id > max) { max = panel.id; }
}
}
return max + 1;
};
......
......@@ -25,6 +25,7 @@ function (angular, _, $) {
$scope.onAppEvent('$routeUpdate', function() {
var urlState = self.getQueryStringState();
console.log("route updated!");
if (self.needsSync(urlState)) {
self.update(urlState, true);
}
......
......@@ -68,6 +68,7 @@ function (angular, _, kbn) {
timerInstance = setInterval(function() {
$rootScope.$apply(function() {
angular.element(window).unbind('resize');
$location.search({});
$location.path(dashboards[index % dashboards.length].url);
index++;
});
......
......@@ -28,10 +28,12 @@ function(angular, _, config) {
$rootScope.$on("dashboard-saved", function(event, savedDashboard) {
self.original = angular.copy(savedDashboard);
self.current = savedDashboard;
self.orignalPath = $location.path();
});
$rootScope.$on("$routeChangeSuccess", function() {
self.original = null;
self.originalPath = $location.path();
});
window.onbeforeunload = function() {
......@@ -42,6 +44,11 @@ function(angular, _, config) {
this.init = function() {
$rootScope.$on("$locationChangeStart", function(event, next) {
if (self.originalPath === $location.path()) {
console.log("skipping");
return;
}
if (self.has_unsaved_changes()) {
event.preventDefault();
self.next = next;
......
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