You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/14 17:48:24 UTC

[GitHub] williaster closed pull request #5572: [bugfix] line_multi chart crashed on chosen (#5568)

williaster closed pull request #5572: [bugfix] line_multi chart crashed on chosen (#5568)
URL: https://github.com/apache/incubator-superset/pull/5572
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/explore/components/DisplayQueryButton.jsx b/superset/assets/src/explore/components/DisplayQueryButton.jsx
index e098643af5..9bddac2afa 100644
--- a/superset/assets/src/explore/components/DisplayQueryButton.jsx
+++ b/superset/assets/src/explore/components/DisplayQueryButton.jsx
@@ -39,13 +39,14 @@ const defaultProps = {
 export default class DisplayQueryButton extends React.PureComponent {
   constructor(props) {
     super(props);
+    const { datasource } = props.latestQueryFormData;
     this.state = {
       language: null,
       query: null,
       data: null,
       isLoading: false,
       error: null,
-      sqlSupported: props.latestQueryFormData.datasource.split('__')[1] === 'table',
+      sqlSupported: datasource && datasource.split('__')[1] === 'table',
     };
     this.beforeOpen = this.beforeOpen.bind(this);
   }
diff --git a/superset/assets/src/explore/visTypes.jsx b/superset/assets/src/explore/visTypes.jsx
index f9cc723eeb..a27185b1bc 100644
--- a/superset/assets/src/explore/visTypes.jsx
+++ b/superset/assets/src/explore/visTypes.jsx
@@ -274,21 +274,14 @@ export const visTypes = {
       },
     },
     sectionOverrides: {
-      datasourceAndVizType: {
-        label: t('Chart Type'),
-        controlSetRows: [
-          ['viz_type'],
-          ['slice_id', 'cache_timeout'],
-        ],
-      },
       sqlaTimeSeries: {
         controlSetRows: [
-          ['since', 'until'],
+          ['time_range'],
         ],
       },
       druidTimeSeries: {
         controlSetRows: [
-          ['since', 'until'],
+          ['time_range'],
         ],
       },
     },
diff --git a/superset/assets/src/visualizations/line_multi.js b/superset/assets/src/visualizations/line_multi.js
index c164686ce5..684916c728 100644
--- a/superset/assets/src/visualizations/line_multi.js
+++ b/superset/assets/src/visualizations/line_multi.js
@@ -12,12 +12,11 @@ export default function lineMulti(slice, payload) {
   const fd = slice.formData;
 
   // fetch data from all the charts
-  const promises = [];
   const subslices = [
     ...payload.data.slices.axis1.map(subslice => [1, subslice]),
     ...payload.data.slices.axis2.map(subslice => [2, subslice]),
   ];
-  subslices.forEach(([yAxis, subslice]) => {
+  const promises = subslices.map(([yAxis, subslice]) => {
     let filters = subslice.form_data.filters || [];
     filters.concat(fd.filters);
     if (fd.extra_filters) {
@@ -26,27 +25,25 @@ export default function lineMulti(slice, payload) {
     const fdCopy = {
       ...subslice.form_data,
       filters,
-      since: fd.since,
-      until: fd.until,
+      time_range: fd.time_range,
     };
     const url = getExploreLongUrl(fdCopy, 'json');
-    promises.push(new Promise((resolve, reject) => {
+    return new Promise((resolve, reject) => {
       d3.json(url, (error, response) => {
         if (error) {
           reject(error);
         } else {
-          const data = [];
-          response.data.forEach((datum) => {
-            let key = datum.key;
-            if (fd.prefix_metric_with_slice_name) {
-              key = subslice.slice_name + ': ' + key;
-            }
-            data.push({ key, values: datum.values, type: fdCopy.viz_type, yAxis });
-          });
+          const addPrefix = fd.prefix_metric_with_slice_name;
+          const data = response.data.map(({ key, values }) => ({
+            key: addPrefix ? `${subslice.slice_name}: ${key}` : key,
+            type: fdCopy.viz_type,
+            values,
+            yAxis,
+          }));
           resolve(data);
         }
       });
-    }));
+    });
   });
 
   Promise.all(promises).then((data) => {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org