Skip to content

Commit

Permalink
HUE-9291 [editor] Add a default limit of 1000 records for streaming d…
Browse files Browse the repository at this point in the history
…ata in the result grid
  • Loading branch information
JohanAhlen committed May 15, 2020
1 parent 7a5f68f commit 470290b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ const TEMPLATE = `
</div>
`;

const STREAMING_MAX_ROWS = 1000;

class ResultGrid extends DisposableComponent {
constructor(params, element) {
super();
Expand Down Expand Up @@ -581,7 +583,8 @@ class ResultGrid extends DisposableComponent {
dataTable.fnAddData(
initial && this.data().length ? this.data() : this.lastFetchedRows(),
undefined,
this.streaming
this.streaming,
STREAMING_MAX_ROWS
);
} catch (e) {}
const $dataTablesWrapper = $snippet.find('.dataTables_wrapper');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,15 +640,18 @@ $.fn.hueDataTable = function(oInit) {
}
};

self.fnAddData = function(mData, bRedraw, reverse) {
self.fnAddData = function(mData, bRedraw, streaming, streamRecordLimit) {
const $t = self.$table;

if ($t) {
const aoColumns = $t.data('aoColumns') || [];
$t.data(
'data',
reverse ? mData.reverse().concat($t.data('data')) : $t.data('data').concat(mData)
);
const newData = streaming
? mData.reverse().concat($t.data('data'))
: $t.data('data').concat(mData);
if (streaming && streamRecordLimit) {
newData.splice(streamRecordLimit);
}
$t.data('data', newData);

if (mData.length === 0) {
return;
Expand Down

0 comments on commit 470290b

Please sign in to comment.