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

chore: Improves the native filters UI/UX - iteration 7 #15017

Merged
merged 1 commit into from
Jun 10, 2021

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Jun 7, 2021

SUMMARY

Improves the native filters UI/UX - iteration 7

  • Changes the column select to use the Ant Design one
  • Removes horizontal scroll when the column select is too wide
  • Creates the first tests for the FormConfigModal component
  • Fixes [native-filters]don't set min width in DEFAULT VALUE  #15000
  • Makes the fixed tabs take up the whole row in the modal
  • Fixes the pre-filter to consider the ad-hoc or time range when validating

This work is part of the Native dashboard filter project

The items below will be handled in the next iterations:

  • Unify the select components to use the AntD one. Currently, we have different selects with different themes and interactions.
  • Comments from @rusackas

The iterations below are optional but recommended:

Split the FiltersConfigForm into smaller components to make it easier to read and remove react warnings

@villebro @rusackas @junlincc

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

120873588-8e96b480-c557-11eb-9a8f-c60cf21f2915.mov
screen-recording-2021-06-07-at-100112-am_M1Srewlk.mov

TESTING INSTRUCTIONS

Check the before and after videos to see all the problems and fixes.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@michael-s-molina michael-s-molina force-pushed the revamp-native-filters-7 branch 2 times, most recently from a1abe9d to fbfdadd Compare June 7, 2021 14:00
@junlincc junlincc added the dashboard:native-filters Related to the native filters of the Dashboard label Jun 7, 2021
@junlincc
Copy link
Member

junlincc commented Jun 7, 2021

Thank you so much @michael-s-molina for the PR,
small comment, let let the fixed tabs take up the whole row in the modal
Screen Shot 2021-06-07 at 3 08 07 PM

@michael-s-molina
Copy link
Member Author

Thank you so much @michael-s-molina for the PR,
small comment, let let the fixed tabs take up the whole row in the modal
Screen Shot 2021-06-07 at 3 08 07 PM

@junlincc has eagle eyes!

@michael-s-molina
Copy link
Member Author

@junlincc @villebro

Latest changes added to the PR's description:

  • Makes the fixed tabs take up the whole row in the modal
  • Fixes the pre-filter to consider the ad-hoc or time range when validating

@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #15017 (6f46673) into master (0e07a5c) will increase coverage by 0.04%.
The diff coverage is 84.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15017      +/-   ##
==========================================
+ Coverage   77.64%   77.69%   +0.04%     
==========================================
  Files         966      966              
  Lines       49615    49634      +19     
  Branches     6311     6318       +7     
==========================================
+ Hits        38524    38563      +39     
+ Misses      10890    10870      -20     
  Partials      201      201              
Flag Coverage Δ
javascript 72.88% <84.21%> (+0.10%) ⬆️

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

Impacted Files Coverage Δ
...tersConfigModal/FiltersConfigForm/DefaultValue.tsx 25.00% <0.00%> (-1.32%) ⬇️
...d/src/filters/components/Time/TimeFilterPlugin.tsx 100.00% <ø> (ø)
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 71.58% <77.77%> (+1.54%) ⬆️
...tersConfigModal/FiltersConfigForm/ColumnSelect.tsx 97.14% <94.73%> (-0.08%) ⬇️
...nd/src/components/SupersetResourceSelect/index.tsx 70.96% <0.00%> (-12.91%) ⬇️
...mponents/nativeFilters/FiltersConfigModal/utils.ts 66.25% <0.00%> (-1.25%) ⬇️
...-frontend/src/explore/components/ControlHeader.jsx 85.71% <0.00%> (ø)
...ConfigModal/FiltersConfigForm/FilterScope/utils.ts 98.50% <0.00%> (+0.06%) ⬆️
...d/components/DashboardBuilder/DashboardBuilder.tsx 91.02% <0.00%> (+0.11%) ⬆️
... and 7 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 0e07a5c...6f46673. Read the comment docs.

@junlincc
Copy link
Member

junlincc commented Jun 8, 2021

/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true

@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2021

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

Copy link
Member

@junlincc junlincc left a comment

Choose a reason for hiding this comment

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

LGTM, Product sign-off Thank you for the PR!!

@@ -57,8 +53,25 @@ class MainPreset extends Preset {
}
}

