Skip to content

Commit

Permalink
[Discover] Deactivate client-side pagination for ES|QL results (elast…
Browse files Browse the repository at this point in the history
…ic#189715)

- Closes elastic#189489

## Summary

This PR deactivates client-side pagination for ES|QL results so they
will not be split into pages but shown all at once in the grid. Affected
pages: Discover, Dashboard.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
jughosta authored Aug 5, 2024
1 parent 22ac46c commit e1e0eb4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/kbn-unified-data-table/src/components/data_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,15 @@ export const UnifiedDataTable = ({
valueToStringConverter,
componentsTourSteps,
isPlainRecord,
pageIndex: paginationObj?.pageIndex,
pageSize: paginationObj?.pageSize,
pageIndex: isPaginationEnabled ? paginationObj?.pageIndex : 0,
pageSize: isPaginationEnabled ? paginationObj?.pageSize : displayedRows.length,
}),
[
componentsTourSteps,
darkMode,
dataView,
isPlainRecord,
isPaginationEnabled,
displayedRows,
expandedDoc,
onFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ function DiscoverDocumentsComponent({
onUpdateRowHeight={onUpdateRowHeight}
isSortEnabled={true}
isPlainRecord={isEsqlMode}
isPaginationEnabled={!isEsqlMode}
rowsPerPageState={rowsPerPage ?? getDefaultRowsPerPage(services.uiSettings)}
onUpdateRowsPerPage={onUpdateRowsPerPage}
maxAllowedSampleSize={getMaxAllowedSampleSize(services.uiSettings)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export function DiscoverGridEmbeddable(props: DiscoverGridEmbeddableProps) {
>
<DiscoverGridMemoized
{...gridProps}
isPaginationEnabled={!gridProps.isPlainRecord}
totalHits={props.totalHitCount}
setExpandedDoc={setExpandedDoc}
expandedDoc={expandedDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const dataGrid = getService('dataGrid');
const PageObjects = getPageObjects(['settings', 'common', 'discover', 'header', 'timePicker']);
const PageObjects = getPageObjects([
'settings',
'common',
'discover',
'header',
'timePicker',
'dashboard',
]);
const defaultSettings = {
defaultIndex: 'logstash-*',
'discover:rowHeightOption': 0, // single line
};
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const security = getService('security');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('discover data grid pagination', function describeIndexTests() {
before(async () => {
Expand Down Expand Up @@ -119,5 +127,45 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect((await dataGrid.getDocTableRows()).length).to.be(10); // as in the saved search
await dataGrid.checkCurrentRowsPerPageToBe(10);
});

it('should not split ES|QL results into pages', async () => {
const rowsPerPage = 5;
const savedSearchESQL = 'testESQLPagination';
await kibanaServer.uiSettings.update({
...defaultSettings,
'discover:sampleRowsPerPage': rowsPerPage,
hideAnnouncements: true,
});

await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();

// expect pagination to be present for data view mode
expect((await dataGrid.getDocTableRows()).length).to.be(rowsPerPage);
await dataGrid.checkCurrentRowsPerPageToBe(rowsPerPage);
await testSubjects.existOrFail('pagination-button-0');

await PageObjects.discover.selectTextBaseLang();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.discover.waitUntilSearchingHasFinished();

// expect no pagination for ES|QL mode
expect((await dataGrid.getDocTableRows()).length).to.above(rowsPerPage);
await testSubjects.missingOrFail('pagination-button-0');

await PageObjects.discover.saveSearch(savedSearchESQL);

await PageObjects.common.navigateToApp('dashboard');

await PageObjects.dashboard.clickNewDashboard();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await dashboardAddPanel.clickOpenAddPanel();
await dashboardAddPanel.addSavedSearch(savedSearchESQL);
await PageObjects.header.waitUntilLoadingHasFinished();

// expect no pagination for ES|QL mode on Dashboard
expect((await dataGrid.getDocTableRows()).length).to.above(rowsPerPage);
await testSubjects.missingOrFail('pagination-button-0');
});
});
}

0 comments on commit e1e0eb4

Please sign in to comment.