You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/30 21:59:22 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #22276: feat: Programmatically open "more filters" dropdown in Horizontal Filter Bar

michael-s-molina commented on code in PR #22276:
URL: https://github.com/apache/superset/pull/22276#discussion_r1036480447


##########
superset-frontend/src/dashboard/util/useFilterFocusHighlightStyles.ts:
##########
@@ -67,9 +68,9 @@ const useFilterFocusHighlightStyles = (chartId: number) => {
     pointerEvents: 'auto',
   };
 
-  if (focusedNativeFilterId) {
+  if (highlighterFilterId) {
     if (
-      nativeFilters.filters[focusedNativeFilterId]?.chartsInScope?.includes(
+      nativeFilters.filters[highlighterFilterId]?.chartsInScope?.includes(

Review Comment:
   ```suggestion
         nativeFilters.filters[highlightedFilterId]?.chartsInScope?.includes(
   ```



##########
superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx:
##########
@@ -340,9 +340,10 @@ export class Tabs extends React.PureComponent {
     const { tabIndex: selectedTabIndex, activeKey } = this.state;
 
     let tabsToHighlight;
-    if (nativeFilters?.focusedFilterId) {
-      tabsToHighlight =
-        nativeFilters.filters[nativeFilters.focusedFilterId].tabsInScope;
+    const highlighterFilterId =
+      nativeFilters?.focusedFilterId || nativeFilters?.hoveredFilterId;
+    if (highlighterFilterId) {
+      tabsToHighlight = nativeFilters.filters[highlighterFilterId]?.tabsInScope;

Review Comment:
   ```suggestion
       const highlightedFilterId =
         nativeFilters?.focusedFilterId || nativeFilters?.hoveredFilterId;
       if (highlightedFilterId) {
         tabsToHighlight = nativeFilters.filters[highlightedFilterId]?.tabsInScope;
   ```



##########
superset-frontend/src/dashboard/util/useFilterFocusHighlightStyles.ts:
##########
@@ -49,8 +49,9 @@ const useFilterFocusHighlightStyles = (chartId: number) => {
     dashboardFilters,
   );
 
-  const focusedNativeFilterId = nativeFilters.focusedFilterId;
-  if (!(focusedFilterScope || focusedNativeFilterId)) {
+  const highlighterFilterId =
+    nativeFilters?.focusedFilterId || nativeFilters?.hoveredFilterId;
+  if (!(focusedFilterScope || highlighterFilterId)) {

Review Comment:
   ```suggestion
     const highlightedFilterId =
       nativeFilters?.focusedFilterId || nativeFilters?.hoveredFilterId;
     if (!(focusedFilterScope || highlightedFilterId)) {
   ```



##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/utils.ts:
##########
@@ -21,8 +21,21 @@ import { Dispatch } from 'react';
 import {
   setFocusedNativeFilter,
   unsetFocusedNativeFilter,
+  setHoveredNativeFilter,
+  unsetHoveredNativeFilter,
 } from 'src/dashboard/actions/nativeFilters';
 
+export const dispatchHoverAction = debounce(
+  (dispatch: Dispatch<any>, id?: string) => {
+    if (id) {
+      dispatch(setHoveredNativeFilter(id));
+    } else {
+      dispatch(unsetHoveredNativeFilter());
+    }
+  },
+  300,

Review Comment:
   There's a `FAST_DEBOUNCE` in `src/constants.ts`



##########
superset-frontend/src/dashboard/util/useFilterFocusHighlightStyles.ts:
##########
@@ -67,9 +68,9 @@ const useFilterFocusHighlightStyles = (chartId: number) => {
     pointerEvents: 'auto',
   };
 
-  if (focusedNativeFilterId) {
+  if (highlighterFilterId) {

Review Comment:
   ```suggestion
     if (highlightedFilterId) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org