diff --git a/common/css/main.css b/common/css/main.css index ede5e7fdd04..26625e8ae1a 100644 --- a/common/css/main.css +++ b/common/css/main.css @@ -6,10 +6,6 @@ color: #000; } -#upload { - display: inline-block; -} - .odd { background-color: #f9f9f9; } diff --git a/common/lib/shared.js b/common/lib/shared.js index 16e0faefd09..78f8989606e 100644 --- a/common/lib/shared.js +++ b/common/lib/shared.js @@ -30,18 +30,6 @@ function has_field(obj,field) { } } -// Retuns a sorted array with duplicates removed -function array_unique(arr) { - var sorted_arr = arr.sort(); - var results = []; - for (var i = 0; i <= arr.length - 1; i++) { - if (sorted_arr[i + 1] != sorted_arr[i]) { - results.push(sorted_arr[i]); - } - } - return results -} - function get_objids_with_field(json,field) { var objid_array = []; for (hit in json.hits.hits) { @@ -75,15 +63,14 @@ function get_objids_with_field_value(json,field,value) { return objid_array; } -function get_related_fields(json,field) { +function get_related_fields(docs,field) { var field_array = [] - for (hit in json.hits.hits) { - var obj_fields = get_object_fields(json.hits.hits[hit]) - if (_.inArray(obj_fields,field) >= 0) { - field_array.push.apply(field_array,obj_fields); - } - } - var counts = count_values_in_array(field_array); + _.each(docs, function(doc) { + var keys = _.keys(doc) + if(_.contains(keys,field)) + field_array = field_array.concat(keys) + }) + var counts = _.countBy(_.without(field_array,field),function(field){return field;}); return counts; } @@ -100,7 +87,8 @@ function recurse_field_dots(object,field) { return value; } -// Probably useless now +// Probably useless now, leaving for cases where you might not want +// a flat dot notated data structure function get_field_value(object,field,opt) { var value = recurse_field_dots(object['_source'],field); @@ -130,23 +118,13 @@ function get_field_value(object,field,opt) { return (value != null) ? value.toString() : ''; } -// Returns a big flat array of all values for a field -function get_all_values_for_field(docs,field) { - var field_array = []; - _.each(docs, function(doc,k) { - var value = doc[field] || "" - if(typeof value === 'object' && value != null) { - field_array.push.apply(field_array,value); - } else { - field_array.push(value); - } - }) - return field_array; -} - function top_field_values(docs,field,count) { - var counts = _.countBy(get_all_values_for_field(docs,field),function(field){return field;}); - return _.pairs(counts).sort(function(a, b) {return a[1] - b[1]}).reverse().slice(0,count) + var counts = _.countBy(_.pluck(docs,field),function(field){ + return _.isUndefined(field) ? '' : field; + }); + return _.pairs(counts).sort(function(a, b) { + return a[1] - b[1] + }).reverse().slice(0,count) } function add_to_query(original,field,value) { diff --git a/panels/dashcontrol/load.html b/panels/dashcontrol/load.html index 6cc0b3f379d..34dc7335524 100644 --- a/panels/dashcontrol/load.html +++ b/panels/dashcontrol/load.html @@ -1,4 +1,5 @@
+ ×
Local File
diff --git a/panels/dashcontrol/save.html b/panels/dashcontrol/save.html index 9c48852fc5c..dd1fe78c0cd 100644 --- a/panels/dashcontrol/save.html +++ b/panels/dashcontrol/save.html @@ -1,5 +1,5 @@
- + ×
Locally
diff --git a/panels/fields/micropanel.html b/panels/fields/micropanel.html index b88fdedae37..4c7ca59e9a3 100644 --- a/panels/fields/micropanel.html +++ b/panels/fields/micropanel.html @@ -1,9 +1,9 @@ ×

- Micro Analysis of {{micropanel.field}} + Micro Analysis of {{micropanel.field}} - +
{{micropanel.count}} events on this page

@@ -21,4 +21,5 @@ -
{{field[1]}}
\ No newline at end of file + +{{field}} ({{Math.round((count / micropanel.count) * 100)}}%), \ No newline at end of file diff --git a/panels/fields/module.html b/panels/fields/module.html index d753e0298cc..8a8cbceedd4 100644 --- a/panels/fields/module.html +++ b/panels/fields/module.html @@ -1,8 +1,8 @@ -
    + \ No newline at end of file diff --git a/panels/fields/module.js b/panels/fields/module.js index 622baefa710..7ff0799ef3f 100644 --- a/panels/fields/module.js +++ b/panels/fields/module.js @@ -1,5 +1,5 @@ angular.module('kibana.fields', []) -.controller('fields', function($scope, eventBus) { +.controller('fields', function($scope, eventBus, $timeout) { var _id = _.uniqueId(); @@ -7,14 +7,17 @@ angular.module('kibana.fields', []) var _d = { group : "default", style : {}, + arrange : 'vertical', + micropanel_position : 'right', } _.defaults($scope.panel,_d); $scope.init = function() { + $scope.Math = Math; $scope.fields = []; eventBus.register($scope,'fields', function(event, fields) { $scope.panel.sort = _.clone(fields.sort); - $scope.fields = _.union(fields.all,$scope.fields); + $scope.fields = fields.all, $scope.active = _.clone(fields.active); }); eventBus.register($scope,'table_documents', function(event, docs) { @@ -23,10 +26,22 @@ angular.module('kibana.fields', []) }); } + $scope.reload_list = function () { + var temp = _.clone($scope.fields); + $scope.fields = [] + $timeout(function(){ + $scope.fields = temp; + },10) + + } + $scope.toggle_micropanel = function(field) { $scope.micropanel = { field: field, - values : top_field_values($scope.docs,field,10) + values : top_field_values($scope.docs,field,10), + related : get_related_fields($scope.docs,field), + count: _.countBy($scope.docs,function(doc){ + return _.contains(_.keys(doc),field)})['true'], } } diff --git a/panels/hits/editor.html b/panels/hits/editor.html index 294e4eead23..3d1852ed454 100644 --- a/panels/hits/editor.html +++ b/panels/hits/editor.html @@ -1,4 +1,4 @@ -
    +
    Query
    diff --git a/panels/stringquery/module.html b/panels/stringquery/module.html index e17f927d3d7..1cb9265e616 100644 --- a/panels/stringquery/module.html +++ b/panels/stringquery/module.html @@ -1,7 +1,9 @@ - - + + + + \ No newline at end of file diff --git a/panels/table/module.js b/panels/table/module.js index e3df5c92094..5c03f2a4d7e 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -102,10 +102,9 @@ angular.module('kibana.table', []) } $scope.panel.error = false; $scope.hits = results.hits.total; - $scope.data = [] - _.each(results.hits.hits, function(v,k) { - $scope.data.push(flatten_json(v['_source'])) - }) + $scope.data = _.map(results.hits.hits, function(hit) { + return flatten_json(hit['_source']); + }); $scope.all_fields = get_all_fields(results); broadcast_results();