From 93b48a7d2944ba45cf968dd6c0499a5700cafdf9 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Fri, 16 Aug 2013 12:45:22 -0700 Subject: [PATCH] added ability to add new tabs to editor panels --- js/controllers.js | 11 +++++++-- js/directives.js | 7 +++--- js/services.js | 3 +-- panels/bettermap/editor.html | 1 - panels/bettermap/module.js | 3 +++ panels/column/module.js | 1 - panels/fields/module.js | 1 - panels/histogram/editor.html | 1 - panels/histogram/module.js | 3 +++ panels/hits/editor.html | 1 - panels/hits/module.js | 3 +++ panels/map/editor.html | 7 ------ panels/map/module.js | 3 +++ panels/pie/editor.html | 1 - panels/pie/module.js | 3 +++ panels/query/module.js | 2 ++ panels/table/editor.html | 4 +--- panels/table/module.js | 5 ++++- panels/terms/editor.html | 1 - panels/terms/module.js | 3 +++ panels/timepicker/module.js | 3 --- panels/trends/editor.html | 1 - panels/trends/module.js | 3 +++ partials/dasheditor.html | 8 +++---- partials/inspector.html | 3 +-- partials/paneleditor.html | 15 ++++++++----- partials/querySelect.html | 43 +++++++++++++++++++----------------- 27 files changed, 78 insertions(+), 62 deletions(-) diff --git a/js/controllers.js b/js/controllers.js index 7c724f59aef..f6ca8e3f845 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -71,6 +71,14 @@ angular.module('kibana.controllers', []) } }; + $scope.setEditorTabs = function(panelMeta) { + $scope.editorTabs = ['General','Panel']; + if(!_.isUndefined(panelMeta.editorTabs)) { + $scope.editorTabs = _.union($scope.editorTabs,_.pluck(panelMeta.editorTabs,'title')); + } + return $scope.editorTabs; + }; + // This is whoafully incomplete, but will do for now $scope.parse_error = function(data) { var _error = data.match("nested: (.*?);"); @@ -125,8 +133,7 @@ angular.module('kibana.controllers', []) $scope.panel = { error : false, span : 3, - editable: true, - group : ['default'] + editable: true }; }; diff --git a/js/directives.js b/js/directives.js index cff795b45c6..708ff5fa023 100644 --- a/js/directives.js +++ b/js/directives.js @@ -26,10 +26,9 @@ angular.module('kibana.directives', []) link: function(scope, elem, attrs) { scope.$watch('panel.type', function(n,o) { if(!_.isUndefined(scope.panel.type)) { - var template = '
'+ - '
'+ - '
'+ - '
'; + var template = '
'+ + ''+ + '
'; elem.html($compile(angular.element(template))(scope)); } }); diff --git a/js/services.js b/js/services.js index 2dfdd42b2a3..443e990b49f 100644 --- a/js/services.js +++ b/js/services.js @@ -166,7 +166,6 @@ angular.module('kibana.services', []) } } }) - .service('timer', function($timeout) { // This service really just tracks a list of $timeout promises to give us a // method for cancelling them all when we need to @@ -451,7 +450,7 @@ angular.module('kibana.services', []) // TOFIX: Error handling when there is more than one field this.timeField = function() { - return self.getByType('time')[0].field; + return _.pluck(self.getByType('time'),'field'); }; // This special function looks for all time filters, and returns a time range according to the mode diff --git a/panels/bettermap/editor.html b/panels/bettermap/editor.html index fd8223015f1..5f89f49f295 100644 --- a/panels/bettermap/editor.html +++ b/panels/bettermap/editor.html @@ -15,7 +15,6 @@
-
Panel Spy
diff --git a/panels/bettermap/module.js b/panels/bettermap/module.js index a6afa237bfe..3ba77bc0891 100644 --- a/panels/bettermap/module.js +++ b/panels/bettermap/module.js @@ -18,6 +18,9 @@ angular.module('kibana.bettermap', []) .controller('bettermap', function($scope, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Experimental", description : "Displays geo points in clustered groups on a map. The cavaet for this panel is"+ " that, for better or worse, it does NOT use the terms facet and it does query "+ diff --git a/panels/column/module.js b/panels/column/module.js index 79bff92605f..9bf1c03540c 100644 --- a/panels/column/module.js +++ b/panels/column/module.js @@ -55,7 +55,6 @@ angular.module('kibana.column', []) span: 12, height: "150px", editable: true, - group: ['default'], type: type, }; }; diff --git a/panels/fields/module.js b/panels/fields/module.js index 8651d6c3b36..6119d79e1df 100644 --- a/panels/fields/module.js +++ b/panels/fields/module.js @@ -21,7 +21,6 @@ angular.module('kibana.fields', []) // Set and populate defaults var _d = { - group : "default", style : {}, arrange : 'vertical', micropanel_position : 'right', diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html index 81a7b8ee4b1..028e7687363 100644 --- a/panels/histogram/editor.html +++ b/panels/histogram/editor.html @@ -60,7 +60,6 @@
-
Panel Spy
diff --git a/panels/histogram/module.js b/panels/histogram/module.js index 64df1a59382..78630e3d373 100644 --- a/panels/histogram/module.js +++ b/panels/histogram/module.js @@ -37,6 +37,9 @@ angular.module('kibana.histogram', []) .controller('histogram', function($scope, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Stable", description : "A bucketed time series chart of the current query or queries. Uses the "+ "Elasticsearch date_histogram facet. If using time stamped indices this panel will query"+ diff --git a/panels/hits/editor.html b/panels/hits/editor.html index 68b2b845bc1..ee68d06624b 100644 --- a/panels/hits/editor.html +++ b/panels/hits/editor.html @@ -26,7 +26,6 @@
-
Panel Spy
diff --git a/panels/hits/module.js b/panels/hits/module.js index a204bd8bd90..271ebc10a09 100644 --- a/panels/hits/module.js +++ b/panels/hits/module.js @@ -21,6 +21,9 @@ angular.module('kibana.hits', []) .controller('hits', function($scope, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Stable", description : "The total hits for a query or set of queries. Can be a pie chart, bar chart, "+ "list, or absolute total of all queries combined" diff --git a/panels/map/editor.html b/panels/map/editor.html index 83045f1d5e2..d20f7c4466d 100644 --- a/panels/map/editor.html +++ b/panels/map/editor.html @@ -1,9 +1,3 @@ -
-
- The map panel uses 2 letter country or US state codes to plot concentrations on a map. Darker terroritories mean more records matched that area. If multiple queries are sent from a single panel the first query will be displayed -
-
-
@@ -15,7 +9,6 @@
-
Panel Spy
diff --git a/panels/map/module.js b/panels/map/module.js index a95c1df1b41..9737b6022ec 100644 --- a/panels/map/module.js +++ b/panels/map/module.js @@ -23,6 +23,9 @@ angular.module('kibana.map', []) .controller('map', function($scope, $rootScope, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Stable", description : "Displays a map of shaded regions using a field containing a 2 letter country "+ ", or US state, code. Regions with more hit are shaded darker. Node that this does use the"+ diff --git a/panels/pie/editor.html b/panels/pie/editor.html index fd826c1c69d..d650cbdf80d 100644 --- a/panels/pie/editor.html +++ b/panels/pie/editor.html @@ -48,7 +48,6 @@
-
Panel Spy
diff --git a/panels/pie/module.js b/panels/pie/module.js index 6311ae16d0a..fb8386b8230 100644 --- a/panels/pie/module.js +++ b/panels/pie/module.js @@ -33,6 +33,9 @@ angular.module('kibana.pie', []) // Set and populate defaults var _d = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], query : { field:"_type", goal: 100}, queries : { mode : 'all', diff --git a/panels/query/module.js b/panels/query/module.js index a15cf30ca1c..f43306d693e 100644 --- a/panels/query/module.js +++ b/panels/query/module.js @@ -60,4 +60,6 @@ angular.module('kibana.query', []) } }; + $scope.init(); + }); \ No newline at end of file diff --git a/panels/table/editor.html b/panels/table/editor.html index 7a2248546aa..d31ed8e912c 100644 --- a/panels/table/editor.html +++ b/panels/table/editor.html @@ -71,8 +71,7 @@
Page Overflow
-
-
+
Panel Spy
@@ -84,4 +83,3 @@ of the panel.
- diff --git a/panels/table/module.js b/panels/table/module.js index 3a6b8643796..c25f1f4cc33 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -26,6 +26,9 @@ angular.module('kibana.table', []) .controller('table', function($rootScope, $scope, fields, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status: "Stable", description: "A paginated table of records matching your query or queries. Click on a row to "+ "expand it and review all of the fields associated with that document.

" @@ -221,7 +224,7 @@ angular.module('kibana.table', []) // size*pages results // Otherwise, only get size*pages results then stop querying if (($scope.data.length < $scope.panel.size*$scope.panel.pages || - !(($scope.panel.sort[0] === filterSrv.timeField()) && $scope.panel.sort[1] === 'desc')) && + !((_.contains(filterSrv.timeField(),$scope.panel.sort[0])) && $scope.panel.sort[1] === 'desc')) && _segment+1 < dashboard.indices.length) { $scope.get_data(_segment+1,$scope.query_id); } diff --git a/panels/terms/editor.html b/panels/terms/editor.html index a1371c764f7..7c6757502b9 100644 --- a/panels/terms/editor.html +++ b/panels/terms/editor.html @@ -50,7 +50,6 @@

-
Panel Spy
diff --git a/panels/terms/module.js b/panels/terms/module.js index e8d72d4ae43..cefde518bb4 100644 --- a/panels/terms/module.js +++ b/panels/terms/module.js @@ -22,6 +22,9 @@ angular.module('kibana.terms', []) .controller('terms', function($scope, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Beta", description : "Displays the results of an elasticsearch facet as a pie chart, bar chart, or a "+ "table" diff --git a/panels/timepicker/module.js b/panels/timepicker/module.js index cb50ac8b064..6c398847b04 100644 --- a/panels/timepicker/module.js +++ b/panels/timepicker/module.js @@ -43,9 +43,6 @@ angular.module('kibana.timepicker', []) }; _.defaults($scope.panel,_d); - var _groups = _.isArray($scope.panel.group) ? - $scope.panel.group : [$scope.panel.group]; - $scope.init = function() { // Private refresh interval that we can use for view display without causing // unnecessary refreshes during changes diff --git a/panels/trends/editor.html b/panels/trends/editor.html index a14f519d0cd..74d34122258 100644 --- a/panels/trends/editor.html +++ b/panels/trends/editor.html @@ -26,5 +26,4 @@
-
diff --git a/panels/trends/module.js b/panels/trends/module.js index abf88a9c07b..9624ed94ae8 100644 --- a/panels/trends/module.js +++ b/panels/trends/module.js @@ -17,6 +17,9 @@ angular.module('kibana.trends', []) .controller('trends', function($scope, kbnIndex, querySrv, dashboard, filterSrv) { $scope.panelMeta = { + editorTabs : [ + {title:'Queries', src:'partials/querySelect.html'} + ], status : "Beta", description : "A stock-ticker style representation of how queries are moving over time. "+ "For example, if the time is 1:10pm, your time picker was set to \"Last 10m\", and the \"Time "+ diff --git a/partials/dasheditor.html b/partials/dasheditor.html index 0bdb6b6ee88..c520e70bd64 100644 --- a/partials/dasheditor.html +++ b/partials/dasheditor.html @@ -2,7 +2,7 @@
Dashboard settings
-
+
@@ -86,11 +86,11 @@
-
-
+ \ No newline at end of file diff --git a/partials/inspector.html b/partials/inspector.html index 08973474a87..0b2ebe622dd 100644 --- a/partials/inspector.html +++ b/partials/inspector.html @@ -1,11 +1,10 @@