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(native-filters): add optional time col to time range #15117

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Jun 11, 2021

SUMMARY

Adds an optional time column option to the filter config modal to achieve full feature parity with Filter Box.

BEFORE

Currently time ranges can only be applied to the default time column:
image

AFTER

When no time range is specified, the time column control is hidden:
image

When a time range is specified, the optional time column control is exposed (when left unpopulated, the default time column is used):
image

In addition, the sort metric is moved to a row of it's own, and a tooltip is added to the control:
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: closes [native filters] Select filter should allow user pick time column #14744
  • 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

Comment on lines -77 to +78
granularity_sqla: 'ds',
granularity_sqla,
Copy link
Member Author

Choose a reason for hiding this comment

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

😁

Copy link
Member

@kgabryje kgabryje 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
Copy link
Member

kgabryje commented Jun 11, 2021

A couple of points to discuss:

  1. Should the time range picker and time column be in 1 row? That would strongly suggest to the user that those 2 fields are closely related. In my opinion, due to a rather large vertical distance between time range and time column, they seem like separate values at first glance image
  2. Should we prefill time column with the default value rather than leaving it empty? That would make it clearer which column is being used, especially when user doesn't know which temporal column is default

@codecov
Copy link

codecov bot commented Jun 11, 2021

Codecov Report

Merging #15117 (1ff0498) into master (5e825cf) will decrease coverage by 0.01%.
The diff coverage is 56.00%.

❗ Current head 1ff0498 differs from pull request most recent head 8ebb589. Consider uploading reports for the commit 8ebb589 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15117      +/-   ##
==========================================
- Coverage   77.54%   77.52%   -0.02%     
==========================================
  Files         967      967              
  Lines       49759    49798      +39     
  Branches     6352     6364      +12     
==========================================
+ Hits        38585    38607      +22     
- Misses      10972    10989      +17     
  Partials      202      202              
Flag Coverage Δ
javascript 72.42% <56.00%> (-0.03%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/dashboard/actions/hydrate.js 1.72% <ø> (ø)
...mponents/nativeFilters/FiltersConfigModal/utils.ts 66.25% <ø> (ø)
...nd/src/dashboard/components/nativeFilters/utils.ts 86.25% <ø> (ø)
...nd/src/dashboard/containers/DashboardComponent.jsx 92.30% <ø> (ø)
...-frontend/src/dashboard/reducers/dashboardState.js 73.33% <0.00%> (ø)
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 68.83% <16.66%> (-1.24%) ⬇️
...t-frontend/src/dashboard/actions/dashboardState.js 28.65% <33.33%> (ø)
...nd/src/dashboard/components/nativeFilters/state.ts 75.00% <64.10%> (-25.00%) ⬇️
...d/src/dashboard/components/gridComponents/Tabs.jsx 86.79% <85.71%> (-0.71%) ⬇️
...ilters/FilterBar/FilterControls/FilterControls.tsx 80.00% <100.00%> (+2.41%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e825cf...8ebb589. Read the comment docs.

@villebro
Copy link
Member Author

villebro commented Jun 11, 2021

  1. Should the time range picker and time column be in 1 row? That would strongly suggest to the user that those 2 fields are closely related. In my opinion, due to a rather large vertical distance between time range and time column, they seem like separate values at first glance image

I initially had it like that, but it seemed to look better when moved to the next row (this is a similar solution as that which we've opted for in Explore). But I don't mind having it on the same line if it causes less confusion.

  1. Should we prefill time column with the default value rather than leaving it empty? That would make it clearer which column is being used, especially when user doesn't know which temporal column is default

That's not a bad idea. I left the option to clear so that it would be possible to fall back to the default dttm column in the dataset. But I agree that it would be more explicit to always specify the time column, especially as Filter Box does it like this.

@junlincc thoughts?

@junlincc
Copy link
Member

change request: select show only when there are more than 1 time columns

@villebro
Copy link
Member Author

change request: select show only when there are more than 1 time columns

Great idea! Thanks all for the feedback, I'll implement all changes proposed here and request a new round of reviews once done.

const props = createProps();
const { container } = render(<ColumnSelect {...(props as any)} />, {
useRedux: true,
});
expect(container.children).toHaveLength(1);
userEvent.type(screen.getByRole('combobox'), 'column_name');
await waitFor(() => {
Copy link
Member

Choose a reason for hiding this comment

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

You can join them all in one waitFor

});
expect(container.children).toHaveLength(1);
userEvent.type(screen.getByRole('combobox'), 'column_name');
await waitFor(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Same as previous comment

@michael-s-molina
Copy link
Member

One nit: the sort type and sort metric have different widths.

@villebro
Copy link
Member Author

Merging to unblock work on a related issue (will address the test comment in a separate PR)

@villebro villebro merged commit 9c3c3fa into apache:master Jun 15, 2021
@villebro villebro deleted the villebro/filter-time-col branch June 15, 2021 10:25
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 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 preset-io size/L 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native filters] Select filter should allow user pick time column
5 participants