New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature][dashboard] Show/hide filter indicator on the applicable charts when filter options are open/close #8166
[feature][dashboard] Show/hide filter indicator on the applicable charts when filter options are open/close #8166
Conversation
@@ -56,12 +62,14 @@ class FilterIndicator extends React.PureComponent { | |||
return ( | |||
<FilterTooltipWrapper tooltip={filterTooltip}> | |||
<div | |||
className="filter-indicator" | |||
className={`filter-indicator ${ | |||
isFilterFieldActive ? 'isFilterFieldActive' : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this css class naming seems inconsistent, is there anything wrong with just adding on the class active
along with filter-indicator
? Or at least using dash case to match filter-indicator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now use active
.
getChartAndLabelComponentIdFromPath() { | ||
const { directPathToChild = [] } = this.props; | ||
const result = {}; | ||
UNSAFE_componentWillReceiveProps(nextProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of adding a new UNSAFE function, can we use one of the other recommendations here? https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now use getDerivedStateFromProps(props, state)
. Thanks!
this.setTypeCustomStartEnd(); | ||
} | ||
|
||
// if user click outside popover, popover will hide and we will call onCloseDateFilterControl, | ||
// but popover overlay trigger button is inside popover DOM h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this comment didn't get finished?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😓 fixed, and added more comments.
@@ -53,6 +53,8 @@ export default function transformProps(chartProps) { | |||
filtersFields, | |||
instantFiltering, | |||
onChange: onAddFilter, | |||
onFilterMenuOpen: hooks.onFilterMenuOpen, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could destructure these two handlers along with onAddFilter
on line 30 above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
@@ -338,7 +365,7 @@ export default class DateFilterControl extends React.Component { | |||
}); | |||
return ( | |||
<Popover id="filter-popover" placement="top" positionTop={0}> | |||
<div style={{ width: '250px' }}> | |||
<div style={{ width: '250px' }} ref={(ref) => { this.popoverContainer = ref; }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can make style constant outside of class so it won't create new object every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i fixed one place. there are quite a few inline css in this file and in the code base. we probably need to find a rule or consistent way to style component.
432ba0f
to
956cb9f
Compare
Codecov Report
@@ Coverage Diff @@
## master #8166 +/- ##
==========================================
- Coverage 66.16% 66.14% -0.02%
==========================================
Files 479 480 +1
Lines 22920 23002 +82
Branches 2524 2549 +25
==========================================
+ Hits 15164 15214 +50
- Misses 7622 7653 +31
- Partials 134 135 +1
Continue to review full report at Codecov.
|
d0e4d38
to
4fc48e5
Compare
c1ae6d4
to
eff509c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a couple more comments
} | ||
|
||
handleFilterMenuClose() { | ||
this.props.setFocusedFilterField(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is super clear, might prefer unsetFocusedFilterField
or perhaps setFocusedFilterField(null)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the purpose of empty parameter here is to clear/unset focused filter field state. Reducer function expects to handle this case.
I thought we prefer no params than explicitly null
params? I rarely see any example in our code that explicitly pass a null
to function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: added unsetFocusedFilterField
action creator.
return ( | ||
<style> | ||
{`.inFocus label[for=${labelName}] + .Select .Select-control { | ||
border: 2px solid #00736a; | ||
{`label[for=${columnName}] + .Select .Select-control { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it again that we need to add inline style elements to the react element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an alternative, I can pass the selected filter field as prop to filter_box component. But first, it is deeply nested inside Chart component. And since it is a data visualization component, its props needs to be validated from superset-ui chart props. Overall it will be 100 times more troublesome than 2 lines of inline css. :)
by the way this is update existed inline style, not adding new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems legit
}; | ||
// window.clearTimeout's key is global, | ||
// we don't want one chart clear out another's chart's timeout. | ||
this.timer = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what type is timer? It's not apparent to me that this should be an array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessary to keep an instance variable for timer. removed.
eff509c
to
8894641
Compare
8894641
to
af5e299
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks for addressing all the comments!
CATEGORY
Choose one
SUMMARY
This is part of dashboard filter indicator design:
This PR also fixed a couple of issue after #7908 is released:
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS
@kristw @etr2460 @kenchendesign