You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2018/11/27 18:37:02 UTC

[incubator-superset] branch master updated: [fix] edit chart title cause JS error (#6438)

This is an automated email from the ASF dual-hosted git repository.

graceguo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e4742f  [fix] edit chart title cause JS error (#6438)
3e4742f is described below

commit 3e4742fa7b341d603a226fbaa9023c7145fd70f4
Author: Grace Guo <gr...@airbnb.com>
AuthorDate: Tue Nov 27 10:36:56 2018 -0800

    [fix] edit chart title cause JS error (#6438)
---
 superset/assets/src/dashboard/actions/datasources.js            | 2 +-
 superset/assets/src/explore/components/ExploreChartHeader.jsx   | 3 ++-
 superset/assets/src/explore/components/ExploreViewContainer.jsx | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/superset/assets/src/dashboard/actions/datasources.js b/superset/assets/src/dashboard/actions/datasources.js
index 45702d3..b5fd0a5 100644
--- a/superset/assets/src/dashboard/actions/datasources.js
+++ b/superset/assets/src/dashboard/actions/datasources.js
@@ -28,7 +28,7 @@ export function fetchDatasourceMetadata(key) {
     return SupersetClient.get({
       endpoint: `/superset/fetch_datasource_metadata?datasourceKey=${key}`,
     })
-      .then(data => dispatch(data, key))
+      .then(data => dispatch(setDatasource(data, key)))
       .catch(response =>
         getClientErrorObject(response).then(({ error }) =>
           dispatch(fetchDatasourceFailed(error, key)),
diff --git a/superset/assets/src/explore/components/ExploreChartHeader.jsx b/superset/assets/src/explore/components/ExploreChartHeader.jsx
index 3d6eb84..b4cbc04 100644
--- a/superset/assets/src/explore/components/ExploreChartHeader.jsx
+++ b/superset/assets/src/explore/components/ExploreChartHeader.jsx
@@ -44,7 +44,8 @@ class ExploreChartHeader extends React.PureComponent {
       action: isNewSlice ? 'saveas' : 'overwrite',
     };
     this.props.actions.saveSlice(this.props.form_data, params)
-      .then((data) => {
+      .then((json) => {
+        const { data } = json;
         if (isNewSlice) {
           this.props.actions.createNewSlice(
             data.can_add, data.can_download, data.can_overwrite,
diff --git a/superset/assets/src/explore/components/ExploreViewContainer.jsx b/superset/assets/src/explore/components/ExploreViewContainer.jsx
index 758081d..bded187 100644
--- a/superset/assets/src/explore/components/ExploreViewContainer.jsx
+++ b/superset/assets/src/explore/components/ExploreViewContainer.jsx
@@ -15,6 +15,7 @@ import { chartPropShape } from '../../dashboard/util/propShapes';
 import * as exploreActions from '../actions/exploreActions';
 import * as saveModalActions from '../actions/saveModalActions';
 import * as chartActions from '../../chart/chartAction';
+import { fetchDatasourceMetadata } from '../../dashboard/actions/datasources';
 import { Logger, ActionLog, EXPLORE_EVENT_NAMES, LOG_ACTIONS_MOUNT_EXPLORER } from '../../logger';
 
 const propTypes = {
@@ -81,7 +82,7 @@ class ExploreViewContainer extends React.Component {
       (this.props.controls.datasource == null ||
         nextProps.controls.datasource.value !== this.props.controls.datasource.value)
     ) {
-      this.props.actions.fetchDatasourceMetadata(nextProps.form_data.datasource, true);
+      fetchDatasourceMetadata(nextProps.form_data.datasource, true);
     }
 
     const changedControlKeys = this.findChangedControlKeys(this.props.controls, nextProps.controls);