diff --git a/dashboards.js b/dashboards.js index c5f34581685..1e529dbadd5 100644 --- a/dashboards.js +++ b/dashboards.js @@ -193,8 +193,8 @@ var dashboards = labels : false, colors : ['#BF3030','#1D7373','#86B32D','#A60000','#006363','#679B00'], field : 'country', - //query : { query: "*", field: "country"} - query : { field : "play_name", query : "*" }, + mode : "query", + query : { query:"falstaff" } }, { type : "text", diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html index e69de29bb2d..879707e9068 100644 --- a/panels/histogram/editor.html +++ b/panels/histogram/editor.html @@ -0,0 +1,43 @@ +
+
+
+
Label
+ +
+
+
+
+
Query
+ + +
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+
+
+
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/panels/histogram/module.js b/panels/histogram/module.js index 6613fdbe17d..2e239bbaab1 100644 --- a/panels/histogram/module.js +++ b/panels/histogram/module.js @@ -5,9 +5,8 @@ angular.module('kibana.histogram', []) // Set and populate defaults var _d = { - query : "*", + query : { query: "*" }, interval: secondsToHms(calculate_interval($scope.from,$scope.to,40,0)/1000), - color : "#27508C", show : ['bars'], fill : false, group : "default", @@ -24,6 +23,18 @@ angular.module('kibana.histogram', []) eventBus.broadcast($scope.$id,$scope.panel.group,'get_time') } + $scope.remove_query = function(q) { + $scope.panel.query = _.without($scope.panel.query,q); + } + + $scope.add_query = function(label,query) { + $scope.panel.query.unshift({ + query: query, + label: label, + }); + $scope.get_data(); + } + $scope.get_data = function() { // Make sure we have everything for the request to complete if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.panel.time)) @@ -68,7 +79,7 @@ angular.module('kibana.histogram', []) data.push([$scope.panel.time.to.getTime(), null]) var series = { data: { - label: $scope.panel.query[k].label, + label: $scope.panel.query[k].label || k, data: data, }}; diff --git a/panels/pie/editor.html b/panels/pie/editor.html index 897a4ce1318..cb2932a2ec7 100644 --- a/panels/pie/editor.html +++ b/panels/pie/editor.html @@ -1,18 +1,68 @@ -

{{panel.type}} panel settings

-
-
-
-
Field
- - -
+
+
+
+
+
+
Field
+ +
+
+
+
+
Query
+ + +
+
+
+
+
+
Length
+ +
+
+
+
Exclude Terms(s) (comma seperated)
+ + +
+
+
-
-
-
Query
- - -
+
+
+
+
+
+
+
Label
+ +
+
+
+
+
Query
+ + +
+
+
+
+
+ +
+
+
+ +
+
+
+
+ + +
+
+
@@ -28,15 +78,8 @@
-
-
-
-
Sort
- - -
-
-
Length
- +
+ +
\ No newline at end of file diff --git a/panels/pie/module.js b/panels/pie/module.js index c5078f81dcc..a4c6786c02f 100644 --- a/panels/pie/module.js +++ b/panels/pie/module.js @@ -8,29 +8,41 @@ angular.module('kibana.pie', []) // Set and populate defaults var _d = { - query : "*", + query : { field:"_all", query:"*" }, size : 100, exclude : [], donut : false, tilt : false, legend : true, labels : true, - group : "default" + mode : "terms", + group : "default", + default_field : '_all' } _.defaults($scope.panel,_d) $scope.init = function() { eventBus.register($scope,'time', function(event,time){set_time(time)}); - if(!(_.isArray($scope.panel.query))) { - eventBus.register($scope,'query', function(event, query) { + eventBus.register($scope,'query', function(event, query) { + if($scope.panel.mode === 'terms') { $scope.panel.query.query = query; $scope.get_data(); - }); - } + } + }); // Now that we're all setup, request the time from our group eventBus.broadcast($scope.$id,$scope.panel.group,'get_time') } + $scope.add_query = function(label,query) { + if($scope.panel.mode !== 'query') + return false; + $scope.panel.query.unshift({ + query: query, + label: label, + }); + $scope.get_data(); + } + $scope.get_data = function() { // Make sure we have everything for the request to complete if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.panel.time)) @@ -39,7 +51,9 @@ angular.module('kibana.pie', []) var request = $scope.ejs.Request().indices($scope.panel.index); // If we have an array, use query facet - if(_.isArray($scope.panel.query)) { + if($scope.panel.mode == "query") { + if(!(_.isArray($scope.panel.query))) + $scope.panel.query = [$scope.panel.query]; var queries = []; // Build the question part of the query _.each($scope.panel.query, function(v) { @@ -66,7 +80,9 @@ angular.module('kibana.pie', []) $scope.data = []; _.each(results.facets, function(v, k) { var series = {}; - var slice = { label : $scope.panel.query[k].label, data : v.count }; + var label = _.isUndefined($scope.panel.query[k].label) ? + $scope.panel.query[k].query : $scope.panel.query[k].label + var slice = { label : label, data : v.count }; if (!(_.isUndefined($scope.panel.query[k].color))) slice.color = $scope.panel.query[k].color; $scope.data.push(slice) @@ -76,7 +92,7 @@ angular.module('kibana.pie', []) } else { var results = request .facet(ejs.TermsFacet('pie') - .field($scope.panel.query.field) + .field($scope.panel.query.field || $scope.panel.default_field) .size($scope.panel['size']) .exclude($scope.panel.exclude) .facetFilter(ejs.QueryFilter(