Skip to content

Commit

Permalink
[Discover] Revert default grid back to legacy (#98508)
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 30, 2021
1 parent 036821d commit a8d4145
Show file tree
Hide file tree
Showing 20 changed files with 184 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/plugins/discover/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const getUiSettings: () => Record<string, UiSettingsParams> = () => ({
name: i18n.translate('discover.advancedSettings.docTableVersionName', {
defaultMessage: 'Use legacy table',
}),
value: false,
value: true,
description: i18n.translate('discover.advancedSettings.docTableVersionDescription', {
defaultMessage:
'Discover uses a new table layout that includes better data sorting, drag-and-drop columns, and a full screen ' +
Expand Down
2 changes: 1 addition & 1 deletion test/examples/embeddables/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide
});

it('saved search', async () => {
await dashboardExpect.savedSearchRowCount(11);
await dashboardExpect.savedSearchRowCount(10);
});
});

Expand Down
28 changes: 20 additions & 8 deletions test/functional/apps/dashboard/dashboard_filter_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']);
const PageObjects = getPageObjects([
'common',
'dashboard',
'discover',
'header',
'visualize',
'timePicker',
]);

describe('dashboard filter bar', () => {
before(async () => {
Expand Down Expand Up @@ -174,13 +181,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('are added when a cell magnifying glass is clicked', async function () {
await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search');
await PageObjects.dashboard.waitForRenderComplete();
const documentCell = await dataGrid.getCellElement(1, 3);
await documentCell.click();
const expandCellContentButton = await documentCell.findByClassName(
'euiDataGridRowCell__expandButtonIcon'
);
await expandCellContentButton.click();
await testSubjects.click('filterForButton');
const isLegacyDefault = PageObjects.discover.useLegacyTable();
if (isLegacyDefault) {
await testSubjects.click('docTableCellFilter');
} else {
const documentCell = await dataGrid.getCellElement(1, 3);
await documentCell.click();
const expandCellContentButton = await documentCell.findByClassName(
'euiDataGridRowCell__expandButtonIcon'
);
await expandCellContentButton.click();
await testSubjects.click('filterForButton');
}
const filterCount = await filterBar.getFilterCount();
expect(filterCount).to.equal(1);
});
Expand Down
40 changes: 30 additions & 10 deletions test/functional/apps/dashboard/dashboard_time_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ import { PIE_CHART_VIS_NAME } from '../../page_objects/dashboard_page';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const dashboardExpect = getService('dashboardExpect');
const pieChart = getService('pieChart');
const dashboardVisualizations = getService('dashboardVisualizations');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'timePicker']);
const PageObjects = getPageObjects([
'dashboard',
'header',
'visualize',
'timePicker',
'discover',
]);
const browser = getService('browser');
const log = getService('log');
const kibanaServer = getService('kibanaServer');
Expand Down Expand Up @@ -49,16 +56,29 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
name: 'saved search',
fields: ['bytes', 'agent'],
});
const initialRows = await dataGrid.getDocTableRows();
expect(initialRows.length).to.be(11);

// Set to time range with no data
await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2000 @ 00:00:00.000',
'Jan 1, 2000 @ 01:00:00.000'
);
const noResults = await dataGrid.hasNoResults();
expect(noResults).to.be.ok();
const isLegacyDefault = await PageObjects.discover.useLegacyTable();
if (isLegacyDefault) {
await dashboardExpect.docTableFieldCount(150);

// Set to time range with no data
await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2000 @ 00:00:00.000',
'Jan 1, 2000 @ 01:00:00.000'
);
await dashboardExpect.docTableFieldCount(0);
} else {
const initialRows = await dataGrid.getDocTableRows();
expect(initialRows.length).to.above(10);

// Set to time range with no data
await PageObjects.timePicker.setAbsoluteRange(
'Jan 1, 2000 @ 00:00:00.000',
'Jan 1, 2000 @ 01:00:00.000'
);
const noResults = await dataGrid.hasNoResults();
expect(noResults).to.be.ok();
}
});

