Skip to content

Commit

Permalink
make missing occurences of syncDataSourceFields also sync dataset name
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Büßemeyer authored and Michael Büßemeyer committed Nov 28, 2024
1 parent 17c08db commit 13eb34b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ function DatasetAddRemoteView(props: Props) {
form.setFieldsValue({ dataSourceJson });
// Since this function sets the JSON string, we have to update the
// data which is rendered by the "simple" page.
syncDataSourceFields(form, "simple");
syncDataSourceFields(form, "simple", true);
form.validateFields();
};

async function handleStoreDataset() {
// Sync simple with advanced and get newest datasourceJson
syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple");
syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple", true);
try {
await form.validateFields();
} catch (_e) {
Expand Down Expand Up @@ -515,7 +515,7 @@ function AddRemoteLayer({
}

// Sync simple with advanced and get newest datasourceJson
syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple");
syncDataSourceFields(form, dataSourceEditMode === "simple" ? "advanced" : "simple", true);
const datasourceConfigStr = form.getFieldValue("dataSourceJson");
const datastoreToUse = uploadableDatastores.find(
(datastore) => form.getFieldValue("datastoreUrl") === datastore.url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const syncDataSourceFields = (
if (syncTargetTabKey === "advanced") {
// Copy from simple to advanced: update json
const dataSourceFromSimpleTab = form.getFieldValue("dataSource");
if (syncDatasetName) {
if (syncDatasetName && dataSourceFromSimpleTab) {
dataSourceFromSimpleTab.id ??= {};
dataSourceFromSimpleTab.id.name = form.getFieldValue(["dataset", "name"]);
}
Expand Down

0 comments on commit 13eb34b

Please sign in to comment.