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

refactor: Use Antd Dropdown instead of react-bootstrap in DatasourceControl #11395

Merged
merged 10 commits into from
Oct 23, 2020

Conversation

kgabryje
Copy link
Member

SUMMARY

Replaces react-bootstrap Dropdown with Antd Dropdown. Also, I replaced react-bootstrap Tooltip with Antd Tooltip, as it wasn't compatible with Antd Dropdown. This PR also fixes issues #11378 and #11094.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: see the screenshots in linked issues.

After:
image

TEST PLAN

ADDITIONAL INFORMATION

@codecov-io
Copy link

codecov-io commented Oct 22, 2020

Codecov Report

Merging #11395 into master will increase coverage by 0.70%.
The diff coverage is 78.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11395      +/-   ##
==========================================
+ Coverage   65.79%   66.49%   +0.70%     
==========================================
  Files         838      860      +22     
  Lines       39903    40871     +968     
  Branches     3662     3686      +24     
==========================================
+ Hits        26253    27177     +924     
- Misses      13549    13593      +44     
  Partials      101      101              
Flag Coverage Δ
#cypress 56.34% <93.75%> (+0.49%) ⬆️
#javascript 62.92% <47.82%> (+0.24%) ⬆️
#python 61.94% <ø> (+0.99%) ⬆️

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

Impacted Files Coverage Δ
...-frontend/src/common/components/common.stories.tsx 0.00% <0.00%> (ø)
.../explore/components/controls/DatasourceControl.jsx 75.80% <92.85%> (+2.72%) ⬆️
...uperset-frontend/src/common/components/Tooltip.tsx 100.00% <100.00%> (ø)
...et-frontend/src/dashboard/components/SaveModal.jsx 68.18% <0.00%> (-13.64%) ⬇️
...et-frontend/src/components/TableView/TableView.tsx 83.33% <0.00%> (-10.61%) ⬇️
superset/models/annotations.py 89.65% <0.00%> (-2.94%) ⬇️
superset-frontend/src/common/components/Tabs.tsx 95.83% <0.00%> (-0.17%) ⬇️
...src/explore/components/controls/VizTypeControl.jsx 92.15% <0.00%> (-0.16%) ⬇️
superset/views/core.py 74.47% <0.00%> (ø)
superset/charts/schemas.py 100.00% <0.00%> (ø)
... and 48 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 5a3d23d...009bd79. Read the comment docs.

@kgabryje
Copy link
Member Author

@rusackas @ktmud Can you take a look?

Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! This looks good. Just a couple of nits and the CI still seems to be failing.

@@ -125,6 +117,15 @@ class DatasourceControl extends React.PureComponent {
}));
}

handleMenuItemClick({ key }) {
if (key === '1') {
Copy link
Member

Choose a reason for hiding this comment

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

Since we are already here, can you make these keys more human readable and maybe use constants?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

<Dropdown
overlay={datasourceMenu}
trigger={['click']}
id="datasource_menu"
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can get rid of id since you added data-test?

Copy link
Member

Choose a reason for hiding this comment

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

Actually there are some styles for that, in DatasourceControl.less. @kgabryje would you mind seeing if those styles are still necessary/relevant? If they are, this may be the right opportunity to bring them into the component with Emotion Theme variables wired in. One less LESS file!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, 1 less file less 🙂

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.

Marking as changes requested, in hopes of addressing some feedback on the thread.

Namely, whether or not the ID that @ktmud noticed (thanks!) is needed, and if the LESS styles the ID brings in can be either removed or brought in via Emotion.

@kgabryje
Copy link
Member Author

@ktmud @rusackas Suggestions applied, CI is green 🙂

@mistercrunch mistercrunch merged commit ad88a06 into apache:master Oct 23, 2020
@ktmud
Copy link
Member

ktmud commented Oct 24, 2020

image

@kgabryje So it seems "Explore SQL Lab" has a hover underline, but the other two menu item doesn't. Not really a big deal, but still kind of bothers me. Could you take a look?

@kgabryje
Copy link
Member Author

@ktmud Ah right, "Explore" is underlined because it's an anchor. I'll fix it

auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
…ontrol (apache#11395)

* Create Tooltip component

* Refactor DatasourceControl

* Bug fix

* Lint fix

* E2E test fix

* Move menu item keys to constants

* Remove LESS file

* Test fix

* Test fix

* Lint fix
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.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 size/L 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants