diff --git a/js/controllers.js b/js/controllers.js
index 197b48b3ed2..5681e920e32 100644
--- a/js/controllers.js
+++ b/js/controllers.js
@@ -9,6 +9,7 @@ angular.module('kibana.controllers', [])
title: "",
editable: true,
rows: [],
+ last: null
}
$scope.init = function() {
@@ -24,7 +25,8 @@ angular.module('kibana.controllers', [])
// Load dashboard by event
eventBus.register($scope,'dashboard', function(event,dashboard){
- $scope.dashboards = dashboard;
+ $scope.dashboards = dashboard.dashboard;
+ $scope.dashboards.last = dashboard.last;
_.defaults($scope.dashboards,_d)
})
diff --git a/panels/dashcontrol/module.js b/panels/dashcontrol/module.js
index fcef5a44e48..23eee0edd99 100644
--- a/panels/dashcontrol/module.js
+++ b/panels/dashcontrol/module.js
@@ -271,8 +271,10 @@ angular.module('kibana.dashcontrol', [])
$scope.dash_load = function(dashboard) {
if(!_.isObject(dashboard))
dashboard = JSON.parse(dashboard)
-
- eventBus.broadcast($scope.$id,'ALL','dashboard',dashboard)
+ eventBus.broadcast($scope.$id,'ALL','dashboard',{
+ dashboard : dashboard,
+ last : $scope.dashboards
+ })
timer.cancel_all();
}
@@ -287,7 +289,6 @@ angular.module('kibana.dashcontrol', [])
else
return false
}
-
})
.directive('dashUpload', function(timer, eventBus){
return {
diff --git a/panels/fields/module.js b/panels/fields/module.js
index 3b21f6d4d97..9d74a6b63a7 100644
--- a/panels/fields/module.js
+++ b/panels/fields/module.js
@@ -40,6 +40,7 @@ angular.module('kibana.fields', [])
eventBus.register($scope,'table_documents', function(event, docs) {
$scope.panel.query = docs.query;
$scope.docs = docs.docs;
+ $scope.index = docs.index;
});
eventBus.register($scope,"get_fields", function(event,id) {
eventBus.broadcast($scope.$id,$scope.panel.group,"selected_fields",$scope.active);
diff --git a/panels/histogram/editor.html b/panels/histogram/editor.html
index 68d0c4663ff..36c83046bb8 100644
--- a/panels/histogram/editor.html
+++ b/panels/histogram/editor.html
@@ -1,14 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+ In {{panel.mode}} mode the configured field must be a numeric type
+
+
+
diff --git a/panels/histogram/module.html b/panels/histogram/module.html
index eb96ada8a8e..837aa5e597f 100644
--- a/panels/histogram/module.html
+++ b/panels/histogram/module.html
@@ -11,7 +11,7 @@
{{series.label}} ({{series.hits}})
-
per {{panel.interval}} | ({{hits}} total)
+
{{panel.value_field}} {{panel.mode}} per {{panel.interval}} | ({{hits}} hits)
diff --git a/panels/histogram/module.js b/panels/histogram/module.js
index 81ed0e62791..54784a57a0b 100644
--- a/panels/histogram/module.js
+++ b/panels/histogram/module.js
@@ -45,6 +45,8 @@ angular.module('kibana.histogram', [])
var _d = {
group : "default",
query : [ {query: "*", label:"Query"} ],
+ mode : 'count',
+ value_field: null,
auto_int : true,
interval : '5m',
fill : 3,
@@ -124,12 +126,20 @@ angular.module('kibana.histogram', [])
// Build the facet part, injecting the query in as a facet filter
_.each(queries, function(v) {
- request = request
- .facet($scope.ejs.DateHistogramFacet("chart"+_.indexOf(queries,v))
- .field($scope.time.field)
- .interval($scope.panel.interval)
- .facetFilter($scope.ejs.QueryFilter(v))
- ).size(0)
+
+ var facet = $scope.ejs.DateHistogramFacet("chart"+_.indexOf(queries,v))
+
+ if($scope.panel.mode === 'count') {
+ facet = facet.field($scope.time.field)
+ } else {
+ if(_.isNull($scope.panel.value_field)) {
+ $scope.panel.error = "In " + $scope.panel.mode + " mode a field must be specified";
+ return
+ }
+ facet = facet.keyField($scope.time.field).valueField($scope.panel.value_field)
+ }
+ facet = facet.interval($scope.panel.interval).facetFilter($scope.ejs.QueryFilter(v))
+ request = request.facet(facet).size(0)
})
// Populate the inspector panel
@@ -171,14 +181,12 @@ angular.module('kibana.histogram', [])
// Assemble segments
var segment_data = [];
_.each(v.entries, function(v, k) {
- segment_data.push([v['time'],v['count']])
+ segment_data.push([v['time'],v[$scope.panel.mode]])
hits += v['count']; // The series level hits counter
$scope.hits += v['count']; // Entire dataset level hits counter
});
-
data.splice.apply(data,[1,0].concat(segment_data)) // Join histogram data
-
// Create the flot series object
var series = {
data: {
diff --git a/panels/stringquery/editor.html b/panels/stringquery/editor.html
index 4e3948556fb..4b95d42f397 100644
--- a/panels/stringquery/editor.html
+++ b/panels/stringquery/editor.html
@@ -1,7 +1,7 @@
-
+
diff --git a/panels/table/module.js b/panels/table/module.js
index 70c6b281dca..b7b7c8f4665 100644
--- a/panels/table/module.js
+++ b/panels/table/module.js
@@ -70,10 +70,10 @@ angular.module('kibana.table', [])
eventBus.register($scope,'selected_fields', function(event, fields) {
$scope.panel.fields = _.clone(fields)
});
- eventBus.register($scope,'table_documents', function(event, docs) {
- $scope.panel.query = docs.query;
- $scope.data = docs.docs;
- });
+ eventBus.register($scope,'table_documents', function(event, docs) {
+ $scope.panel.query = docs.query;
+ $scope.data = docs.docs;
+ });
}
$scope.set_sort = function(field) {
@@ -220,7 +220,11 @@ angular.module('kibana.table', [])
active: $scope.panel.fields
});
eventBus.broadcast($scope.$id,$scope.panel.group,"table_documents",
- {query:$scope.panel.query,docs:$scope.data});
+ {
+ query: $scope.panel.query,
+ docs : $scope.data,
+ index: $scope.index
+ });
}
function set_time(time) {