diff --git a/packages/grafana-ui/src/components/Combobox/Combobox.tsx b/packages/grafana-ui/src/components/Combobox/Combobox.tsx index 17e82c11e94..ad9a8da6a60 100644 --- a/packages/grafana-ui/src/components/Combobox/Combobox.tsx +++ b/packages/grafana-ui/src/components/Combobox/Combobox.tsx @@ -2,16 +2,16 @@ import { cx } from '@emotion/css'; import { useVirtualizer } from '@tanstack/react-virtual'; import { useCombobox } from 'downshift'; import { debounce } from 'lodash'; -import { useCallback, useId, useMemo, useState } from 'react'; +import { ReactNode, useCallback, useId, useMemo, useState } from 'react'; import { useStyles2 } from '../../themes'; -import { t } from '../../utils/i18n'; +import { t, Trans } from '../../utils/i18n'; import { Icon } from '../Icon/Icon'; import { AutoSizeInput } from '../Input/AutoSizeInput'; import { Input, Props as InputProps } from '../Input/Input'; +import { Box } from '../Layout/Box/Box'; import { Stack } from '../Layout/Stack/Stack'; import { ScrollContainer } from '../ScrollContainer/ScrollContainer'; -import { Text } from '../Text/Text'; import { getComboboxStyles } from './getComboboxStyles'; import { useComboboxFloat, OPTION_HEIGHT } from './useComboboxFloat'; @@ -347,14 +347,31 @@ export const Combobox = ({ })} )} - {asyncError && ( - - - {t('combobox.async.error', 'An error occurred while loading options.')} - - )} +
+ {asyncError && ( + + + An error occurred while loading options. + + )} + {items.length === 0 && !asyncError && ( + + No options found. + + )} +
); }; + +const MessageRow = ({ children }: { children: ReactNode }) => { + return ( + + + {children} + + + ); +}; diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index eb760013cb2..ac43a42d1a4 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -456,6 +456,9 @@ }, "custom-value": { "create": "Create custom value" + }, + "options": { + "no-found": "No options found." } }, "command-palette": { diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index 466b365e87d..09d232d2435 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -456,6 +456,9 @@ }, "custom-value": { "create": "Cřęäŧę čūşŧőm väľūę" + }, + "options": { + "no-found": "Ńő őpŧįőʼnş ƒőūʼnđ." } }, "command-palette": {