diff --git a/Gruntfile.js b/Gruntfile.js index 09f878c7acc..d333ff154e6 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -53,6 +53,17 @@ module.exports = function (grunt) { cwd:'<%= srcDir %>/vendor/bootstrap/less/', src: ['bootstrap.dark.less', 'bootstrap.light.less'], dest: '<%= tempDir %>/css/', + }, + // Compile to src when not building + src:{ + options: { + paths: ["<%= srcDir %>/vendor/bootstrap/less"], + yuicompress:true + }, + files: { + "<%= srcDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.dark.less", + "<%= srcDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/vendor/bootstrap/less/bootstrap.light.less" + } } }, cssmin: { @@ -240,12 +251,12 @@ module.exports = function (grunt) { grunt.initConfig(config); // Default task. - grunt.registerTask('default', ['jshint:source','less']); + grunt.registerTask('default', ['jshint:source','less:src']); grunt.registerTask('build', [ 'jshint:source', 'clean:on_start', 'htmlmin', - 'less', + 'less:dist', 'cssmin', 'copy:everthing_left_in_src', 'ngmin', diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js index df2f8011562..dacb59f4440 100755 --- a/src/app/components/kbn.js +++ b/src/app/components/kbn.js @@ -61,23 +61,41 @@ function($, _) { return value; }; - kbn.top_field_values = function(docs,field,count) { + kbn.top_field_values = function(docs,field,count,grouped) { var all_values = _.pluck(docs,field), - groups = {}; - + groups = {}, + counts, + hasArrays; // manually grouping into pairs allows us to keep the original value, _.each(all_values, function (value) { - var key = _.isUndefined(value) ? '' : value.toString(); - if (_.has(groups, key)) { - groups[key][1] ++; - } else { - groups[key] = [value, 1]; + var k; + if(_.isArray(value)) { + hasArrays = true; } + if(_.isArray(value) && !grouped) { + k = value; + } else { + k = _.isUndefined(value) ? '' : [value.toString()]; + } + _.each(k, function(key) { + if (_.has(groups, key)) { + groups[key][1] ++; + } else { + groups[key] = [(grouped ? value : key), 1]; + } + }); }); - return _.values(groups).sort(function(a, b) { + counts = _.values(groups).sort(function(a, b) { return a[1] - b[1]; }).reverse().slice(0,count); + + console.log(hasArrays); + + return { + counts: counts, + hasArrays : hasArrays + }; }; /** diff --git a/src/app/panels/table/micropanel.html b/src/app/panels/table/micropanel.html index 18b572fe44d..3abed9b26aa 100755 --- a/src/app/panels/table/micropanel.html +++ b/src/app/panels/table/micropanel.html @@ -3,22 +3,30 @@ Micro Analysis of {{micropanel.field}} -
{{micropanel.count}} events in the table set +
+ + {{micropanel.count}} events in the table set + + as + Groups / + Singles + + - +
- - - + + + - - + -
{{micropanel.field}}ActionCount{{micropanel.field}}ActionCount
{{{true: "__blank__", false:field[0] }[field[0] == '' || field[0] == undefined]|tableTruncate:panel.trimFactor:3}} + {{{true: "__blank__", false:field[0] }[field[0] == '' || field[0] == undefined]|tableTruncate:panel.trimFactor:3}} +