From be59172413a6dc8d25fdfd997990b65f7fa37e63 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Tue, 12 Nov 2024 02:44:32 +0000 Subject: [PATCH] WIP failing to create the dataset type Signed-off-by: Kawika Avilla --- src/plugins/data/common/datasets/types.ts | 5 +++ .../ui/dataset_selector/configurator.tsx | 39 +++++++++++++++++++ .../ui/dataset_selector/dataset_selector.tsx | 3 +- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/common/datasets/types.ts b/src/plugins/data/common/datasets/types.ts index e777eb8a45e8..639efdfb8ed2 100644 --- a/src/plugins/data/common/datasets/types.ts +++ b/src/plugins/data/common/datasets/types.ts @@ -247,6 +247,11 @@ export interface Dataset extends BaseDataset { timeFieldName?: string; /** Optional language to default to from the language selector */ language?: string; + /** Optional reference to the original dataset */ + ref?: { + id: string; + type: string; + }; } export interface DatasetField { diff --git a/src/plugins/data/public/ui/dataset_selector/configurator.tsx b/src/plugins/data/public/ui/dataset_selector/configurator.tsx index 2940c6b2baf0..d6bec6d81341 100644 --- a/src/plugins/data/public/ui/dataset_selector/configurator.tsx +++ b/src/plugins/data/public/ui/dataset_selector/configurator.tsx @@ -185,6 +185,45 @@ export const Configurator = ({ /> ))} + + ({ + text: name, + value, + }))} + value={'dummy_index'} + onChange={(e) => { + const value = 'dummy_index'; + setDataset({ + ...dataset, + id: `${dataset.id}.${value}`, + title: value, + type: DEFAULT_DATA.SET_TYPES.INDEX, + ref: { + id: dataset.id, + type: dataset.type, + }, + }); + }} + hasNoInitialSelection + /> + diff --git a/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx b/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx index 75ea695a2083..7975f10ae381 100644 --- a/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx +++ b/src/plugins/data/public/ui/dataset_selector/dataset_selector.tsx @@ -82,7 +82,8 @@ export const DatasetSelector = ({ const { overlays } = services; const datasetService = getQueryService().queryString.getDatasetService(); const datasetIcon = - datasetService.getType(selectedDataset?.type || '')?.meta.icon.type || 'database'; + datasetService.getType(selectedDataset?.ref?.type || selectedDataset?.type || '')?.meta.icon + .type || 'database'; useEffect(() => { isMounted.current = true;