Commit dee0e5fc by Torkel Ödegaard

final fixes for fullscreen url state, #672

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