Skip to content

Commit

Permalink
[Discover] Revert data table row height to 3 by default (#169724)
Browse files Browse the repository at this point in the history
## Summary

This PR reverts the changes from #164218 that updated the default
Discover grid row height to "auto", and changes it back to "3".

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
  • Loading branch information
davismcphee authored Oct 30, 2023
1 parent be21e79 commit 788d302
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-unified-data-table/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ROWS_PER_PAGE_OPTIONS = [10, 25, 50, DEFAULT_ROWS_PER_PAGE, 250, 50
export const ROWS_HEIGHT_OPTIONS = {
auto: -1,
single: 0,
default: -1,
default: 3,
};
export const defaultRowLineHeight = '1.6em';
export const defaultMonacoEditorWidth = 370;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Storage } from '@kbn/kibana-utils-plugin/public';
import { LocalStorageMock } from '../../__mocks__/local_storage_mock';
import { useRowHeightsOptions } from './use_row_heights_options';

const CONFIG_ROW_HEIGHT = 3;

describe('useRowHeightsOptions', () => {
test('should apply rowHeight from savedSearch', () => {
const { result } = renderHook(() => {
Expand All @@ -30,7 +32,7 @@ describe('useRowHeightsOptions', () => {
storage: new LocalStorageMock({
['discover:dataGridRowHeight']: {
previousRowHeight: 5,
previousConfigRowHeight: -1,
previousConfigRowHeight: 3,
},
}) as unknown as Storage,
consumer: 'discover',
Expand All @@ -50,7 +52,7 @@ describe('useRowHeightsOptions', () => {
});

expect(result.current.defaultHeight).toEqual({
lineCount: 3,
lineCount: CONFIG_ROW_HEIGHT,
});
});

Expand All @@ -59,15 +61,17 @@ describe('useRowHeightsOptions', () => {
return useRowHeightsOptions({
storage: new LocalStorageMock({
['discover:dataGridRowHeight']: {
previousRowHeight: 5,
// different from uiSettings (config), now user changed it to -1, but prev was 4
previousRowHeight: 4,
// different from uiSettings (config), now user changed it to 3, but prev was 4
previousConfigRowHeight: 4,
},
}) as unknown as Storage,
consumer: 'discover',
});
});

expect(result.current.defaultHeight).toEqual('auto');
expect(result.current.defaultHeight).toEqual({
lineCount: CONFIG_ROW_HEIGHT,
});
});
});
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 @@ -287,7 +287,7 @@ export const getUiSettings: (docLinks: DocLinksServiceSetup) => Record<string, U
name: i18n.translate('discover.advancedSettings.params.rowHeightTitle', {
defaultMessage: 'Row height in the Document Explorer',
}),
value: -1,
value: 3,
category: ['discover'],
description: i18n.translate('discover.advancedSettings.params.rowHeightText', {
defaultMessage:
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/discover/group2/_data_grid_row_height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(rows.length).to.be.above(0);

await dataGrid.clickGridSettings();
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit');
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom');
});

it('should allow to change row height', async () => {
await dataGrid.clickGridSettings();
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Auto fit');
expect(await dataGrid.getCurrentRowHeightValue()).to.be('Custom');

await dataGrid.changeRowHeightValue('Single');

Expand Down

0 comments on commit 788d302

Please sign in to comment.