[Unified Search] [Lens] [Dashboard Controls] Middle truncation for data view pickers and field lists (#172296)

Adds middle truncation to the following:
Fixes https://github.com/elastic/kibana/issues/168753
Fixes https://github.com/elastic/kibana/issues/170398 

Unified Search:
<img width="554" alt="Screenshot 2023-11-30 at 16 06 49"
src="38d95de5-78d3-4c33-8287-897876422886">

Lens layer data view picker:
<img width="620" alt="Screenshot 2023-11-30 at 16 06 58"
src="68c6f0d6-7496-4db9-a0c0-0596350a4e90">

Create control field list:
<img width="843" alt="Screenshot 2023-11-30 at 16 15 12"
src="7ac4fb32-bdd4-44b0-ab49-2967e3d54fe2">

Create control data view list:

<img width="584" alt="Screenshot 2023-11-30 at 16 33 10"
src="a3b53c24-c363-4d72-b3e2-d4073ae4b3cf">
This commit is contained in:
Marta Bondyra 2023-12-01 16:35:26 +01:00 committed by GitHub
parent 7b7f19f565
commit d83955dcdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View file

@ -100,6 +100,9 @@ export function DataViewPicker({
compressed: true,
...(selectableProps ? selectableProps.searchProps : undefined),
}}
listProps={{
truncationProps: { truncation: 'middle' },
}}
>
{(list, search) => (
<>

View file

@ -141,6 +141,7 @@ export const FieldPicker = ({
isVirtualized: true,
showIcons: false,
bordered: true,
truncationProps: { truncation: 'middle' },
}}
height="full"
>

View file

@ -23,6 +23,7 @@ import { i18n } from '@kbn/i18n';
import { css } from '@emotion/react';
import { SortingService } from './sorting_service';
import { MIDDLE_TRUNCATION_PROPS } from '../filter_bar/filter_editor/lib/helpers';
const strings = {
sortOrder: {
@ -120,6 +121,10 @@ export function DataViewsList({
checked?: 'on' | 'off' | undefined;
}>
{...selectableProps}
listProps={{
truncationProps: MIDDLE_TRUNCATION_PROPS,
...(selectableProps?.listProps ? selectableProps.listProps : undefined),
}}
data-test-subj="indexPattern-switcher"
searchable
singleSelection="always"