chore(explore): Update chart save to use API endpoints (#20498)

* Update SaveModal to use v1 API instead of POST /explore.

* Refactor SaveModal tests and remove obsolete ones.

* Fix redirect to /explore on save.

* Add toasts (but they don't work).

* Move logic inside try block, clarify unary-plus use.

* Add tests.

* Fix owners bug in updateSlice, enable navigation to dashboard w/o reload.

* Fix toasts.

* Fix translated strings.

* Fix unintended removal from dashboard bug.

* Fix native filters bug.

* Don't refresh Explore page after saving

* Use JSON payload shorthand.

* Prevent current dashboards being overwritten on viz type change.
This commit is contained in:
Cody Leff
2022-07-12 22:36:31 -06:00
committed by GitHub
parent c3ac61271a
commit b1020e3062
9 changed files with 743 additions and 402 deletions

View File

@@ -464,6 +464,14 @@ function ExploreViewContainer(props) {
return false;
}, [lastQueriedControls, props.controls]);
const saveAction = getUrlParam(URL_PARAMS.saveAction);
useChangeEffect(saveAction, () => {
if (['saveas', 'overwrite'].includes(saveAction)) {
onQuery();
addHistory({ isReplace: true });
}
});
useEffect(() => {
if (props.ownState !== undefined) {
onQuery();
@@ -586,6 +594,7 @@ function ExploreViewContainer(props) {
form_data={props.form_data}
sliceName={props.sliceName}
dashboardId={props.dashboardId}
sliceDashboards={props.exploreState.sliceDashboards ?? []}
/>
)}
<Resizable