From e2fc334b78745e1b8fcdaef55b7b4ddc9fef7db6 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 13 Mar 2013 13:06:46 -0700 Subject: [PATCH] moved default dashboard, turned spy on by default, added file loader --- default.json => dashboards/default | 0 panels/dashcontrol/module.js | 42 +++++++++++++++++------------- panels/dashcontrol/save.html | 4 +-- panels/histogram/module.js | 1 + panels/map/module.js | 1 + panels/table/module.js | 1 + 6 files changed, 29 insertions(+), 20 deletions(-) rename default.json => dashboards/default (100%) diff --git a/default.json b/dashboards/default similarity index 100% rename from default.json rename to dashboards/default diff --git a/panels/dashcontrol/module.js b/panels/dashcontrol/module.js index f42e6f17d11..8bfce8f0b08 100644 --- a/panels/dashcontrol/module.js +++ b/panels/dashcontrol/module.js @@ -23,14 +23,14 @@ angular.module('kibana.dashcontrol', []) } _.defaults($scope.panel,_d); - $scope.init = function() { - // A hash of defaults for the dashboard object - var _dash = { - title: "", - editable: true, - rows: [], - } + // A hash of defaults for the dashboard object + var _dash = { + title: "", + editable: true, + rows: [], + } + $scope.init = function() { // Long ugly if statement for figuring out which dashboard to load on init // If there is no dashboard defined, find one if(_.isUndefined($scope.dashboards)) { @@ -43,7 +43,9 @@ angular.module('kibana.dashcontrol', []) $scope.elasticsearch_load('dashboard',_id) if(_type === 'temp') $scope.elasticsearch_load('temp',_id) - + if(_type === 'file') + $scope.file_load(_id) + // No dashboard in the URL } else { // Check if browser supports localstorage, and if there's a dashboard @@ -56,16 +58,7 @@ angular.module('kibana.dashcontrol', []) $scope.dash_load(JSON.stringify(dashboard)) // No? Ok, grab default.json, its all we have now } else { - $http({ - url: "default.json", - method: "GET", - }).success(function(data, status, headers, config) { - var dashboard = data - _.defaults(dashboard,_dash); - $scope.dash_load(JSON.stringify(dashboard)) - }).error(function(data, status, headers, config) { - $scope.alert('Default dashboard missing!','Could not locate default.json','error') - }); + $scope.file_load('default') } } @@ -117,6 +110,19 @@ angular.module('kibana.dashcontrol', []) } } + $scope.file_load = function(file) { + $http({ + url: "dashboards/default", + method: "GET", + }).success(function(data, status, headers, config) { + var dashboard = data + _.defaults(dashboard,_dash); + $scope.dash_load(JSON.stringify(dashboard)) + }).error(function(data, status, headers, config) { + $scope.alert('Default dashboard missing!','Could not locate dashboards/'+file,'error') + }); + } + $scope.elasticsearch_save = function(type) { // Clone object so we can modify it without influencing the existing obejct if($scope.panel.hide_control) { diff --git a/panels/dashcontrol/save.html b/panels/dashcontrol/save.html index 9f3cba0c700..91428d369a6 100644 --- a/panels/dashcontrol/save.html +++ b/panels/dashcontrol/save.html @@ -7,8 +7,8 @@
diff --git a/panels/histogram/module.js b/panels/histogram/module.js index 8f778cfa12c..e64c017e190 100644 --- a/panels/histogram/module.js +++ b/panels/histogram/module.js @@ -8,6 +8,7 @@ angular.module('kibana.histogram', []) show : ['bars','y-axis','x-axis','legend'], fill : 3, timezone: 'browser', // browser, utc or a standard timezone + spyable : true, group : "default", } _.defaults($scope.panel,_d) diff --git a/panels/map/module.js b/panels/map/module.js index 889e31ad76d..ca1146d831e 100644 --- a/panels/map/module.js +++ b/panels/map/module.js @@ -8,6 +8,7 @@ angular.module('kibana.map', []) colors : ['#C8EEFF', '#0071A4'], size : 100, exclude : [], + spyable : true, group : "default", } _.defaults($scope.panel,_d) diff --git a/panels/table/module.js b/panels/table/module.js index 6763c927a89..1c571ed232c 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -10,6 +10,7 @@ angular.module('kibana.table', []) group : "default", style : {}, fields : [], + spyable: true, } _.defaults($scope.panel,_d)