You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yo...@apache.org on 2022/03/25 00:00:32 UTC

[superset] branch master updated: fix: number format should editable when AA in time comparison (#19351)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new e15573d  fix: number format should editable when AA in time comparison (#19351)
e15573d is described below

commit e15573d4453f8432e2da1db86f2e9417666fb8b5
Author: Yongjie Zhao <yo...@gmail.com>
AuthorDate: Fri Mar 25 07:58:53 2022 +0800

    fix: number format should editable when AA in time comparison (#19351)
---
 .../src/shared-controls/index.tsx                         | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
index ff15a6f..edd6e30 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/index.tsx
@@ -44,6 +44,7 @@ import {
   legacyValidateInteger,
   validateNonEmpty,
   JsonArray,
+  ComparisionType,
 } from '@superset-ui/core';
 
 import {
@@ -455,16 +456,12 @@ const y_axis_format: SharedControlConfig<'SelectControl', SelectDefaultOption> =
     filterOption: ({ data: option }, search) =>
       option.label.includes(search) || option.value.includes(search),
     mapStateToProps: state => {
-      const showWarning =
-        state.controls?.comparison_type?.value === 'percentage';
+      const isPercentage =
+        state.controls?.comparison_type?.value === ComparisionType.Percentage;
       return {
-        warning: showWarning
-          ? t(
-              'When `Calculation type` is set to "Percentage change", the Y ' +
-                'Axis Format is forced to `.1%`',
-            )
-          : null,
-        disabled: showWarning,
+        choices: isPercentage
+          ? D3_FORMAT_OPTIONS.filter(option => option[0].includes('%'))
+          : D3_FORMAT_OPTIONS,
       };
     },
   };