You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/03/30 13:30:43 UTC

[superset] branch master updated: chore: Adds a tooltip to pre-filter in native filters modal (#23481)

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

michaelsmolina 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 63751c6c0f chore: Adds a tooltip to pre-filter in native filters modal (#23481)
63751c6c0f is described below

commit 63751c6c0f10ac4cf75dd18a0dece99e0dc33470
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Thu Mar 30 10:30:32 2023 -0300

    chore: Adds a tooltip to pre-filter in native filters modal (#23481)
---
 .../cypress/integration/dashboard/nativeFilters.test.ts       | 11 ++++++-----
 .../cypress-base/cypress/integration/dashboard/utils.ts       |  1 +
 .../FiltersConfigForm/FiltersConfigForm.tsx                   |  5 +++++
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
index 3126b75625..59f5f0010c 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
@@ -631,7 +631,8 @@ describe('Native filters', () => {
     it('Verify setting options and tooltips for value filter', () => {
       enterNativeFilterEditModal(false);
       cy.contains('Filter value is required').should('be.visible').click();
-      checkNativeFilterTooltip(0, nativeFilterTooltips.defaultValue);
+      checkNativeFilterTooltip(0, nativeFilterTooltips.preFilter);
+      checkNativeFilterTooltip(1, nativeFilterTooltips.defaultValue);
       cy.get(nativeFilters.modal.container).should('be.visible');
       valueNativeFilterOptions.forEach(el => {
         cy.contains(el);
@@ -640,10 +641,10 @@ describe('Native filters', () => {
       cy.get(
         nativeFilters.filterConfigurationSections.checkedCheckbox,
       ).contains('Can select multiple values');
-      checkNativeFilterTooltip(1, nativeFilterTooltips.required);
-      checkNativeFilterTooltip(2, nativeFilterTooltips.defaultToFirstItem);
-      checkNativeFilterTooltip(3, nativeFilterTooltips.searchAllFilterOptions);
-      checkNativeFilterTooltip(4, nativeFilterTooltips.inverseSelection);
+      checkNativeFilterTooltip(2, nativeFilterTooltips.required);
+      checkNativeFilterTooltip(3, nativeFilterTooltips.defaultToFirstItem);
+      checkNativeFilterTooltip(4, nativeFilterTooltips.searchAllFilterOptions);
+      checkNativeFilterTooltip(5, nativeFilterTooltips.inverseSelection);
       clickOnAddFilterInModal();
       cy.contains('Values are dependent on other filters').should('exist');
     });
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
index 84e82b796e..0b8776b06c 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
@@ -85,6 +85,7 @@ export const nativeFilterTooltips = {
   multipleSelect: 'Allow selecting multiple values',
   defaultValue:
     'Default value must be set when "Filter value is required" is checked',
+  preFilter: `Add filter clauses to control the filter's source query, though only in the context of the autocomplete i.e., these conditions do not impact how the filter is applied to the dashboard. This is useful when you want to improve the query's performance by only scanning a subset of the underlying data or limit the available values displayed in the filter.`,
 };
 
 export const nativeFilterOptions = [
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
index 1abc121b86..3b804acd8f 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
@@ -956,6 +956,11 @@ const FiltersConfigForm = (
                   <CollapsibleControl
                     initialValue={hasPreFilter}
                     title={t('Pre-filter available values')}
+                    tooltip={t(`Add filter clauses to control the filter's source query,
+                    though only in the context of the autocomplete i.e., these conditions
+                    do not impact how the filter is applied to the dashboard. This is useful
+                    when you want to improve the query's performance by only scanning a subset
+                    of the underlying data or limit the available values displayed in the filter.`)}
                     onChange={checked => {
                       formChanged();
                       if (checked) {