Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade EUI to v94.1.0 (major EuiTable refactors) #180514

Merged
merged 37 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3f3d30f
Upgrade EUI to v94.1.0
cee-chen Apr 9, 2024
1065a20
Convert `responsive` prop to new `responsiveBreakpoint` API
cee-chen Apr 9, 2024
3e093f9
Remove unused `textOnly` table prop
cee-chen Apr 9, 2024
6c86f0c
Remove `hasActions` table props
cee-chen Apr 9, 2024
f220cea
Remove `hasActions` prop + util
cee-chen Apr 9, 2024
8942389
Remove `isExpandable` table prop
cee-chen Apr 9, 2024
fc31f49
Remove `isExpandable` table prop with conditional logic
cee-chen Apr 9, 2024
6897cc2
Remove `isSelectable` table prop
cee-chen Apr 9, 2024
5ac1913
Remove `isSelectable` conditional table props
cee-chen Apr 9, 2024
c180bc3
[EuiTableRow] `isSelectable` prop update
cee-chen Apr 9, 2024
3db5f8c
[EuiTables] Misc syntax cleanups/chores
cee-chen Apr 9, 2024
86ce80b
Remove direct references to table classNames
cee-chen Apr 10, 2024
cdc3fbd
Remove deprecated `showOnHover` column API and direct className usage
cee-chen Apr 10, 2024
7284869
[Security] Replace role tables' custom actions/CSS with default actions
cee-chen Apr 10, 2024
c109b20
Update DOM snapshots of tables
cee-chen Apr 10, 2024
af64cf8
Update Enzyme snapshots
cee-chen Apr 10, 2024
e2e5cad
Fix Enzyme selectors
cee-chen Apr 10, 2024
89f107e
Fix Enzyme simulated events
cee-chen Apr 11, 2024
b6144ca
Fix test text assertions caused by mobile headers no longer rendering…
cee-chen Apr 10, 2024
a3a273e
Fix/simplify more mobile vs desktop test assertions
cee-chen Apr 11, 2024
e5e3aa9
Fix FTR selectors to account for removed modifier classNames/updated DOM
cee-chen Apr 11, 2024
ed44615
Fix FTR selectors around actions
cee-chen Apr 10, 2024
56ed18a
Fix failing FTR tests caused by examples missing EUI breakpoints prov…
cee-chen Apr 11, 2024
67e69d8
Update table cell chart CSS to account for changes
cee-chen Apr 11, 2024
a65cc0f
Merge remote-tracking branch 'upstream/main' into eui/v94.1.0
cee-chen Apr 12, 2024
7213048
Update EUI to grab backport with latest table fixes
cee-chen Apr 12, 2024
ede169f
Merge branch 'main' into eui/v94.1.0
cee-chen Apr 16, 2024
8d9b362
[PR feedback] Increase actions column width
cee-chen Apr 16, 2024
4055eff
[PR feedback] Fix custom table cell `className` CSS
cee-chen Apr 16, 2024
7778346
Merge branch 'main' into eui/v94.1.0
cee-chen Apr 18, 2024
c48425e
[Infra][Hosts] Fix truncation on `Command` column
cee-chen Apr 18, 2024
fa99ad8
[APM][Services] Fix overview tables custom CSS
cee-chen Apr 18, 2024
718fc3c
Increase various column widths with text that are now cut off due to …
cee-chen Apr 18, 2024
e8a856b
Update snapshot from updated table
cee-chen Apr 18, 2024
ac4aa7d
[Security][Data Quality] Increase width of column to account for sort…
cee-chen Apr 18, 2024
46006d7
Merge branch 'main' into eui/v94.1.0
cee-chen Apr 18, 2024
061273b
Update test w/ updated column width
cee-chen Apr 18, 2024
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
12 changes: 7 additions & 5 deletions examples/data_view_field_editor_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import {
EuiProvider,
DefaultItemAction,
EuiButton,
EuiCheckbox,
Expand Down Expand Up @@ -121,7 +122,6 @@ const DataViewFieldEditorExample = ({ dataView, dataViewFieldEditor }: Props) =>
items={fields}
columns={columns}
pagination={true}
hasActions={true}
sorting={{
sort: {
field: 'name',
Expand All @@ -135,10 +135,12 @@ const DataViewFieldEditorExample = ({ dataView, dataViewFieldEditor }: Props) =>
);

return (
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Data view field editor demo" />
<EuiPageTemplate.Section>{content}</EuiPageTemplate.Section>
</EuiPageTemplate>
<EuiProvider>
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Data view field editor demo" />
<EuiPageTemplate.Section>{content}</EuiPageTemplate.Section>
</EuiPageTemplate>
</EuiProvider>
);
};

Expand Down
53 changes: 27 additions & 26 deletions examples/field_formats_example/public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
EuiCodeBlock,
EuiLink,
EuiPageTemplate,
EuiProvider,
EuiSpacer,
EuiText,
EuiTitle,
Expand Down Expand Up @@ -61,7 +62,6 @@ const UsingAnExistingFieldFormatExample: React.FC<{ deps: Deps }> = (props) => {
<EuiBasicTable
data-test-subj={'example1 sample table'}
items={sample}
textOnly={true}
columns={[
{
field: 'raw',
Expand Down Expand Up @@ -100,7 +100,6 @@ const CreatingCustomFieldFormat: React.FC<{ deps: Deps }> = (props) => {
<EuiSpacer size={'s'} />
<EuiBasicTable
items={sample}
textOnly={true}
data-test-subj={'example2 sample table'}
columns={[
{
Expand Down Expand Up @@ -168,29 +167,31 @@ const CreatingCustomFieldFormatEditor: React.FC<{ deps: Deps }> = (props) => {

export const App: React.FC<{ deps: Deps }> = (props) => {
return (
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Field formats examples" />
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Using an existing field format</h2>
</EuiTitle>
<EuiSpacer />
<UsingAnExistingFieldFormatExample deps={props.deps} />
</EuiPageTemplate.Section>
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Creating a custom field format</h2>
</EuiTitle>
<EuiSpacer />
<CreatingCustomFieldFormat deps={props.deps} />
</EuiPageTemplate.Section>
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Creating a custom field format editor</h2>
</EuiTitle>
<EuiSpacer />
<CreatingCustomFieldFormatEditor deps={props.deps} />
</EuiPageTemplate.Section>
</EuiPageTemplate>
<EuiProvider>
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Field formats examples" />
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Using an existing field format</h2>
</EuiTitle>
<EuiSpacer />
<UsingAnExistingFieldFormatExample deps={props.deps} />
</EuiPageTemplate.Section>
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Creating a custom field format</h2>
</EuiTitle>
<EuiSpacer />
<CreatingCustomFieldFormat deps={props.deps} />
</EuiPageTemplate.Section>
<EuiPageTemplate.Section grow={false}>
<EuiTitle size="m">
<h2>Creating a custom field format editor</h2>
</EuiTitle>
<EuiSpacer />
<CreatingCustomFieldFormatEditor deps={props.deps} />
</EuiPageTemplate.Section>
</EuiPageTemplate>
</EuiProvider>
);
};
5 changes: 3 additions & 2 deletions examples/files_example/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { FileJSON } from '@kbn/files-plugin/common';
import type { FilesClientResponses } from '@kbn/files-plugin/public';

import {
EuiProvider,
EuiPageTemplate,
EuiInMemoryTable,
EuiInMemoryTableProps,
Expand Down Expand Up @@ -131,7 +132,7 @@ export const FilesExampleApp = ({ files, notifications }: FilesExampleAppDeps) =
];

return (
<>
<EuiProvider>
<EuiPageTemplate restrictWidth>
<EuiPageTemplate.Header pageTitle="Files example" />
<EuiPageTemplate.Section>
Expand Down Expand Up @@ -185,6 +186,6 @@ export const FilesExampleApp = ({ files, notifications }: FilesExampleAppDeps) =
}}
/>
)}
</>
</EuiProvider>
);
};
62 changes: 32 additions & 30 deletions examples/partial_results_example/public/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import React, { useContext, useEffect, useState } from 'react';
import { pluck } from 'rxjs';
import {
EuiProvider,
EuiBasicTable,
EuiCallOut,
EuiCodeBlock,
Expand Down Expand Up @@ -40,35 +41,36 @@ export function App() {
}, [expressions]);

return (
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Partial Results Demo" />
<EuiPageTemplate.Section>
<EuiText data-test-subj="example-help">
<p>
This example listens for the window events and adds them to the table along with a
trigger counter.
</p>
</EuiText>
<EuiSpacer size={'m'} />
<EuiCodeBlock>{expression}</EuiCodeBlock>
<EuiSpacer size={'m'} />
{datatable ? (
<EuiBasicTable
textOnly={true}
data-test-subj={'example-table'}
columns={datatable.columns?.map(({ id: field, name }) => ({
field,
name,
'data-test-subj': `example-column-${field.toLowerCase()}`,
}))}
items={datatable.rows ?? []}
/>
) : (
<EuiCallOut color="success">
<p>Click or press any key.</p>
</EuiCallOut>
)}
</EuiPageTemplate.Section>
</EuiPageTemplate>
<EuiProvider>
<EuiPageTemplate offset={0}>
<EuiPageTemplate.Header pageTitle="Partial Results Demo" />
<EuiPageTemplate.Section>
<EuiText data-test-subj="example-help">
<p>
This example listens for the window events and adds them to the table along with a
trigger counter.
</p>
</EuiText>
<EuiSpacer size={'m'} />
<EuiCodeBlock>{expression}</EuiCodeBlock>
<EuiSpacer size={'m'} />
{datatable ? (
<EuiBasicTable
data-test-subj={'example-table'}
columns={datatable.columns?.map(({ id: field, name }) => ({
field,
name,
'data-test-subj': `example-column-${field.toLowerCase()}`,
}))}
items={datatable.rows ?? []}
/>
) : (
<EuiCallOut color="success">
<p>Click or press any key.</p>
</EuiCallOut>
)}
</EuiPageTemplate.Section>
</EuiPageTemplate>
</EuiProvider>
);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"@elastic/ecs": "^8.11.1",
"@elastic/elasticsearch": "^8.13.0",
"@elastic/ems-client": "8.5.1",
"@elastic/eui": "93.6.0",
"@elastic/eui": "94.1.0-backport.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ export function Table<T extends UserContentCommonSchema>({
data-test-subj="itemsInMemTable"
rowHeader="attributes.title"
tableCaption={tableCaption}
isSelectable
/>
);
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export const StatusTable: FunctionComponent<StatusTableProps> = ({ statuses }) =
columns={tableColumns}
itemId={(item) => item.id}
items={statuses}
isExpandable={true}
itemIdToExpandedRowMap={itemIdToExpandedRowMap}
rowProps={({ state }) => ({
className: `status-table-row-${state.uiColor}`,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Select all rows',
description: 'ARIA and displayed label on a checkbox to select all table rows',
}),
'euiBasicTable.selectThisRow': i18n.translate('core.euiBasicTable.selectThisRow', {
defaultMessage: 'Select this row',
description: 'ARIA and displayed label on a checkbox to select a single table row',
}),
'euiBasicTable.selectThisRow': ({ index }: EuiValues) =>
i18n.translate('core.euiBasicTable.selectThisRow', {
defaultMessage: 'Select row {index}',
values: { index },
description: 'ARIA and displayed label on a checkbox to select a single table row',
}),
'euiBasicTable.tableCaptionWithPagination': ({ tableCaption, page, pageCount }: EuiValues) =>
i18n.translate('core.euiBasicTable.tableCaptionWithPagination', {
defaultMessage: '{tableCaption}; Page {page} of {pageCount}.',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ export const SyncJobsTable: React.FC<SyncJobHistoryTableProps> = ({
data-test-subj={`entSearchContent-index-${type}-syncJobs-table`}
items={syncJobs}
columns={columns}
hasActions
onChange={onPaginate}
pagination={pagination}
tableLayout="fixed"
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-test-jest-helpers/src/testbed/testbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ export function registerTestBed<T extends string = string, P extends object = an
.slice(1) // we remove the first row as it is the table header
.map((row) => ({
reactWrapper: row,
columns: row.find('.euiTableCellContent').map((col) => ({
columns: row.find('div.euiTableCellContent').map((col) => ({
reactWrapper: col,
// We can't access the td value with col.text() because
// eui adds an extra div in td on mobile => (.euiTableRowCell__mobileHeader)
value: col.find('.euiTableCellContent').text(),
value: col.find('div.euiTableCellContent').text(),
})),
}));

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/src/query_history.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('QueryHistory', () => {
/>
);
expect(screen.getByRole('table')).toHaveTextContent(
'Time ranRecent queriesLast durationTime ranMar. 25, 24 08:45:27Recent queriesfrom kibana_sample_data_flights | limit 10Last duration2ms'
'Time ranRecent queriesLast durationMar. 25, 24 08:45:27from kibana_sample_data_flights | limit 102ms'
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/src/query_history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export function QueryHistory({
defaultMessage: 'Queries history table',
}
)}
responsive={false}
responsiveBreakpoint={false}
items={historyItems}
columns={columns}
sorting={sorting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const FieldNumberSummary: React.FC<FieldNumberSummaryProps> = ({
columns={summaryTableColumns}
tableCaption={summaryTableTitle}
data-test-subj={`${dataTestSubject}-numberSummary`}
responsive={false}
responsiveBreakpoint={false}
css={css`
& .euiTableHeaderCell {
${euiScreenReaderOnly()}
Expand Down
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const LICENSE_OVERRIDES = {
'[email protected]': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/[email protected]': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/[email protected]': ['Elastic License 2.0'],
'@elastic/eui@93.6.0': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@94.1.0-backport.0': ['SSPL-1.0 OR Elastic License 2.0'],
'[email protected]': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'[email protected]': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
'@bufbuild/[email protected]': ['Apache-2.0'], // license (Apache-2.0 AND BSD-3-Clause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ describe('Background Search Session Management Table', () => {
);
});

expect(table.find('thead th .euiTableCellContent__text').map((node) => node.text()))
.toMatchInlineSnapshot(`
expect(table.find('thead th').map((node) => node.text())).toMatchInlineSnapshot(`
Array [
"App",
"Name",
Expand Down Expand Up @@ -136,12 +135,12 @@ describe('Background Search Session Management Table', () => {

expect(table.find('tbody td').map((node) => node.text())).toMatchInlineSnapshot(`
Array [
"App",
"Namevery background search Info",
"# Searches0",
"StatusExpired",
"Created2 Dec, 2020, 00:19:32",
"Expiration--",
"",
"very background search Info",
"0",
"Expired",
"2 Dec, 2020, 00:19:32",
"--",
"",
"",
]
Expand Down
Loading
Loading