fetchMock.get(`glob:*/api/v1/dataset/${datasourceId}`, {
result: [mockDatasource[fullDatasourceId]],
fetchMock.get(`glob:*/api/v1/dataset/1`, {
Copy link
Member

Choose a reason for hiding this comment

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

Curious why we need to move away from the mockDatasource - whether it's for simplicity, or if there's something that indicates an incompatibility between the mock data and the test itself.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right on the money... incompatibility and simplicity!

Copy link
Member

Choose a reason for hiding this comment

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

Followup question - do we need to update the mockDatasource in any way so that it's not incompatible? Just don't want to carry any tech debt forward.

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 can try to update in the next iteration and see if it raises other problems.

@@ -164,6 +164,8 @@ const StyledCollapse = styled(Collapse)`
const StyledTabs = styled(Tabs)`
.ant-tabs-nav {
position: sticky;
margin-left: ${({ theme }) => theme.gridUnit * -4}px;
Copy link
Member

Choose a reason for hiding this comment

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

I think there's a better way to fix this, rather than resorting to negative margins. We (I?) can address this in a follow-up if needed, but I believe we can do the following:

  • Remove these margin left/right styles here.
  • In FilterTabsContainer:
    • & > .ant-tabs-content-holder -> remove the padding-right
    • &.ant-tabs-left > .ant-tabs-content-holder > .ant-tabs-content > .ant-tabs-tabpane -> set the padding-left to 0 (or remove the line, but then a 24px padding comes into play from somewhere, not sure if we can kill that).
    • add a selector for .ant-tabs-content-holder with padding: 0 ${({ theme }) => theme.gridUnit * 4}px;

Then we'll have fewer styles that are not fighting each other.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the tip! I'll change it in the next iteration.

font-family: SimSun, sans-serif;
margin-right: ${({ theme }) => theme.gridUnit - 1}px;
font-size: ${({ theme }) => theme.typography.sizes.s}px;
margin-left: ${({ theme }) => theme.gridUnit - 1}px;
Copy link
Member

Choose a reason for hiding this comment

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

nit/question: not sure by looking exactly where this applies, but based on a hunch from the code, it might be a use case for an em rather than a gridUnit, or perhaps a transform: translateX(-100%); - just to tie the positioning of the asterisk to the content itself, rather than to the gridUnit, which could change.

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 agree. em will be better here. I'll change it in the next iteration.

@@ -458,6 +460,28 @@ const FiltersConfigForm = (
forceUpdate();
};

const validatePreFilter = () =>
setTimeout(
Copy link
Member

Choose a reason for hiding this comment

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

curious: why is the setTimeout needed?

Copy link
Member

@rusackas rusackas Jun 8, 2021

Choose a reason for hiding this comment

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

Ahhh, I see the // execute after render comment - that's fine I guess, but would a useEffect hook in the CollapsibleControl component be an option instead?

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 can investigate if this is possible in the next iteration.

],
table_name: 'birth_names',
fetchMock.get('glob:*/api/v1/dataset/1', {
description_columns: {},
Copy link
Member

Choose a reason for hiding this comment

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

This mock looks an awful lot like the one in Filterbar.test.tsx - should we recycle/export?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch. In the next iteration, I'll try to unify all mocks.

});

// eslint-disable-next-line jest/no-disabled-tests
test.skip('validates the default value', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Curious about the status any test that's both new AND skipped ;) Something to follow up on?

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 decided to skip it and tackle it in the next iteration because it's passing locally but failing on Github for no apparent reason.

changes the default value options when the column changes
switches to configuration tab when validation fails
displays cancel message when there are pending operations
do not displays cancel message when there are no pending operations
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
do not displays cancel message when there are no pending operations
does not display cancel message when there are no pending operations

obviously just a nit... really appreciate this TODO comment!

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

I found a few things that might be worth consideration, but I don't think anything should be blocking really, so I'll approve. I'll leave this open for a bit, as I'd love your thoughts on the comments.

@michael-s-molina
Copy link
Member Author

michael-s-molina commented Jun 10, 2021

I found a few things that might be worth consideration, but I don't think anything should be blocking really, so I'll approve. I'll leave this open for a bit, as I'd love your thoughts on the comments.

@rusackas Thanks for your review. All your points added much value. I'll tackle them all in the next iteration.

The items below will be handled in the next iterations:

Unify the select components to use the AntD one. Currently, we have different selects with different themes and interactions.
Comments from @rusackas

@villebro
Copy link
Member

Thank you so much @michael-s-molina for the PR,
small comment, let let the fixed tabs take up the whole row in the modal
Screen Shot 2021-06-07 at 3 08 07 PM

@junlincc has eagle eyes!

I agree! I can hardly find a carton of milk in the fridge, let alone spot stuff like this 😆

@villebro villebro merged commit 1468026 into apache:master Jun 10, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

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 dashboard:native-filters Related to the native filters of the Dashboard size/XL 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native-filters]don't set min width in DEFAULT VALUE
5 participants