Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ad20e2f
refactor RowHEightSettings component to EUI layout
akowalska622 Dec 10, 2024
92b2c6e
revert single type
akowalska622 Dec 11, 2024
66f24a7
add explanatory comment to useEffect
akowalska622 Dec 11, 2024
01a0cef
fix tests in toolbar
akowalska622 Dec 11, 2024
18c597c
fix populating input with -1
akowalska622 Dec 11, 2024
8351e42
reverse order of types to avoid unnecessary file diff
akowalska622 Dec 11, 2024
5e7f722
lift input state up
akowalska622 Dec 12, 2024
f85718d
refactor toolbar
akowalska622 Dec 13, 2024
b9d49de
remove redundant logs
akowalska622 Dec 13, 2024
4badea2
remove redundant prop and fix default header line count
akowalska622 Dec 16, 2024
4981896
adjust tests for rowHeightSettings
akowalska622 Dec 16, 2024
ff36e5d
adjust useRowHeight tests
akowalska622 Dec 16, 2024
d46225a
adjust DataTableAdditionalDisplaySettings test
akowalska622 Dec 16, 2024
0c774de
update snapshots for DataTable tests
akowalska622 Dec 16, 2024
afa412d
adjust Toolbar tests
akowalska622 Dec 16, 2024
2fe30a0
adjust visualization test
akowalska622 Dec 16, 2024
4408c2f
remove unused locales
akowalska622 Dec 16, 2024
514c739
fix data table tests
akowalska622 Jan 8, 2025
6694988
correct single row value for useRowHeightOptions
akowalska622 Jan 8, 2025
adf76bd
fix default app state functional tests
akowalska622 Jan 10, 2025
f6bdce2
simplify setLineCountInput
akowalska622 Jan 10, 2025
f305503
update data grid row height tests
akowalska622 Jan 10, 2025
340d256
update single row height view in tests
akowalska622 Jan 10, 2025
7cfb62d
add changeCustomRowHeightNumber to data grid tests
akowalska622 Jan 13, 2025
eacde25
apply vis team comments
akowalska622 Jan 14, 2025
385c7b2
PR fixes part 1
akowalska622 Jan 16, 2025
b99d2a3
PR fixes part 2
akowalska622 Jan 16, 2025
85a764f
clean up redundant tests
akowalska622 Jan 16, 2025
d48df4f
PR fixes part 3
akowalska622 Jan 16, 2025
b3227ec
clean "single" occurrences
akowalska622 Jan 17, 2025
9751c7f
remove `single` from ROWS_HEIGHT_OPTIONS
akowalska622 Jan 27, 2025
7f4a8e8
add test case for casting 0 to 1
akowalska622 Jan 27, 2025
16796ca
handle legacy state in Lens
akowalska622 Jan 27, 2025
24decd9
fix types and remove legacy tests
akowalska622 Jan 27, 2025
1271d24
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 27, 2025
49c1b1b
unify enums for RowHeightMode
akowalska622 Jan 27, 2025
a0bbc25
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 27, 2025
d09e356
fix tests after removing "single" mode
akowalska622 Jan 27, 2025
8f31ee6
fix toolbar tests
akowalska622 Jan 28, 2025
d381708
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 28, 2025
0921807
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 28, 2025
e547880
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 29, 2025
e7d3e92
add constants to summary column
akowalska622 Jan 29, 2025
7b8bf0a
Merge branch 'main' into 203378-change-rowheightsettings-design-to-al…
akowalska622 Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getSummaryProps = (
setCellProps: () => {},
closePopover: () => {},
density: DataGridDensity.COMPACT,
rowHeight: ROWS_HEIGHT_OPTIONS.single,
rowHeight: 1,
onFilter: jest.fn(),
shouldShowFieldHandler: () => true,
core: corePluginMock.createStart(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
getLogDocumentOverview,
getMessageFieldWithFallbacks,
} from '@kbn/discover-utils';
import { ROWS_HEIGHT_OPTIONS } from '@kbn/unified-data-table';
import { Resource } from './resource';
import { Content } from './content';
import { createResourceFields, formatJsonDocumentForContent } from './utils';
Expand Down Expand Up @@ -55,6 +54,9 @@ export const SummaryColumn = (props: AllSummaryColumnProps) => {
// eslint-disable-next-line import/no-default-export
export default SummaryColumn;

const DEFAULT_ROW_COUNT = 1;
const SINGLE_ROW_COUNT = 1;

const SummaryCell = ({
density: maybeNullishDensity,
rowHeight: maybeNullishRowHeight,
Expand All @@ -65,8 +67,8 @@ const SummaryCell = ({
const density = maybeNullishDensity ?? DataGridDensity.COMPACT;
const isCompressed = density === DataGridDensity.COMPACT;

const rowHeight = maybeNullishRowHeight ?? ROWS_HEIGHT_OPTIONS.single;
const isSingleLine = rowHeight === ROWS_HEIGHT_OPTIONS.single || rowHeight === 1;
const rowHeight = maybeNullishRowHeight ?? DEFAULT_ROW_COUNT;
const isSingleLine = rowHeight === SINGLE_ROW_COUNT;

const resourceFields = createResourceFields(row, core, share);
const shouldRenderResource = resourceFields.length > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,16 @@ describe('UnifiedDataTable', () => {
});

expect(component.find(EuiDataGrid).last().prop('sorting')).toMatchInlineSnapshot(`
Object {
"columns": Array [
Object {
"direction": "desc",
"id": "message",
},
],
"onSort": [Function],
}
`);
Object {
"columns": Array [
Object {
"direction": "desc",
"id": "message",
},
],
"onSort": [Function],
}
`);
},
EXTENDED_JEST_TIMEOUT
);
Expand All @@ -605,20 +605,20 @@ describe('UnifiedDataTable', () => {
});

expect(component.find(EuiDataGrid).last().prop('sorting')).toMatchInlineSnapshot(`
Object {
"columns": Array [
Object {
"direction": "desc",
"id": "bytes",
},
Object {
"direction": "desc",
"id": "message",
},
],
"onSort": [Function],
}
`);
Object {
"columns": Array [
Object {
"direction": "desc",
"id": "bytes",
},
Object {
"direction": "desc",
"id": "message",
},
],
"onSort": [Function],
}
`);
},
EXTENDED_JEST_TIMEOUT
);
Expand All @@ -637,31 +637,31 @@ describe('UnifiedDataTable', () => {

expect(component.find(EuiDataGrid).first().prop('toolbarVisibility'))
.toMatchInlineSnapshot(`
Object {
"additionalControls": null,
"showColumnSelector": false,
"showDisplaySelector": Object {
"additionalDisplaySettings": <React.Fragment>
<UnifiedDataTableAdditionalDisplaySettings
headerRowHeight="custom"
headerRowHeightLines={1}
onChangeRowHeight={[Function]}
onChangeRowHeightLines={[Function]}
onChangeSampleSize={[MockFunction]}
rowHeight="custom"
rowHeightLines={3}
sampleSize={150}
/>
</React.Fragment>,
"allowDensity": false,
"allowResetButton": false,
"allowRowHeight": false,
},
"showFullScreenSelector": true,
"showKeyboardShortcuts": true,
"showSortSelector": true,
}
`);
Object {
"additionalControls": null,
"showColumnSelector": false,
"showDisplaySelector": Object {
"additionalDisplaySettings": <React.Fragment>
<UnifiedDataTableAdditionalDisplaySettings
headerLineCountInput={1}
headerRowHeight="custom"
lineCountInput={3}
onChangeRowHeight={[Function]}
onChangeRowHeightLines={[Function]}
onChangeSampleSize={[MockFunction]}
rowHeight="custom"
sampleSize={150}
/>
</React.Fragment>,
"allowDensity": false,
"allowResetButton": false,
"allowRowHeight": false,
},
"showFullScreenSelector": true,
"showKeyboardShortcuts": true,
"showSortSelector": true,
}
`);
},
EXTENDED_JEST_TIMEOUT
);
Expand All @@ -677,30 +677,30 @@ describe('UnifiedDataTable', () => {

expect(component.find(EuiDataGrid).first().prop('toolbarVisibility'))
.toMatchInlineSnapshot(`
Object {
"additionalControls": null,
"showColumnSelector": false,
"showDisplaySelector": Object {
"additionalDisplaySettings": <React.Fragment>
<UnifiedDataTableAdditionalDisplaySettings
headerRowHeight="custom"
headerRowHeightLines={1}
onChangeRowHeight={[Function]}
onChangeRowHeightLines={[Function]}
rowHeight="custom"
rowHeightLines={3}
sampleSize={200}
/>
</React.Fragment>,
"allowDensity": false,
"allowResetButton": false,
"allowRowHeight": false,
},
"showFullScreenSelector": true,
"showKeyboardShortcuts": true,
"showSortSelector": true,
}
`);
Object {
"additionalControls": null,
"showColumnSelector": false,
"showDisplaySelector": Object {
"additionalDisplaySettings": <React.Fragment>
<UnifiedDataTableAdditionalDisplaySettings
headerLineCountInput={1}
headerRowHeight="custom"
lineCountInput={3}
onChangeRowHeight={[Function]}
onChangeRowHeightLines={[Function]}
rowHeight="custom"
sampleSize={200}
/>
</React.Fragment>,
"allowDensity": false,
"allowResetButton": false,
"allowRowHeight": false,
},
"showFullScreenSelector": true,
"showKeyboardShortcuts": true,
"showSortSelector": true,
}
`);
},
EXTENDED_JEST_TIMEOUT
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ export const UnifiedDataTable = ({
const {
rowHeight: headerRowHeight,
rowHeightLines: headerRowHeightLines,
lineCountInput: headerLineCountInput,
onChangeRowHeight: onChangeHeaderRowHeight,
onChangeRowHeightLines: onChangeHeaderRowHeightLines,
} = useRowHeight({
Expand All @@ -823,14 +824,15 @@ export const UnifiedDataTable = ({
onUpdateRowHeight: onUpdateHeaderRowHeight,
});

const { rowHeight, rowHeightLines, onChangeRowHeight, onChangeRowHeightLines } = useRowHeight({
storage,
consumer,
key: 'dataGridRowHeight',
configRowHeight: configRowHeight ?? ROWS_HEIGHT_OPTIONS.default,
rowHeightState,
onUpdateRowHeight,
});
const { rowHeight, rowHeightLines, lineCountInput, onChangeRowHeight, onChangeRowHeightLines } =
useRowHeight({
storage,
consumer,
key: 'dataGridRowHeight',
configRowHeight: configRowHeight ?? ROWS_HEIGHT_OPTIONS.default,
rowHeightState,
onUpdateRowHeight,
});

const euiGridColumns = useMemo(
() =>
Expand Down Expand Up @@ -1021,23 +1023,22 @@ export const UnifiedDataTable = ({
{onUpdateDataGridDensity ? <EuiHorizontalRule margin="s" /> : null}
<UnifiedDataTableAdditionalDisplaySettings
rowHeight={rowHeight}
rowHeightLines={rowHeightLines}
onChangeRowHeight={onChangeRowHeight}
onChangeRowHeightLines={onChangeRowHeightLines}
headerRowHeight={headerRowHeight}
headerRowHeightLines={headerRowHeightLines}
onChangeHeaderRowHeight={onChangeHeaderRowHeight}
onChangeHeaderRowHeightLines={onChangeHeaderRowHeightLines}
maxAllowedSampleSize={maxAllowedSampleSize}
sampleSize={sampleSizeState}
onChangeSampleSize={onUpdateSampleSize}
lineCountInput={lineCountInput}
headerLineCountInput={headerLineCountInput}
/>
</>
),
};
}, [
headerRowHeight,
headerRowHeightLines,
maxAllowedSampleSize,
onChangeHeaderRowHeight,
onChangeHeaderRowHeightLines,
Expand All @@ -1047,9 +1048,10 @@ export const UnifiedDataTable = ({
onUpdateRowHeight,
onUpdateSampleSize,
rowHeight,
rowHeightLines,
sampleSizeState,
onUpdateDataGridDensity,
lineCountInput,
headerLineCountInput,
]);

const toolbarVisibility = useMemo(
Expand Down
Loading