graceguo-supercat commented on a change in pull request #8166: 
[feature][dashboard] Show/hide filter indicator on the applicable charts when 
filter options are open/close
URL: 
https://github.com/apache/incubator-superset/pull/8166#discussion_r322503718
 
 

 ##########
 File path: 
superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx
 ##########
 @@ -64,49 +65,79 @@ const propTypes = {
 
 const defaultProps = {
   directPathToChild: [],
+  directPathLastUpdated: 0,
 };
 
 class ChartHolder extends React.Component {
-  static renderInFocusCSS(labelName) {
+  static renderInFocusCSS(columnName) {
     return (
       <style>
-        {`.inFocus label[for=${labelName}] + .Select .Select-control {
-                    border: 2px solid #00736a;
+        {`label[for=${columnName}] + .Select .Select-control {
+                    border-color: #00736a;
+                    transition: border-color 1s ease-in-out;
            }`}
       </style>
     );
   }
 
+  static getDerivedStateFromProps(props, state) {
+    const { component, directPathToChild, directPathLastUpdated } = props;
+    const {
+      label: columnName,
+      chart: chartComponentId,
+    } = getChartAndLabelComponentIdFromPath(directPathToChild);
+
+    if (
+      directPathLastUpdated !== state.directPathLastUpdated &&
+      component.id === chartComponentId
+    ) {
+      return {
+        outlinedComponentId: component.id,
+        outlinedColumnName: columnName,
+        directPathLastUpdated,
+      };
+    }
+    return null;
+  }
+
   constructor(props) {
     super(props);
     this.state = {
       isFocused: false,
+      outlinedComponentId: null,
+      outlinedColumnName: null,
+      directPathLastUpdated: 0,
     };
+    // window.clearTimeout's key is global,
+    // we don't want one chart clear out another's chart's timeout.
+    this.timer = [];
 
 Review comment:
   not necessary to keep an instance variable for timer. removed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to