it('Timepicker start, end, interval values are set by url', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/saved_search_embeddable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const marks = $('mark')
.toArray()
.map((mark) => $(mark).text());
expect(marks.length).to.be(11);
expect(marks.length).to.above(10);
});

it('removing a filter removes highlights', async function () {
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/discover/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await kibanaServer.uiSettings.replace({});
});

it('should show the first 11 rows by default', async function () {
it('should show rows by default', async function () {
// with the default range the number of hits is ~14000
const rows = await dataGrid.getDocTableRows();
expect(rows.length).to.be(11);
expect(rows.length).to.be.above(0);
});

it('should refresh the table content when changing time window', async function () {
Expand Down
17 changes: 9 additions & 8 deletions test/functional/apps/discover/_date_nanos_mixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('shows a list of records of indices with date & date_nanos fields in the right order', async function () {
const rowData1 = await PageObjects.discover.getDocTableField(1);
expect(rowData1).to.be('Jan 1, 2019 @ 12:10:30.124000000');
const rowData2 = await PageObjects.discover.getDocTableField(2);
expect(rowData2).to.be('Jan 1, 2019 @ 12:10:30.123498765');
const rowData3 = await PageObjects.discover.getDocTableField(3);
expect(rowData3).to.be('Jan 1, 2019 @ 12:10:30.123456789');
const rowData4 = await PageObjects.discover.getDocTableField(4);
expect(rowData4).to.be('Jan 1, 2019 @ 12:10:30.123000000');
const isLegacy = await PageObjects.discover.useLegacyTable();
const rowData1 = await PageObjects.discover.getDocTableIndex(1);
expect(rowData1).to.contain('Jan 1, 2019 @ 12:10:30.124000000');
const rowData2 = await PageObjects.discover.getDocTableIndex(isLegacy ? 3 : 2);
expect(rowData2).to.contain('Jan 1, 2019 @ 12:10:30.123498765');
const rowData3 = await PageObjects.discover.getDocTableIndex(isLegacy ? 5 : 3);
expect(rowData3).to.contain('Jan 1, 2019 @ 12:10:30.123456789');
const rowData4 = await PageObjects.discover.getDocTableIndex(isLegacy ? 7 : 4);
expect(rowData4).to.contain('Jan 1, 2019 @ 12:10:30.123000000');
});
});
}
4 changes: 2 additions & 2 deletions test/functional/apps/discover/_field_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent');
});

const field = await PageObjects.discover.getDocTableField(1, 3);
expect(field).to.include.string('"og:description":');
const field = await PageObjects.discover.getDocTableIndex(1);
expect(field).to.contain('og:description');

const marks = await PageObjects.discover.getMarks();
expect(marks.length).to.be(0);
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/discover/_field_data_with_fields_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await PageObjects.discover.getDocHeader()).to.contain('relatedContent');
});

const field = await PageObjects.discover.getDocTableField(1, 3);
expect(field).to.include.string('relatedContent.url');
const field = await PageObjects.discover.getDocTableIndex(1);
expect(field).to.contain('relatedContent.url');

const marks = await PageObjects.discover.getMarks();
expect(marks.length).to.be.above(0);
Expand Down
15 changes: 5 additions & 10 deletions test/functional/apps/discover/_large_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

it('verify the large string book present', async function () {
const ExpectedDoc =
'mybookProject Gutenberg EBook of Hamlet, by William Shakespeare' +
const expectedText =
'Project Gutenberg EBook of Hamlet, by William Shakespeare' +
' This eBook is for the use of anyone anywhere in the United States' +
' and most other parts of the world at no cost and with almost no restrictions whatsoever.' +
' You may copy it, give it away or re-use it under the terms of the' +
' Project Gutenberg License included with this eBook or online at www.gutenberg.org.' +
' If you are not located in the United States,' +
' you’ll have to check the laws of the country where you are' +
' located before using this ebook.' +
' Title: Hamlet Author: William Shakespeare Release Date: November 1998 [EBook #1524]' +
' Last Updated: December 30, 2017 Language: English Character set encoding:' +
' _id:1 _type: - _index:testlargestring _score:0';
' located before using this ebook.';

let rowData;
await PageObjects.common.navigateToApp('discover');
await retry.try(async function tryingForTime() {
rowData = await PageObjects.discover.getDocTableIndex(1);
log.debug('rowData.length=' + rowData.length);
expect(rowData.substring(0, 200)).to.be(ExpectedDoc.substring(0, 200));
const rowData = await PageObjects.discover.getDocTableIndex(1);
expect(rowData).to.contain(expectedText);
});
});

