diff --git a/src/plugins/data/common/datasets/types.ts b/src/plugins/data/common/datasets/types.ts index 09ffd715409c..d132a0d6a7eb 100644 --- a/src/plugins/data/common/datasets/types.ts +++ b/src/plugins/data/common/datasets/types.ts @@ -258,21 +258,26 @@ export interface DatasetField { // TODO: osdFieldType? } -export type CanvasBannerProps = +export enum DatasetCanvasBannerComponentType { + Callout = 'callout', + Custom = 'custom', +} + +export type DatasetCanvasBannerProps = | { - componentType: 'callout'; + componentType: DatasetCanvasBannerComponentType.Callout; title: string; iconType?: string; content?: React.ReactNode; } | { - componentType: 'callout'; + componentType: DatasetCanvasBannerComponentType.Callout; title?: string; iconType?: string; content: React.ReactNode; } | { - componentType: 'custom'; + componentType: DatasetCanvasBannerComponentType.Custom; content: React.ReactNode; }; diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index a890fbee26cb..b585cfeeee4b 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -57,7 +57,7 @@ export const Configurator = ({ const indexedViewsService = type?.indexedViewsService; const [selectedIndexedView, setSelectedIndexedView] = useState(); const [indexedViews, setIndexedViews] = useState([]); - const [loadingIndexedViews, setLoadingIndexedViews] = useState(false); + const [isLoadingIndexedViews, setIsLoadingIndexedViews] = useState(false); useEffect(() => { setLanguages(type?.supportedLanguages(dataset) || []); @@ -75,9 +75,9 @@ export const Configurator = ({ useEffect(() => { const getIndexedViews = async () => { if (indexedViewsService) { - setLoadingIndexedViews(true); + setIsLoadingIndexedViews(true); const fetchedIndexedViews = await indexedViewsService.getIndexedViews(baseDataset); - setLoadingIndexedViews(false); + setIsLoadingIndexedViews(false); setIndexedViews(fetchedIndexedViews || []); } }; @@ -87,7 +87,7 @@ export const Configurator = ({ const submitDisabled = useMemo(() => { return ( - loadingIndexedViews || + isLoadingIndexedViews || (timeFieldName === undefined && !( languageService.getLanguage(selectedLanguage)?.hideDatePicker || @@ -96,7 +96,14 @@ export const Configurator = ({ timeFields && timeFields.length > 0) ); - }, [dataset, selectedLanguage, timeFieldName, timeFields, languageService, loadingIndexedViews]); + }, [ + dataset, + selectedLanguage, + timeFieldName, + timeFields, + languageService, + isLoadingIndexedViews, + ]); useEffect(() => { const fetchFields = async () => { @@ -165,7 +172,7 @@ export const Configurator = ({ )} > ({ text: name, value: name,