Skip to content
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

feat: New time range label #22317

Merged
merged 7 commits into from
Dec 5, 2022
Merged

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Dec 2, 2022

SUMMARY

This PR implements the new design for time range pill. Functionality wise it works the same as before, except that I added additional tooltip when the label is truncated.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-12-02.at.16.28.07.mov

TESTING INSTRUCTIONS

Test the new time range pill in native filters (horizontal and vertical), in native filters config modal and in Explore adhoc filters.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Dec 2, 2022

Codecov Report

Merging #22317 (de426c3) into master (7bc5f04) will decrease coverage by 0.01%.
The diff coverage is 57.14%.

@@            Coverage Diff             @@
##           master   #22317      +/-   ##
==========================================
- Coverage   66.89%   66.87%   -0.02%     
==========================================
  Files        1847     1847              
  Lines       70333    70422      +89     
  Branches     7702     7726      +24     
==========================================
+ Hits        47047    47093      +46     
- Misses      21288    21327      +39     
- Partials     1998     2002       +4     
Flag Coverage Δ
javascript 53.80% <57.14%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/src/filters/components/Time/TimeFilterPlugin.tsx 0.00% <0.00%> (ø)
...nts/controls/DateFilterControl/DateFilterLabel.tsx 55.31% <33.33%> (-2.83%) ⬇️
...ontrols/DateFilterControl/components/DateLabel.tsx 100.00% <100.00%> (ø)
...eModal/DatabaseConnectionForm/CommonParameters.tsx 76.92% <0.00%> (-8.80%) ⬇️
...t-frontend/src/dashboard/reducers/nativeFilters.ts 40.74% <0.00%> (-3.26%) ⬇️
...rontend/src/components/DropdownContainer/index.tsx 72.83% <0.00%> (-2.17%) ⬇️
...ilters/FilterBar/FilterControls/FilterControls.tsx 68.62% <0.00%> (-1.59%) ⬇️
...c/views/CRUD/data/database/DatabaseModal/index.tsx 41.27% <0.00%> (-0.72%) ⬇️
...d/components/DashboardBuilder/DashboardBuilder.tsx 73.58% <0.00%> (-0.71%) ⬇️
...t-frontend/src/dashboard/actions/dashboardState.js 52.45% <0.00%> (-0.50%) ⬇️
... and 32 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

} else {
const tooltipTitle = labelIsTruncated ? (
<>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fragment necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope! Removed

};

// This is the color that antd components (such as Select or Input) use on hover
// TODO: use theme.colors.primary.base here and in antd components
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just set it as the primary color already?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did initially, but when this component is placed next to antd components (which is the case in the filter bar), you can see the color difference when you hover. We could override antd's border colors on hover, but I'd rather we do it as a separate task since we'd need to take care of many antd components

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for the context!

@michael-s-molina
Copy link
Member

There's no red border indicating a validation error.

Screen.Recording.2022-12-02.at.11.40.02.AM.mov

@villebro
Copy link
Member

villebro commented Dec 2, 2022

I love the new design! ❤️ I will look more closely later today/the weekend if this isn't merged before then.

@kgabryje
Copy link
Member Author

kgabryje commented Dec 2, 2022

Well spotted @michael-s-molina! Fixed + I cleaned up some old css

image

@kgabryje
Copy link
Member Author

kgabryje commented Dec 2, 2022

@eric-briscoe could you review as well please?

Copy link
Member

@codyml codyml left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I opened a PR to help with a tooltip bug caused by the useCSSTextTruncation hook that shows up in this PR, but it's not related to this PR's code so no need to include here. I also noticed the same thing as in a previous PR about popovers for filters in the overflow dropdown, where clicking Cancel or Apply closes the overflow dropdown preemptively, but we already talked about fixing that in a separate PR.

@zhaoyongjie zhaoyongjie self-requested a review December 3, 2022 09:31
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave some comments about the style and design. The new Date Label is better than before. Thanks for the improvement!

Comment on lines -148 to +150
setTooltipTitle(NO_TIME_RANGE);
setTooltipTitle(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO_TIME_RANGE represents a time filter constant, which means No filter in the time filter, so I think the original tooltip title should be kept.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want tooltip to display the label text if label is truncated + the actual time range of it's different than human readable label.
In the case of no filter both the label and the tooltip said "No filter" which was redundant.

} else {
const tooltipTitle = labelIsTruncated ? (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Here, the tooltip title is either HRT(human-readable text) or ADR(actual date time range). I know the design goal is when the value is truncated, the untruncated value should be displayed in the tooltip title. In practice, the effect is weird, --- there are multiple lines but I don't know which one is HRT, and which one is ADR.

BTW, the width of the tooltips seems too narrow.

Copy link
Member Author

@kgabryje kgabryje Dec 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah in the case from your screenshot it looks weird. However, when ADR is difficult to read (like DATEADD expressions) and the HRT is cut, I think adding HRT to the tooltip is useful for the user. I'll increase the spacing between HRT and ADR in the tooltip to make it easier to read

@kgabryje
Copy link
Member Author

kgabryje commented Dec 5, 2022

/testenv up FEATURE_HORIZONTAL_FILTER_BAR=true

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

@kgabryje Ephemeral environment spinning up at http://35.91.100.227:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@villebro
Copy link
Member

villebro commented Dec 5, 2022

When I create a "Last Year" filter, the popover shows the actual range ("...< col < ...")
image
However, hovering doesn't show the actual range:
image

But when I do a filter that overflows, it shows the tooltip with the actual range, twice:
image

I assume it should work as follows:

  1. the tooltip should always show the actual range
  2. The duplicate tooltip should probably be disabled

@kgabryje
Copy link
Member Author

kgabryje commented Dec 5, 2022

@villebro Thanks for review!
I don't think we display a tooltip for "Last year" in the current date pill either. Moreover, there's a bug which causes the tooltip related to previous selection to appear.

Screen.Recording.2022-12-05.at.15.41.27.mov

As for the "double" tooltip... that looks like html title. I'll try to remove it

@apache apache deleted a comment from villebro Dec 5, 2022
@kgabryje
Copy link
Member Author

kgabryje commented Dec 5, 2022

@villebro Added tooltip with actual range for Last/Previous frames
image

Unfortunately the double tooltip is a Safari "feature" - Safari adds it automatically for truncated texts :(

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kgabryje kgabryje merged commit 2d30e9c into apache:master Dec 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

Ephemeral environment shutdown and build artifacts deleted.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants