diff --git a/.betterer.results b/.betterer.results index 34cd8803df9..1b5a76a13b8 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3132,9 +3132,6 @@ exports[`better eslint`] = { "public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], diff --git a/packages/grafana-ui/src/components/Select/SelectMenu.tsx b/packages/grafana-ui/src/components/Select/SelectMenu.tsx index a5d5d8bb814..378a2640aa7 100644 --- a/packages/grafana-ui/src/components/Select/SelectMenu.tsx +++ b/packages/grafana-ui/src/components/Select/SelectMenu.tsx @@ -58,11 +58,12 @@ export const VirtualizedSelectMenu = ({ children, maxHeight, options, getValue } const longestOption = max(options.map((option) => option.label?.length)) ?? 0; const widthEstimate = longestOption * VIRTUAL_LIST_WIDTH_ESTIMATE_MULTIPLIER; + const heightEstimate = Math.min(options.length * VIRTUAL_LIST_ITEM_HEIGHT, maxHeight); return ( = ({ rulesSourceName }) => { const style = useStyles2(getStyle); - const [customGroup, setCustomGroup] = useState(false); - const rulerRequests = useUnifiedAlertingSelector((state) => state.rulerRules); const dispatch = useDispatch(); useEffect(() => { @@ -61,15 +58,13 @@ export const GroupAndNamespaceFields: FC = ({ rulesSourceName }) => { > ( - { setValue('group', ''); //reset if namespace changes - onChange(value); - }} - onCustomChange={(custom: boolean) => { - custom && setCustomGroup(true); + onChange(value.value); }} options={namespaceOptions} width={42} @@ -88,7 +83,16 @@ export const GroupAndNamespaceFields: FC = ({ rulesSourceName }) => { ( - + { + setValue('group', value.value ?? ''); + }} + className={style.input} + /> )} name="group" control={control} diff --git a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx index 1b81d76599e..351bb234a15 100644 --- a/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx @@ -53,7 +53,7 @@ export const SelectWithAdd: FC = ({ placeholder={placeholder} className={className} disabled={disabled} - onChange={(e) => onChange((e.target as HTMLInputElement).value)} + onChange={(e) => onChange(e.currentTarget.value)} /> ); } else {