diff --git a/common/css/main.css b/common/css/main.css index 5d8ad777f2c..4593e870240 100644 --- a/common/css/main.css +++ b/common/css/main.css @@ -60,6 +60,7 @@ margin: 0px; } + [ng\:cloak], [ng-cloak], .ng-cloak { display: none !important; } diff --git a/panels/derivequeries/module.js b/panels/derivequeries/module.js index 6d00706c8d1..fab94a8a177 100644 --- a/panels/derivequeries/module.js +++ b/panels/derivequeries/module.js @@ -83,7 +83,6 @@ angular.module('kibana.derivequeries', []) _.each(results.facets.query.terms, function(v) { data.push($scope.panel.field+':"'+v.term+'"') }); - console.log(data) $scope.send_query(data) }); } @@ -121,4 +120,4 @@ angular.module('kibana.derivequeries', []) -}); \ No newline at end of file +}); diff --git a/panels/table/editor.html b/panels/table/editor.html index e039eaf6a3b..7dc73fac8f7 100644 --- a/panels/table/editor.html +++ b/panels/table/editor.html @@ -16,10 +16,23 @@
-
Selected fields Click to remove
+
Columns Click to remove
{{field}}
+
+
+
+
Add field
+ + +
+
+
+
Highlighted fields Click to remove
+ {{field}} +
+
Options
diff --git a/panels/table/module.html b/panels/table/module.html index ad8062e29c4..4749259415c 100644 --- a/panels/table/module.html +++ b/panels/table/module.html @@ -35,8 +35,8 @@ - - {{row[field]}} + + @@ -46,7 +46,7 @@ Action Value - + {{key}} @@ -59,7 +59,7 @@ -
> +
diff --git a/panels/table/module.js b/panels/table/module.js index b7b7c8f4665..580aa988bd6 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -39,6 +39,7 @@ angular.module('kibana.table', []) group : "default", style : {'font-size': '9pt'}, fields : [], + highlight : [], sortable: true, header : true, paging : true, @@ -92,6 +93,13 @@ angular.module('kibana.table', []) broadcast_results(); } + $scope.toggle_highlight = function(field) { + if (_.indexOf($scope.panel.highlight,field) > -1) + $scope.panel.highlight = _.without($scope.panel.highlight,field) + else + $scope.panel.highlight.push(field) + } + $scope.toggle_details = function(row) { row.kibana = row.kibana || {}; row.kibana.details = !row.kibana.details ? $scope.without_kibana(row) : false; @@ -129,6 +137,12 @@ angular.module('kibana.table', []) .to($scope.time.to) ) ) + .highlight( + ejs.Highlight($scope.panel.highlight) + .fragmentSize(2147483647) // Max size of a 32bit unsigned int + .preTags('@start-highlight@') + .postTags('@end-highlight@') + ) .size($scope.panel.size*$scope.panel.pages) .sort($scope.panel.sort[0],$scope.panel.sort[1]); @@ -155,14 +169,17 @@ angular.module('kibana.table', []) // Check that we're still on the same query, if not stop if($scope.query_id === query_id) { $scope.data= $scope.data.concat(_.map(results.hits.hits, function(hit) { - return flatten_json(hit['_source']); + return { + _source : flatten_json(hit['_source']), + highlight : flatten_json(hit['highlight']||{}) + } })); $scope.hits += results.hits.total; // Sort the data $scope.data = _.sortBy($scope.data, function(v){ - return v[$scope.panel.sort[0]] + return v._source[$scope.panel.sort[0]] }); // Reverse if needed @@ -177,7 +194,7 @@ angular.module('kibana.table', []) } // This breaks, use $scope.data for this - $scope.all_fields = get_all_fields($scope.data); + $scope.all_fields = get_all_fields(_.pluck($scope.data,'_source')); broadcast_results(); // If we're not sorting in reverse chrono order, query every index for @@ -205,9 +222,10 @@ angular.module('kibana.table', []) } $scope.without_kibana = function (row) { - row = _.clone(row) - delete row.kibana - return row + return { + _source : row._source, + highlight : row.highlight + } } // Broadcast a list of all fields. Note that receivers of field array @@ -222,15 +240,39 @@ angular.module('kibana.table', []) eventBus.broadcast($scope.$id,$scope.panel.group,"table_documents", { query: $scope.panel.query, - docs : $scope.data, + docs : _.pluck($scope.data,'_source'), index: $scope.index }); } + $scope.set_refresh = function (state) { + $scope.refresh = state; + } + + $scope.close_edit = function() { + if($scope.refresh) + $scope.get_data(); + $scope.refresh = false; + } + + function set_time(time) { $scope.time = time; $scope.index = _.isUndefined(time.index) ? $scope.index : time.index $scope.get_data(); } +}) +.filter('highlight', function() { + return function(text) { + if (text.toString().length) { + return text.toString(). + replace(/&/g, '&'). + replace(//g, '>'). + replace(/@start-highlight@/g, ''). + replace(/@end-highlight@/g, '') + } + return ''; + } }); \ No newline at end of file