From d51a9b5cdd0a862cb58aae5bd71ef6601a35ca4d Mon Sep 17 00:00:00 2001 From: fbaligand Date: Sun, 25 Feb 2018 19:02:54 +0100 Subject: [PATCH] backport official 'Data Table' last changes --- public/enhanced-table-vis-controller.js | 14 +++++++------- public/enhanced-table-vis.html | 8 ++++---- public/enhanced-table-vis.js | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/public/enhanced-table-vis-controller.js b/public/enhanced-table-vis-controller.js index f2f98ab4..bcf612dc 100644 --- a/public/enhanced-table-vis-controller.js +++ b/public/enhanced-table-vis-controller.js @@ -206,20 +206,21 @@ module.controller('EnhancedTableVisController', function ($scope, Private, confi /** * Recreate the entire table when: - * - the underlying data changes (esResponse) + * - table 'renderComplete' event (renderComplete) * - user submits a new filter to apply on results (activeFilter) */ - $scope.$watchMulti(['esResponse', 'activeFilter'], function ([resp]) { + $scope.$watchMulti(['renderComplete', 'activeFilter'], function () { let tableGroups = $scope.tableGroups = null; let hasSomeRows = $scope.hasSomeRows = null; + let esResponse = $scope.esResponse; - if (resp) { + if (esResponse) { const vis = $scope.vis; const params = vis.params; // create tableGroups - tableGroups = tabifyAggResponse(vis, resp, { + tableGroups = tabifyAggResponse(vis, esResponse, { partialRows: params.showPartialRows, minimalColumns: vis.isHierarchical() && !params.showMeticsAtAllLevels, asAggConfigResults: true @@ -230,7 +231,7 @@ module.controller('EnhancedTableVisController', function ($scope, Private, confi if (computedColumn.enabled) { let parser = createParser(computedColumn); let newColumn = createColumn(computedColumn, index); - createTables(tableGroups.tables, computedColumn, index, parser, newColumn, resp.hits.total); + createTables(tableGroups.tables, computedColumn, index, parser, newColumn, esResponse.hits.total); } }); @@ -262,13 +263,12 @@ module.controller('EnhancedTableVisController', function ($scope, Private, confi 'hide-pagination': !showPagination, 'hide-export-links': params.hideExportLinks }; - - $scope.renderComplete(); } $scope.hasSomeRows = hasSomeRows; if (hasSomeRows) { $scope.tableGroups = tableGroups; } + $scope.renderComplete(); }); }); diff --git a/public/enhanced-table-vis.html b/public/enhanced-table-vis.html index 22290a34..0758afb7 100644 --- a/public/enhanced-table-vis.html +++ b/public/enhanced-table-vis.html @@ -25,11 +25,11 @@

No results found

+ show-total="visState.params.showTotal" + total-func="visState.params.totalFunc">
diff --git a/public/enhanced-table-vis.js b/public/enhanced-table-vis.js index efefe538..fd27db5a 100644 --- a/public/enhanced-table-vis.js +++ b/public/enhanced-table-vis.js @@ -37,8 +37,7 @@ function EnhancedTableVisProvider(Private) { image, description: 'Same functionality than Data Table, but with enhanced features like computed columns and filter bar.', category: CATEGORY.DATA, - template: tableVisTemplate, - params: { + visConfig: { defaults: { perPage: 10, showPartialRows: false, @@ -56,6 +55,7 @@ function EnhancedTableVisProvider(Private) { filterBarHideable: false, filterBarWidth: '25%' }, + template: tableVisTemplate }, editorConfig: { optionsTemplate: '',