superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: Fixes default hanlding in Altered slice tag (#3903)
Date Mon, 20 Nov 2017 16:43:39 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin 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 1d702f2  Fixes default hanlding in Altered slice tag (#3903)
1d702f2 is described below

commit 1d702f2142f9702e51f770ef5e5d11a626d85c55
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Mon Nov 20 08:43:38 2017 -0800

    Fixes default hanlding in Altered slice tag (#3903)
---
 .../explore/components/ExploreChartHeader.jsx            | 16 ++++++----------
 superset/assets/javascripts/explore/index.jsx            |  9 +++++++--
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/superset/assets/javascripts/explore/components/ExploreChartHeader.jsx b/superset/assets/javascripts/explore/components/ExploreChartHeader.jsx
index 3750fc0..b8b52e3 100644
--- a/superset/assets/javascripts/explore/components/ExploreChartHeader.jsx
+++ b/superset/assets/javascripts/explore/components/ExploreChartHeader.jsx
@@ -55,13 +55,6 @@ class ExploreChartHeader extends React.PureComponent {
       });
   }
 
-  renderAlteredTag() {
-    const origFormData = (this.props.slice && this.props.slice.form_data) || {};
-    const currentFormData = this.props.form_data;
-    const tagProps = { origFormData, currentFormData };
-    return (<AlteredSliceTag {...tagProps} />);
-  }
-
   renderChartTitle() {
     let title;
     if (this.props.slice) {
@@ -113,9 +106,12 @@ class ExploreChartHeader extends React.PureComponent {
           </TooltipWrapper>
         </span>
         }
-
-        {this.renderAlteredTag()}
-
+        {this.props.chart.sliceFormData &&
+          <AlteredSliceTag
+            origFormData={this.props.chart.sliceFormData}
+            currentFormData={this.props.form_data}
+          />
+        }
         <div className="pull-right">
           {this.props.chart.chartStatus === 'success' &&
           queryResponse &&
diff --git a/superset/assets/javascripts/explore/index.jsx b/superset/assets/javascripts/explore/index.jsx
index fa92d7c..7e2ed35 100644
--- a/superset/assets/javascripts/explore/index.jsx
+++ b/superset/assets/javascripts/explore/index.jsx
@@ -36,8 +36,12 @@ const bootstrappedState = Object.assign(
     isStarred: false,
   },
 );
-
-const chartKey = bootstrappedState.slice ? ('slice_' + bootstrappedState.slice.slice_id)
: 'slice';
+const slice = bootstrappedState.slice;
+const sliceFormData = slice ?
+  getFormDataFromControls(getControlsState(bootstrapData, slice.form_data))
+  :
+  null;
+const chartKey = slice ? ('slice_' + slice.slice_id) : 'slice';
 const initState = {
   charts: {
     [chartKey]: {
@@ -47,6 +51,7 @@ const initState = {
       chartUpdateEndTime: null,
       chartUpdateStartTime: now(),
       latestQueryFormData: getFormDataFromControls(controls),
+      sliceFormData,
       queryRequest: null,
       queryResponse: null,
       triggerQuery: true,

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message