Expand Down
10 changes: 6 additions & 4 deletions test/functional/apps/discover/_runtime_fields_editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from './ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
const dataGrid = getService('dataGrid');
const testSubjects = getService('testSubjects');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -100,15 +99,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

it('doc view includes runtime fields', async function () {
// navigate to doc view
await dataGrid.clickRowToggle();
const table = await PageObjects.discover.getDocTable();
const useLegacyTable = await PageObjects.discover.useLegacyTable();
await table.clickRowToggle();

// click the open action
await retry.try(async () => {
const rowActions = await dataGrid.getRowActions({ rowIndex: 0 });
const rowActions = await table.getRowActions({ rowIndex: 0 });
if (!rowActions.length) {
throw new Error('row actions empty, trying again');
}
await rowActions[0].click();
const idxToClick = useLegacyTable ? 1 : 0;
await rowActions[idxToClick].click();
});

const hasDocHit = await testSubjects.exists('doc-hit');
Expand Down
12 changes: 4 additions & 8 deletions test/functional/apps/discover/_shared_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const toasts = getService('toasts');
const deployment = getService('deployment');
const dataGrid = getService('dataGrid');

describe('shared links', function describeIndexTests() {
let baseUrl: string;
Expand Down Expand Up @@ -130,13 +129,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return url.includes('sort:!(!(%27@timestamp%27,desc))');
});

const row = await dataGrid.getRow({ rowIndex: 0 });
const firstRowText = await Promise.all(
row.map(async (cell) => await cell.getVisibleText())
);

// sorting requested by ES should be correct
expect(firstRowText).to.contain('Sep 22, 2015 @ 23:50:13.253');
await retry.waitFor('document table to contain the right timestamp', async () => {
const firstRowText = await PageObjects.discover.getDocTableIndex(1);
return firstRowText.includes('Sep 22, 2015 @ 23:50:13.253');
});
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/home/_sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
log.debug('Checking area, bar and heatmap charts rendered');
await dashboardExpect.seriesElementCount(15);
log.debug('Checking saved searches rendered');
await dashboardExpect.savedSearchRowCount(11);
await dashboardExpect.savedSearchRowCount(10);
log.debug('Checking input controls rendered');
await dashboardExpect.inputControlItemCount(3);
log.debug('Checking tag cloud rendered');
Expand Down
18 changes: 12 additions & 6 deletions test/functional/page_objects/dashboard_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
const renderable = getService('renderable');
const listingTable = getService('listingTable');
const elasticChart = getService('elasticChart');
const PageObjects = getPageObjects(['common', 'header', 'visualize']);
const PageObjects = getPageObjects(['common', 'header', 'visualize', 'discover']);

interface SaveDashboardOptions {
/**
Expand Down Expand Up @@ -223,12 +223,18 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide
*/
public async expectToolbarPaginationDisplayed() {
const subjects = ['pagination-button-previous', 'pagination-button-next'];
const isLegacyDefault = PageObjects.discover.useLegacyTable();
if (isLegacyDefault) {
const subjects = ['btnPrevPage', 'btnNextPage', 'toolBarPagerText'];
await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj)));
} else {
const subjects = ['pagination-button-previous', 'pagination-button-next'];

await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj)));
const paginationListExists = await find.existsByCssSelector('.euiPagination__list');
if (!paginationListExists) {
throw new Error(`expected discover data grid pagination list to exist`);
await Promise.all(subjects.map(async (subj) => await testSubjects.existOrFail(subj)));
const paginationListExists = await find.existsByCssSelector('.euiPagination__list');
if (!paginationListExists) {
throw new Error(`expected discover data grid pagination list to exist`);
}
}
}

Expand Down
Loading

0 comments on commit a8d4145

Please sign in to comment.