-
Notifications
You must be signed in to change notification settings - Fork 14k
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
refactor: Convert TableElement.jsx component from class to functional with hooks #14830
refactor: Convert TableElement.jsx component from class to functional with hooks #14830
Conversation
Figured it would make sense to grab a ticket that is also making changes in this component. Please let me know if this should be in another PR or if there's a better way to handle it. Thanks! [sql lab]'copy' and 'collapse/expand' icons do not have tooltip in the table review panelSUMMARYFixed an issue where the tooltip for the copy/paste was not showing up and added a tooltip to the collapse/expand icon on the table element. Updated tests where necessary. BEFOREAFTERTESTING INSTRUCTIONS
ADDITIONAL INFORMATION
|
Heya, for the testing instructions, I think that adding how to visually test for it might be best. So something short and along the lines of ---> navigate to "x" then whatever would be good. So that someone who pulls your file, or if they create an ephemeral env could go and visually inspect it. |
@yousoph how do these tooltips look? |
Nice! Looking good to me, thanks @corbinrobb! |
…ng from antdesign directly
It was my pleasure! @yousoph I'm looking forward to helping more! |
@corbinrobb can you fix these issues to allow CI to pass
|
So I actually think popSelectStar is depreciated. Might be worth setting up a test env to check to make sure. |
@hughhhh I got the linter errors figured out and I pushed up the latest commit. I agree with @AAfghahi about popSelectStar. I removed it from the component since it was throwing the unused variable linter error. It appears it wasn't being used before I started the PR either but not throwing the linter because it was a method on a class. Thanks lemme know if I should/need to do anything else with this! |
Codecov Report
@@ Coverage Diff @@
## master #14830 +/- ##
==========================================
- Coverage 77.62% 77.61% -0.02%
==========================================
Files 962 965 +3
Lines 49078 49471 +393
Branches 6155 6259 +104
==========================================
+ Hits 38099 38399 +300
- Misses 10775 10872 +97
+ Partials 204 200 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@hughhhh Ephemeral environment spinning up at http://34.210.58.81:8080. Credentials are |
This is great @corbinrobb, thanks so much! I just left a few nits, and some of them are from earlier code that I thought I'd see if we could sneak in. :) |
No problem at all! @eschutho I like all the changes! Much more concise and readable. I will be pushing them up in just a moment. |
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.
Ephemeral environment shutdown and build artifacts deleted. |
* upstream/master: (68 commits) fix typos (apache#14950) docs: fix custom oauth config (apache#14997) fix: apply template_params on external_metadata (apache#14996) fix: toggle fullscreen on the dashboard (apache#14979) feat(native-filters): add markers and number formatter + simple tests (apache#14981) fix(native-filters): Fix "undefined" error after editing a filter (apache#14984) fix(native-filters): remove implied fetch predicate (apache#14982) fix(native-filters): update cascaded filter state on change (apache#14980) fix(filter box): replace freeform where clause with ilike (apache#14900) refactor: Convert TableElement.jsx component from class to functional with hooks (apache#14830) fix: renamed sqllab filters to _filters (apache#14971) feat(native-filters): apply cascading without instant filtering (apache#14966) chore: bump superset-ui to 0.17.53 (apache#14968) fix(native-filters): cascading filters not rendering in tab (apache#14964) feat: add type_generic and is_dttm to table metadata (apache#14863) additional safeguard (apache#14953) feat: Adding FORCE_SSL as feature flag in config.py (apache#14934) feat(dashboard/native-filters): Hide filters out of scope of current tab (apache#14933) fix: time parser truncate to first day of year/month (apache#14945) fix: is_temporal should overwrite is_dttm (apache#14894) ...
… with hooks (apache#14830) * Change TableElement from a class component to a functional component * Replace class state checks in TableElement_spec.jsx with checks testing elements they change * Refactor small bit of logic to use optional chaining * Add optional chaining to some logic * Fix IconTooltip and add IconTooltip to the collapse button * Fix custom icon using IconToolTip so it better matches the original * Update collapse/expand icon to use Icons component instead of importing from antdesign directly * Fix eslint errors * Clean up some code for readability Co-authored-by: Corbin Robb <corbin@Corbins-MacBook-Pro.local>
… with hooks (apache#14830) * Change TableElement from a class component to a functional component * Replace class state checks in TableElement_spec.jsx with checks testing elements they change * Refactor small bit of logic to use optional chaining * Add optional chaining to some logic * Fix IconTooltip and add IconTooltip to the collapse button * Fix custom icon using IconToolTip so it better matches the original * Update collapse/expand icon to use Icons component instead of importing from antdesign directly * Fix eslint errors * Clean up some code for readability Co-authored-by: Corbin Robb <corbin@Corbins-MacBook-Pro.local>
… with hooks (apache#14830) * Change TableElement from a class component to a functional component * Replace class state checks in TableElement_spec.jsx with checks testing elements they change * Refactor small bit of logic to use optional chaining * Add optional chaining to some logic * Fix IconTooltip and add IconTooltip to the collapse button * Fix custom icon using IconToolTip so it better matches the original * Update collapse/expand icon to use Icons component instead of importing from antdesign directly * Fix eslint errors * Clean up some code for readability Co-authored-by: Corbin Robb <corbin@Corbins-MacBook-Pro.local>
SUMMARY
Update the TableElement class component to be a functional component using hooks.
Modified the tests slightly where needed to check the changes to DOM from updating the state instead of checking the component state itself. Was necessary because functional components using hooks don't have an accessible state like class components.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
The component should look and function the same
TESTING INSTRUCTIONS
To run the tests for TableElement navigate to superset-frontend and run
npm run test -- spec/javascripts/sqllab/TableElement_spec.jsx
ADDITIONAL INFORMATION