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

Remove deprecated usages from antd DropDown, Tooltip, and Tab components #1859

Merged
merged 7 commits into from
Oct 11, 2023

Conversation

anshgoyalevil
Copy link
Member

@anshgoyalevil anshgoyalevil commented Oct 10, 2023

Which problem is this PR solving?

Description of the changes

  • This PR removes the deprecated usages from ant-design DropDown, Tooltip, and Tab components
  • The tab now needs an item array. Same with DropDown.
  • The visible is changed to open without any change in the internal working.

How was this change tested?

  • manually, and unit tests

What next?

  • There are still a few components left with deprecated usages. Those will covered in the upcoming PRs, to keep the code changes per PR small.

Checklist

Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
...jaeger-ui/src/components/DependencyGraph/index.jsx 100.00% <100.00%> (ø)
...nents/TracePage/TracePageHeader/AltViewOptions.tsx 100.00% <100.00%> (ø)
.../jaeger-ui/src/components/common/ExternalLinks.tsx 90.00% <100.00%> (ø)
...s/jaeger-ui/src/components/common/NameSelector.tsx 90.00% <ø> (ø)

📢 Thoughts on this report? Let us know!.

const dropdownItems = [
...MENU_ITEMS.filter(item => item.viewType !== viewType).map(item => ({
label: (
<a onClick={() => handleSelectView(item.viewType)} role="button">
Copy link
Member

Choose a reason for hiding this comment

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

so how does this work now? A menu item is a rectangle that should be all clickable, but a link is only clickable where its text is.

Copy link
Member Author

@anshgoyalevil anshgoyalevil Oct 10, 2023

Choose a reason for hiding this comment

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

Yes actually. Previously it needed a Menu wrapper for the dropdown overlay, but since v4.24.0 it no longer needs that.
That doesn't mean there is a change in functionality. The items are still clickable all along that rectangle.

Here's a link to the official ant-design documentation which compares both of these usages: Link

}));

return [{ label: <Menu items={menuItems} />, key: 'external-links' }];
};

export default function ExternalLinks(props: ExternalLinksProps) {
Copy link
Member

Choose a reason for hiding this comment

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

could you please add a comment explaining how this function is used. I can't get it from the context - are these in the top nav or elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I too couldn't find the actual usage of this component at the front-end UI. Let me try again

Copy link
Member Author

@anshgoyalevil anshgoyalevil Oct 10, 2023

Choose a reason for hiding this comment

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

After putting some dummy data, here's what it now looks like, and used to look like before:

Now:
https://github.com/jaegertracing/jaeger-ui/assets/94157520/7f0d84bc-c2fb-488c-9e50-1ec9484ea1e6

Before:
https://github.com/jaegertracing/jaeger-ui/assets/94157520/2395ad60-85b5-4195-9a90-617413a229d9

Seems like a bit of styling has now changed because the dropdown no longer needs Menu wrapper. Making changes really quick.

Copy link
Member Author

Choose a reason for hiding this comment

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

What it looks like in latest commit:

tdqx02me.mp4

export const linkValueList = (links: Link[]) => {
const menuItems: MenuProps['items'] = links.map(({ text, url }, index) => ({
label: <LinkValue href={url}>{text}</LinkValue>,
key: `${url}-${index}`,
Copy link
Member

Choose a reason for hiding this comment

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

I am curious - is there any global uniqueness requirement for these keys in the overall page? If not, why not just use something simpler for a key, like item-${index}?

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'm not sure about the global uniqueness, but afaik, the scope of uniqueness is limited to the current page that we are at. ${url}-${index} was used previously too, maybe due to any purpose.

Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Ansh Goyal <anshgoyal1704@gmail.com>
@yurishkuro yurishkuro merged commit 0111d17 into jaegertracing:main Oct 11, 2023
9 checks passed
@anshgoyalevil anshgoyalevil deleted the 5antd branch October 11, 2023 05:27
@yurishkuro yurishkuro added the changelog:bugfix-or-minor-feature 🐞 Bug fixes, Minor Improvements label Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:bugfix-or-minor-feature 🐞 Bug fixes, Minor Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants