|
|
@@ -60,12 +60,6 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
|
|
|
this.last = {};
|
|
|
this.availablePanels = [];
|
|
|
|
|
|
- $rootScope.$on("$locationChangeStart", function(event, next, current) {
|
|
|
- if (!self.confirm_dash_change()) {
|
|
|
- event.preventDefault();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
$rootScope.$on('$routeChangeSuccess',function(){
|
|
|
// Clear the current dashboard to prevent reloading
|
|
|
self.current = {};
|
|
|
@@ -191,22 +185,6 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
|
|
|
return true;
|
|
|
};
|
|
|
|
|
|
- this.confirm_dash_change = function() {
|
|
|
- if (!self.original) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- var current = angular.copy(self.current);
|
|
|
- var currentJson = angular.toJson(current);
|
|
|
- var originalJson = angular.toJson(self.original);
|
|
|
-
|
|
|
- if (currentJson !== originalJson) {
|
|
|
- return confirm('There are unsaved changes, are you sure you want to change dashboard?');
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- };
|
|
|
-
|
|
|
this.gist_id = function(string) {
|
|
|
if(self.is_gist(string)) {
|
|
|
return string.match(gist_pattern)[0].replace(/.*\//, '');
|
|
|
@@ -416,6 +394,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
|
|
|
if(type === 'dashboard') {
|
|
|
$location.path('/dashboard/elasticsearch/'+title);
|
|
|
}
|
|
|
+ self.original = angular.copy(self.current);
|
|
|
return result;
|
|
|
},
|
|
|
// Failure
|