mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
InfluxDB: InfluxQL: make nicer custom-select-value UI (#34289)
* influxdb: influxql: make niceer custom-select-value * add code for missing case * moved to the right place
This commit is contained in:
parent
d6c4c2fcd5
commit
a9255db370
@ -58,6 +58,12 @@ type SelReloadProps = {
|
|||||||
allowCustomValue?: boolean;
|
allowCustomValue?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// when a custom value is written into a select-box,
|
||||||
|
// by default the new value is prefixed with "Create:",
|
||||||
|
// and that sounds confusing because here we do not create
|
||||||
|
// anything. we change this to just be the entered string.
|
||||||
|
const formatCreateLabel = (v: string) => v;
|
||||||
|
|
||||||
const SelReload = ({ loadOptions, allowCustomValue, onChange, onClose }: SelReloadProps): JSX.Element => {
|
const SelReload = ({ loadOptions, allowCustomValue, onChange, onClose }: SelReloadProps): JSX.Element => {
|
||||||
// here we rely on the fact that writing text into the <AsyncSelect/>
|
// here we rely on the fact that writing text into the <AsyncSelect/>
|
||||||
// does not cause a re-render of the current react component.
|
// does not cause a re-render of the current react component.
|
||||||
@ -70,6 +76,7 @@ const SelReload = ({ loadOptions, allowCustomValue, onChange, onClose }: SelRelo
|
|||||||
return (
|
return (
|
||||||
<div className={selectClass}>
|
<div className={selectClass}>
|
||||||
<AsyncSelect
|
<AsyncSelect
|
||||||
|
formatCreateLabel={formatCreateLabel}
|
||||||
defaultOptions
|
defaultOptions
|
||||||
autoFocus
|
autoFocus
|
||||||
isOpen
|
isOpen
|
||||||
@ -99,6 +106,7 @@ const SelSingleLoad = ({ loadOptions, allowCustomValue, onChange, onClose }: Sel
|
|||||||
return (
|
return (
|
||||||
<div className={selectClass}>
|
<div className={selectClass}>
|
||||||
<Select
|
<Select
|
||||||
|
formatCreateLabel={formatCreateLabel}
|
||||||
autoFocus
|
autoFocus
|
||||||
isOpen
|
isOpen
|
||||||
onCloseMenu={onClose}
|
onCloseMenu={onClose}
|
||||||
|
Loading…
Reference in New Issue
Block a user