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

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

commit 23d4313b6cf178234a9d632c4200d11b5ecdf466
Author: Ville Brofeldt <[email protected]>
AuthorDate: Mon Apr 26 20:48:17 2021 +0300

    fix(native-filters): allowClear only when required not checked (#14353)
    
    * fix(native-filters): allowClear only when required not checked
    
    * Update superset-frontend/src/filters/components/Select/controlPanel.ts
    
    Co-authored-by: Kamil Gabryjelski <[email protected]>
    
    Co-authored-by: Kamil Gabryjelski <[email protected]>
    (cherry picked from commit 8a0d3210843cf3ff7191b88ba6de7973e2c78682)
---
 .../src/filters/components/Select/SelectFilterPlugin.tsx             | 2 +-
 superset-frontend/src/filters/components/Select/controlPanel.ts      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx 
b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
index 8efcaea..d779c46 100644
--- a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
+++ b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
@@ -148,7 +148,7 @@ export default function PluginFilterSelect(props: 
PluginFilterSelectProps) {
   return (
     <Styles height={height} width={width}>
       <StyledSelect
-        allowClear
+        allowClear={!enableEmptyFilter}
         // @ts-ignore
         value={values}
         disabled={forceFirstValue}
diff --git a/superset-frontend/src/filters/components/Select/controlPanel.ts 
b/superset-frontend/src/filters/components/Select/controlPanel.ts
index c41283d..a866c98 100644
--- a/superset-frontend/src/filters/components/Select/controlPanel.ts
+++ b/superset-frontend/src/filters/components/Select/controlPanel.ts
@@ -71,11 +71,12 @@ const config: ControlPanelConfig = {
             name: 'enableEmptyFilter',
             config: {
               type: 'CheckboxControl',
-              label: t('Enable empty filter'),
+              label: t('Required'),
               default: enableEmptyFilter,
               renderTrigger: true,
               description: t(
-                'When selection is empty, an always false filter event be 
emitted',
+                'User must select a value for this filter when filter is in 
single select mode. ' +
+                  'If selection is empty, an always false filter is emitted.',
               ),
             },
           },

Reply via email to