superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccwilli...@apache.org
Subject [incubator-superset] 13/26: [dashboard v2] fix bugs from rebase
Date Fri, 22 Jun 2018 00:54:28 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 439fa1476ee9c3117997b05f25c3c3d8c54e9d91
Author: Chris Williams <chris.williams@airbnb.com>
AuthorDate: Wed May 23 17:12:51 2018 -0700

    [dashboard v2] fix bugs from rebase
---
 superset/assets/src/dashboard/actions/dashboardState.js    |  2 +-
 superset/assets/src/dashboard/components/SliceHeader.jsx   |  4 ++++
 .../src/dashboard/components/gridComponents/Chart.jsx      |  4 +++-
 superset/assets/src/dashboard/containers/Chart.jsx         |  2 +-
 superset/assets/src/dashboard/reducers/getInitialState.js  |  2 +-
 .../dashboard/util/charts/getFormDataWithExtraFilters.js   | 14 ++++++--------
 6 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/superset/assets/src/dashboard/actions/dashboardState.js b/superset/assets/src/dashboard/actions/dashboardState.js
index 42f68ad..aac4f98 100644
--- a/superset/assets/src/dashboard/actions/dashboardState.js
+++ b/superset/assets/src/dashboard/actions/dashboardState.js
@@ -5,7 +5,7 @@ import { ActionCreators as UndoActionCreators } from 'redux-undo';
 import { addChart, removeChart, refreshChart } from '../../chart/chartAction';
 import { chart as initChart } from '../../chart/chartReducer';
 import { fetchDatasourceMetadata } from '../../dashboard/actions/datasources';
-import { applyDefaultFormData } from '../../explore/stores/store';
+import { applyDefaultFormData } from '../../explore/store';
 import { getAjaxErrorMsg } from '../../modules/utils';
 import { SAVE_TYPE_OVERWRITE } from '../util/constants';
 import { t } from '../../locales';
diff --git a/superset/assets/src/dashboard/components/SliceHeader.jsx b/superset/assets/src/dashboard/components/SliceHeader.jsx
index 0c572d8..3151841 100644
--- a/superset/assets/src/dashboard/components/SliceHeader.jsx
+++ b/superset/assets/src/dashboard/components/SliceHeader.jsx
@@ -21,6 +21,7 @@ const propTypes = {
   annotationQuery: PropTypes.object,
   annotationError: PropTypes.object,
   sliceName: PropTypes.string,
+  supersetCanExplore: PropTypes.bool,
 };
 
 const defaultProps = {
@@ -38,6 +39,7 @@ const defaultProps = {
   isCached: false,
   isExpanded: false,
   sliceName: '',
+  supersetCanExplore: false,
 };
 
 class SliceHeader extends React.PureComponent {
@@ -53,6 +55,7 @@ class SliceHeader extends React.PureComponent {
       exportCSV,
       innerRef,
       sliceName,
+      supersetCanExplore,
     } = this.props;
 
     const annoationsLoading = t('Annotation layers are still loading.');
@@ -95,6 +98,7 @@ class SliceHeader extends React.PureComponent {
               forceRefresh={forceRefresh}
               exploreChart={exploreChart}
               exportCSV={exportCSV}
+              supersetCanExplore={supersetCanExplore}
             />
           )}
         </div>
diff --git a/superset/assets/src/dashboard/components/gridComponents/Chart.jsx b/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
index 9f8d723..2aedca7 100644
--- a/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/Chart.jsx
@@ -7,7 +7,7 @@ import SliceHeader from '../SliceHeader';
 import ChartContainer from '../../../chart/ChartContainer';
 import { chartPropType } from '../../../chart/chartReducer';
 import { slicePropShape } from '../../util/propShapes';
-import { VIZ_TYPES } from '../../../visualizations/main';
+import { VIZ_TYPES } from '../../../visualizations';
 
 const propTypes = {
   id: PropTypes.number.isRequired,
@@ -161,6 +161,8 @@ class Chart extends React.Component {
       sliceCanEdit,
     } = this.props;
 
+    if (!chart || !slice) return null;
+
     const { width } = this.state;
     const { queryResponse } = chart;
     const isCached = queryResponse && queryResponse.is_cached;
diff --git a/superset/assets/src/dashboard/containers/Chart.jsx b/superset/assets/src/dashboard/containers/Chart.jsx
index 107e6c7..2b38d8a 100644
--- a/superset/assets/src/dashboard/containers/Chart.jsx
+++ b/superset/assets/src/dashboard/containers/Chart.jsx
@@ -27,7 +27,7 @@ function mapStateToProps(
 
   return {
     chart,
-    datasource: datasources[chart.form_data.datasource],
+    datasource: chart && datasources[chart.form_data.datasource],
     slice: sliceEntities.slices[id],
     timeout: dashboardInfo.common.conf.SUPERSET_WEBSERVER_TIMEOUT,
     filters,
diff --git a/superset/assets/src/dashboard/reducers/getInitialState.js b/superset/assets/src/dashboard/reducers/getInitialState.js
index f129bf7..534b15d 100644
--- a/superset/assets/src/dashboard/reducers/getInitialState.js
+++ b/superset/assets/src/dashboard/reducers/getInitialState.js
@@ -4,7 +4,7 @@ import shortid from 'shortid';
 import { chart } from '../../chart/chartReducer';
 import { initSliceEntities } from './sliceEntities';
 import { getParam } from '../../modules/utils';
-import { applyDefaultFormData } from '../../explore/stores/store';
+import { applyDefaultFormData } from '../../explore/store';
 import { getColorFromScheme } from '../../modules/colors';
 import layoutConverter from '../util/dashboardLayoutConverter';
 import { DASHBOARD_VERSION_KEY, DASHBOARD_HEADER_ID } from '../util/constants';
diff --git a/superset/assets/src/dashboard/util/charts/getFormDataWithExtraFilters.js b/superset/assets/src/dashboard/util/charts/getFormDataWithExtraFilters.js
index 031d90d..17f7bb3 100644
--- a/superset/assets/src/dashboard/util/charts/getFormDataWithExtraFilters.js
+++ b/superset/assets/src/dashboard/util/charts/getFormDataWithExtraFilters.js
@@ -7,7 +7,7 @@ const cachedFiltersByChart = {};
 const cachedFormdataByChart = {};
 
 export default function getFormDataWithExtraFilters({
-  chart,
+  chart = {},
   dashboardMetadata,
   filters,
   sliceId,
@@ -23,15 +23,13 @@ export default function getFormDataWithExtraFilters({
     return cachedFormdataByChart[sliceId];
   }
 
-  const extraFilters = getEffectiveExtraFilters({
-    dashboardMetadata,
-    filters,
-    sliceId,
-  });
-
   const formData = {
     ...chart.formData,
-    extra_filters: [...chart.formData.filters, ...extraFilters],
+    extra_filters: getEffectiveExtraFilters({
+      dashboardMetadata,
+      filters,
+      sliceId,
+    }),
   };
 
   cachedDashboardMetadataByChart[sliceId] = dashboardMetadata;


Mime
View raw message