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 2021/09/01 09:39:08 UTC

[GitHub] [superset] michael-s-molina commented on a change in pull request #16154: feat(dashboard): Let users re-arrange native filters

michael-s-molina commented on a change in pull request #16154:
URL: https://github.com/apache/superset/pull/16154#discussion_r699656540



##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTabTitle.tsx
##########
@@ -0,0 +1,203 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { styled, t } from '@superset-ui/core';
+import React, { useRef } from 'react';
+import { DropTargetMonitor, useDrag, useDrop, XYCoord } from 'react-dnd';
+import Icons from 'src/components/Icons';
+import { REMOVAL_DELAY_SECS } from './utils';
+
+interface TabTitleContainerProps {
+  readonly isDragging: boolean;
+}
+const FILTER_TYPE = 'FILTER';
+const StyledFilterTitle = styled.span`
+  white-space: normal;
+  color: ${({ theme }) => theme.colors.grayscale.dark1};
+`;
+const TabTitleContainer = styled.div<TabTitleContainerProps>`
+  ${({ theme, isDragging }) => `
+  display: flex;
+  width: 100%;
+  border-radius:  ${theme.borderRadius}px;
+  opacity: ${isDragging ? 0.5 : 1};
+  padding-top: ${theme.gridUnit}px;
+  padding-bottom: ${theme.gridUnit}px;
+  padding-left: ${2 * theme.gridUnit}px;
+  &:hover {
+    transition: all 0.3s;
+    span, .anticon {
+      color: ${theme.colors.primary.dark1};
+    }
+  }
+`}
+`;

Review comment:
       ```suggestion
   const TabTitleContainer = styled.div<TabTitleContainerProps>`
     ${({ theme, isDragging }) => `
       display: flex;
       width: 100%;
       border-radius:  ${theme.borderRadius}px;
       opacity: ${isDragging ? 0.5 : 1};
       padding-top: ${theme.gridUnit}px;
       padding-bottom: ${theme.gridUnit}px;
       padding-left: ${2 * theme.gridUnit}px;
       &:hover {
         transition: all 0.3s;
         span, .anticon {
           color: ${theme.colors.primary.dark1};
         }
       }
     `}
   `;
   ```

##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx
##########
@@ -208,7 +230,11 @@ export function FiltersConfigModal({
     if (values) {
       createHandleSave(
         filterConfigMap,
-        filterIds,
+        filterIds
+          .slice()
+          .sort(
+            (a, b) => orderedFilters.indexOf(a) - orderedFilters.indexOf(b),
+          ),

Review comment:
       This code is duplicated in 3 places in this file. Could you extract it to a function?

##########
File path: superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTabs.tsx
##########
@@ -111,36 +71,42 @@ const FilterTabsContainer = styled(LineEditableTabs)`
     .ant-tabs-nav-list {
       overflow-x: hidden;
       overflow-y: auto;
+      width: 270px;
       padding-top: ${theme.gridUnit * 2}px;
       padding-right: ${theme.gridUnit}px;
       padding-bottom: ${theme.gridUnit * 3}px;
       padding-left: ${theme.gridUnit * 3}px;
-      width: 270px;
     }
 
     // extra selector specificity:
     &.ant-tabs-card > .ant-tabs-nav .ant-tabs-tab {
-      min-width: ${FILTER_WIDTH}px;
-      margin: 0 ${theme.gridUnit * 2}px 0 0;
-      padding: ${theme.gridUnit}px
-        ${theme.gridUnit * 2}px;
-      &:hover,
+      margin: 0;
+      padding: 0;
       &-active {
         color: ${theme.colors.grayscale.dark1};
-        border-radius: ${theme.borderRadius}px;
+        margin-bottom: ${theme.gridUnit / 2}px;
         background-color: ${theme.colors.secondary.light4};
 
         .ant-tabs-tab-remove > span {
           color: ${theme.colors.grayscale.base};
           transition: all 0.3s;
         }
+        .anticon {
+          color: ${theme.colors.grayscale.base};
+        }
+        :hover{
+          span {
+            color: ${theme.colors.grayscale.base} !important;

Review comment:
       We try to always avoid `!important`. Can you find another way to override the color? You can increase the specificity using `&`.




-- 
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