You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/10 21:49:24 UTC

[GitHub] mistercrunch closed pull request #4799: [bugfix] when num_period_compare is not set

mistercrunch closed pull request #4799: [bugfix] when num_period_compare is not set
URL: https://github.com/apache/incubator-superset/pull/4799
 
 
   

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/javascripts/explore/stores/controls.jsx b/superset/assets/javascripts/explore/stores/controls.jsx
index 7e82e07e28..d95e0618e5 100644
--- a/superset/assets/javascripts/explore/stores/controls.jsx
+++ b/superset/assets/javascripts/explore/stores/controls.jsx
@@ -1199,11 +1199,17 @@ export const controls = {
     default: '.3s',
     choices: D3_FORMAT_OPTIONS,
     description: D3_FORMAT_DOCS,
-    mapStateToProps: state => ({
-      warning: state.controls && state.controls.num_period_compare.value !== '' ?
-        t('When `Period Ratio` is set, the Y Axis Format is forced to `.1%`') : null,
-      disabled: state.controls && state.controls.num_period_compare.value !== '',
-    }),
+    mapStateToProps: (state) => {
+      const showWarning = (
+          state.controls &&
+          state.controls.num_period_compare &&
+          state.controls.num_period_compare.value !== '');
+      return {
+        warning: showWarning ?
+          t('When `Period Ratio` is set, the Y Axis Format is forced to `.1%`') : null,
+        disabled: showWarning,
+      };
+    },
   },
 
   y_axis_2_format: {


 

----------------------------------------------------------------
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