Skip to content

Commit

Permalink
[discover][bug] configurator dataset issue
Browse files Browse the repository at this point in the history
bad rebase caused only conflict was the dataset.

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla committed Sep 4, 2024
1 parent 8c9abe2 commit 8404ffe
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/plugins/data/public/ui/dataset_selector/configurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ export const Configurator = ({
const type = queryString.getDatasetService().getType(baseDataset.type);
const languages = type?.supportedLanguages(baseDataset) || [];

const [dataset, setDataset] = useState<Dataset>(baseDataset);
const [timeFields, setTimeFields] = useState<DatasetField[]>();
const [timeFieldName, setTimeFieldName] = useState<string | undefined>();
const [timeFieldName, setTimeFieldName] = useState<string | undefined>(dataset.timeFieldName);
const [language, setLanguage] = useState<string>(() => {
const currentLanguage = queryString.getQuery().language;
if (languages.includes(currentLanguage)) {
Expand Down Expand Up @@ -94,7 +95,7 @@ export const Configurator = ({
}
)}
>
<EuiFieldText disabled value={baseDataset.title} />
<EuiFieldText disabled value={dataset.title} />
</EuiFormRow>
{timeFields && timeFields.length > 0 && (
<EuiFormRow
Expand All @@ -118,6 +119,7 @@ export const Configurator = ({
onChange={(e) => {
const value = e.target.value === 'undefined' ? undefined : e.target.value;
setTimeFieldName(value);
setDataset({ ...dataset, timeFieldName: value });
}}
/>
</EuiFormRow>
Expand All @@ -136,7 +138,10 @@ export const Configurator = ({
value: languageId,
}))}
value={language}
onChange={(e) => setLanguage(e.target.value)}
onChange={(e) => {
setLanguage(e.target.value);
setDataset({ ...dataset, language: e.target.value });
}}
/>
</EuiFormRow>
</EuiForm>
Expand All @@ -156,8 +161,8 @@ export const Configurator = ({
</EuiButton>
<EuiButton
onClick={() => {
queryString.getDatasetService().cacheDataset({ ...dataset, language, timeFieldName });
onConfirm({ ...dataset, language, timeFieldName });
queryString.getDatasetService().cacheDataset(dataset);
onConfirm(dataset);
}}
fill
>
Expand Down

0 comments on commit 8404ffe

Please sign in to comment.