You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by am...@apache.org on 2021/02/13 20:01:00 UTC

[superset] branch feat/disable_filter_bar_in_edit_mode created (now c645256)

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

amitmiran pushed a change to branch feat/disable_filter_bar_in_edit_mode
in repository https://gitbox.apache.org/repos/asf/superset.git.


      at c645256  feat(native-filters): hide filterBar and toggle icon when in editMode

This branch includes the following new commits:

     new c645256  feat(native-filters): hide filterBar and toggle icon when in editMode

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: feat(native-filters): hide filterBar and toggle icon when in editMode

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c645256648eead5d4b18f25d64190c920ee8e186
Author: amitmiran137 <am...@nielsen.com>
AuthorDate: Sat Feb 13 21:59:06 2021 +0200

    feat(native-filters): hide filterBar and toggle icon when in editMode
---
 .../components/nativeFilters/FilterBar_spec.tsx    |  1 +
 .../src/dashboard/components/DashboardBuilder.jsx  |  1 +
 .../nativeFilters/FilterBar/FilterBar.tsx          | 22 +++++++++++++---------
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx b/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
index 97959f3..2c36fc0 100644
--- a/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
+++ b/superset-frontend/spec/javascripts/dashboard/components/nativeFilters/FilterBar_spec.tsx
@@ -26,6 +26,7 @@ import { mockStore } from 'spec/fixtures/mockStore';
 describe('FilterBar', () => {
   const props = {
     filtersOpen: false,
+    editMode: false,
     toggleFiltersBar: jest.fn(),
   };
 
diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder.jsx b/superset-frontend/src/dashboard/components/DashboardBuilder.jsx
index 945d956..e3a685c 100644
--- a/superset-frontend/src/dashboard/components/DashboardBuilder.jsx
+++ b/superset-frontend/src/dashboard/components/DashboardBuilder.jsx
@@ -301,6 +301,7 @@ class DashboardBuilder extends React.Component {
               <ErrorBoundary>
                 <FilterBar
                   filtersOpen={this.state.dashboardFiltersOpen}
+                  editMode={editMode}
                   toggleFiltersBar={this.toggleDashboardFiltersOpen}
                   directPathToChild={directPathToChild}
                 />
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
index 6e4dada..f948f9f 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBar.tsx
@@ -137,12 +137,14 @@ const FilterControls = styled.div`
 
 interface FiltersBarProps {
   filtersOpen: boolean;
+  editMode: boolean;
   toggleFiltersBar: any;
   directPathToChild?: string[];
 }
 
 const FilterBar: React.FC<FiltersBarProps> = ({
   filtersOpen,
+  editMode,
   toggleFiltersBar,
   directPathToChild,
 }) => {
@@ -161,7 +163,7 @@ const FilterBar: React.FC<FiltersBarProps> = ({
   const [visiblePopoverId, setVisiblePopoverId] = useState<string | null>(null);
 
   useEffect(() => {
-    if (filterConfigs.length === 0 && filtersOpen) {
+    if ((filterConfigs.length === 0 && filtersOpen) || editMode) {
       toggleFiltersBar(false);
     }
   }, [filterConfigs]);
@@ -229,14 +231,16 @@ const FilterBar: React.FC<FiltersBarProps> = ({
 
   return (
     <BarWrapper data-test="filter-bar" className={cx({ open: filtersOpen })}>
-      <CollapsedBar
-        className={cx({ open: !filtersOpen })}
-        onClick={() => toggleFiltersBar(true)}
-      >
-        <StyledCollapseIcon name="collapse" />
-        <Icon name="filter" />
-      </CollapsedBar>
-      <Bar className={cx({ open: filtersOpen })}>
+      {!editMode && (
+        <CollapsedBar
+          className={cx({ open: !filtersOpen })}
+          onClick={() => toggleFiltersBar(true)}
+        >
+          <StyledCollapseIcon name="collapse" />
+          <Icon name="filter" />
+        </CollapsedBar>
+      )}
+      <Bar className={cx({ open: !editMode && filtersOpen })}>
         <TitleArea>
           <span>
             {t('Filters')} ({filterConfigs.length})