From 300cb58fa464eb1807e3e28b31f1f7ca2f2a5566 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Sat, 6 Apr 2013 23:42:34 -0700 Subject: [PATCH] Clean up panel editors, fix render on panel height change --- js/controllers.js | 6 +++--- panels/histogram/editor.html | 20 ++++++++++++------- panels/histogram/module.html | 2 +- panels/histogram/module.js | 36 ++++++++++++++++------------------- panels/hits/editor.html | 4 ++-- panels/hits/module.html | 2 +- panels/timepicker/module.html | 2 +- panels/timepicker/module.js | 8 ++------ partials/paneleditor.html | 2 +- partials/roweditor.html | 2 +- 10 files changed, 41 insertions(+), 43 deletions(-) diff --git a/js/controllers.js b/js/controllers.js index 701c1293632..445aa9b8e54 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -109,9 +109,9 @@ angular.module('kibana.controllers', []) } } - $scope.close_modal = function() { - // Dummy function, available for overriding in child scopes. For example - // a panel might want to broadcast an event when a modal is closed + // This can be overridden by individual panel + $scope.close_edit = function() { + $scope.$broadcast('render') } $scope.add_panel = function(row,panel) { diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html index 76fdca5733d..f960df0abfd 100644 --- a/panels/histogram/editor.html +++ b/panels/histogram/editor.html @@ -32,19 +32,25 @@ -
-
- - -
-
+
Chart Options
+
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/panels/histogram/module.html b/panels/histogram/module.html index 406c061d576..a55a25c6996 100644 --- a/panels/histogram/module.html +++ b/panels/histogram/module.html @@ -7,7 +7,7 @@ Zoom In Zoom Out | - +
{{series.label}} ({{series.hits}})
per {{panel.interval}} | ({{hits}} total) diff --git a/panels/histogram/module.js b/panels/histogram/module.js index c2049e80f17..f40dcbf5ffb 100644 --- a/panels/histogram/module.js +++ b/panels/histogram/module.js @@ -3,15 +3,21 @@ angular.module('kibana.histogram', []) // Set and populate defaults var _d = { + group : "default", query : [ {query: "*", label:"Query"} ], interval : secondsToHms(calculate_interval($scope.from,$scope.to,40,0)/1000), - show : ['bars','y-axis','x-axis','legend'], fill : 3, linewidth : 3, timezone : 'browser', // browser, utc or a standard timezone spyable : true, zoomlinks : true, - group : "default", + bars : true, + stack : true, + points : false, + lines : false, + legend : true, + 'x-axis' : true, + 'y-axis' : true, } _.defaults($scope.panel,_d) @@ -204,17 +210,6 @@ angular.module('kibana.histogram', []) // Function for rendering panel function render_panel() { // Determine format - var show = _.isUndefined(scope.panel.show) ? { - bars: true, lines: false, points: false - } : { - lines: _.indexOf(scope.panel.show,'lines') < 0 ? false : true, - bars: _.indexOf(scope.panel.show,'bars') < 0 ? false : true, - points: _.indexOf(scope.panel.show,'points') < 0 ? false : true, - stack: _.indexOf(scope.panel.show,'stack') < 0 ? null : true, - legend: _.indexOf(scope.panel.show,'legend') < 0 ? false : true, - 'x-axis': _.indexOf(scope.panel.show,'x-axis') < 0 ? false : true, - 'y-axis': _.indexOf(scope.panel.show,'y-axis') < 0 ? false : true, - } // Set barwidth based on specified interval var barwidth = interval_to_seconds(scope.panel.interval)*1000 @@ -227,6 +222,7 @@ angular.module('kibana.histogram', []) // Populate element. Note that jvectormap appends, does not replace. scripts.wait(function(){ + var stack = scope.panel.stack ? true : null; // Populate element try { @@ -235,21 +231,21 @@ angular.module('kibana.histogram', []) show: false, }, series: { - stack: show.stack, + stack: stack, lines: { - show: show.lines, + show: scope.panel.lines, fill: scope.panel.fill/10, lineWidth: scope.panel.linewidth, - steps: true + steps: false }, - bars: { show: show.bars, fill: 1, barWidth: barwidth/1.8 }, - points: { show: show.points, fill: 1, fillColor: false}, + bars: { show: scope.panel.bars, fill: 1, barWidth: barwidth/1.8 }, + points: { show: scope.panel.points, fill: 1, fillColor: false}, shadowSize: 1 }, - yaxis: { show: show['y-axis'], min: 0, color: "#000" }, + yaxis: { show: scope.panel['y-axis'], min: 0, color: "#000" }, xaxis: { timezone: scope.panel.timezone, - show: show['x-axis'], + show: scope.panel['x-axis'], mode: "time", timeformat: time_format(scope.panel.interval), label: "Datetime", diff --git a/panels/hits/editor.html b/panels/hits/editor.html index 0c21fcb206a..c51df1a2c1a 100644 --- a/panels/hits/editor.html +++ b/panels/hits/editor.html @@ -1,13 +1,13 @@
-
+
- +
diff --git a/panels/hits/module.html b/panels/hits/module.html index 809aea771b0..d016a7bfb19 100644 --- a/panels/hits/module.html +++ b/panels/hits/module.html @@ -10,5 +10,5 @@
{{query.label}} ({{query.hits}}) |

-
+
\ No newline at end of file diff --git a/panels/timepicker/module.html b/panels/timepicker/module.html index 59619a20bc6..2d31d62b3b2 100644 --- a/panels/timepicker/module.html +++ b/panels/timepicker/module.html @@ -23,7 +23,7 @@
-
+
diff --git a/panels/timepicker/module.js b/panels/timepicker/module.js index 809df1f7f88..a07a1070488 100644 --- a/panels/timepicker/module.js +++ b/panels/timepicker/module.js @@ -111,10 +111,6 @@ angular.module('kibana.timepicker', []) } $scope.time_apply(); }); - - $scope.$on('render', function (){ - $scope.time_apply(); - }); } $scope.set_interval = function (refresh_interval) { @@ -167,8 +163,8 @@ angular.module('kibana.timepicker', []) $scope.time_apply(); } - $scope.close_modal = function() { - $scope.$broadcast('render'); + $scope.close_edit = function() { + $scope.time_apply(); } $scope.time_check = function(){ diff --git a/partials/paneleditor.html b/partials/paneleditor.html index c24857560a1..8b445b73bea 100644 --- a/partials/paneleditor.html +++ b/partials/paneleditor.html @@ -13,5 +13,5 @@
\ No newline at end of file diff --git a/partials/roweditor.html b/partials/roweditor.html index 3142c6d35f6..59bf6e18fda 100644 --- a/partials/roweditor.html +++ b/partials/roweditor.html @@ -56,5 +56,5 @@
\ No newline at end of file