-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Adjust alignment of field errors + timeline icon (#104084)
* adjust alignment of field errors + timeline icon * Use options popover instead of two continuous inputs * Set max row size * Reduce error callout size to s Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
0ae2134
commit f079775
Showing
8 changed files
with
162 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ic/application/sections/edit_policy/components/phases/hot_phase/components/unit_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { FunctionComponent, useState } from 'react'; | ||
import { EuiFilterSelectItem, EuiPopover, EuiButtonEmpty } from '@elastic/eui'; | ||
|
||
import { UseField } from '../../../../form'; | ||
|
||
interface Props { | ||
path: string; | ||
euiFieldProps?: Record<string, any>; | ||
options: Array<{ | ||
value: string; | ||
text: string; | ||
}>; | ||
} | ||
|
||
export const UnitField: FunctionComponent<Props> = ({ path, options, euiFieldProps }) => { | ||
const [open, setOpen] = useState(false); | ||
|
||
return ( | ||
<UseField key={path} path={path}> | ||
{(field) => { | ||
const onSelect = (option: string) => { | ||
field.setValue(option); | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<EuiPopover | ||
button={ | ||
<EuiButtonEmpty | ||
size="xs" | ||
color="text" | ||
iconSide="right" | ||
iconType="arrowDown" | ||
onClick={() => setOpen((x) => !x)} | ||
data-test-subj="show-filters-button" | ||
> | ||
{options.find((x) => x.value === field.value)?.text} | ||
</EuiButtonEmpty> | ||
} | ||
ownFocus | ||
panelPaddingSize="none" | ||
isOpen={open} | ||
closePopover={() => setOpen(false)} | ||
{...euiFieldProps} | ||
> | ||
{options.map((item) => ( | ||
<EuiFilterSelectItem | ||
key={item.value} | ||
checked={field.value === item.value ? 'on' : undefined} | ||
onClick={() => onSelect(item.value)} | ||
data-test-subj={`filter-option-${item.value}`} | ||
> | ||
{item.text} | ||
</EuiFilterSelectItem> | ||
))} | ||
</EuiPopover> | ||
); | ||
}} | ||
</UseField> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters