Skip to content

Commit

Permalink
Merge pull request #276 from zimmerman-team/feat/DX-2100
Browse files Browse the repository at this point in the history
Feat/dx 2100
  • Loading branch information
Psami-wondah authored Dec 10, 2024
2 parents 0035df7 + a9b800e commit 580b2b2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 18 deletions.
5 changes: 4 additions & 1 deletion src/app/components/Dialogs/deleteChartDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export default function DeleteChartDialog(props: Props) {
>
<div className={classes.paper}>
<form
onSubmit={() => props.handleDelete(props.cardId as string)}
onSubmit={(e) => {
e.preventDefault();
props.handleDelete(props.cardId as string);
}}
data-cy="delete-chart-item-form"
aria-label="form"
>
Expand Down
6 changes: 5 additions & 1 deletion src/app/components/Dialogs/deleteDatasetDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ export default function DeleteDatasetDialog(props: Props) {
) : (
<div className={classes.paper}>
<form
onSubmit={() => props.handleDelete(props.cardId)}
onSubmit={(e) => {
e.preventDefault();
props.handleDelete(props.cardId);
}}
data-cy="delete-dataset-item-form"
aria-label="form"
>
<div
css={`
Expand Down
5 changes: 4 additions & 1 deletion src/app/components/Dialogs/deleteReportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export default function DeleteReportDialog(props: Props) {
>
<div className={classes.paper}>
<form
onSubmit={() => props.handleDelete(props.cardId as string)}
onSubmit={(e) => {
e.preventDefault();
props.handleDelete(props.cardId as string);
}}
data-cy="delete-report-item-form"
aria-label="form"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ export function ChartSubheaderToolbar(
filterString: "filter[order]=updatedDate desc",
});
})
.catch((error) => console.log(error));

history.replace("/");
.catch((error) => console.log(error))
.finally(() => {
history.replace("/");
});
};

const handleDuplicate = () => {
Expand Down
14 changes: 7 additions & 7 deletions src/app/modules/chart-module/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,7 @@ export default function ChartModule() {
isMappingValid,
isAIAssisted: selectedAIChart,
};
if (view !== undefined && page !== "new") {
editChart({
token,
patchId: page,
values: chart,
});
} else {
if (page === "new") {
try {
return await axios.post(`${process.env.REACT_APP_API}/chart/`, chart, {
headers: {
Expand All @@ -299,6 +293,12 @@ export default function ChartModule() {
} catch (e) {
console.log(e);
}
} else if (view !== undefined) {
editChart({
token,
patchId: page,
values: chart,
});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ export default function DatasetSubHeaderToolbar(
filterString: "filter[order]=updatedDate desc",
});
})
.catch((error) => console.log(error));
history.replace("/");
.catch((error) => console.log(error))
.finally(() => {
history.replace("/");
});
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ export function ReportSubheaderToolbar(
filterString: "filter[order]=updatedDate desc",
});
})
.catch((error) => console.log(error));

history.replace("/");
.catch((error) => console.log(error))
.finally(() => {
history.replace("/");
});
};

const handleDuplicate = () => {
Expand Down

0 comments on commit 580b2b2

Please sign in to comment.