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(new-trace): Sorting trace drawer card content by subject. #71122

Merged
merged 3 commits into from
May 21, 2024

Conversation

Abdkhan14
Copy link
Contributor

No description provided.

@Abdkhan14 Abdkhan14 requested a review from JonasBa May 17, 2024 16:58
@Abdkhan14 Abdkhan14 requested review from a team as code owners May 17, 2024 16:58
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 17, 2024
<TraceDrawerComponents.SectionCard
title={t('Emitted Metrics')}
items={items}
enableSorting
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
enableSorting
sortAlphabetically

Copy link
Member

@JonasBa JonasBa left a comment

Choose a reason for hiding this comment

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

I'm going to wait for others to review as we dont own this code. Besides the prop name change, the changes look fine to me

Comment on lines +117 to +119
.sort((a, b) => {
return a.subject.localeCompare(b.subject);
})
Copy link
Member

@leeandher leeandher May 17, 2024

Choose a reason for hiding this comment

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

This will alter the order for context on issues details page as well. I preserved that order because it was what was there before, but I don't see a reason why we can't change it. Alphabetically seems good to me 👍 -- more of an FYI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heyo @leeandher, it only changes the order of the items inside the card. The context ordering is one level above this, it won't change.

Copy link
Member

Choose a reason for hiding this comment

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

@Abdkhan14 .sort mutates the original array, so this might in fact change the order. It would be safer to create a copy of contextItems before sorting

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, either way that order was also intentional. It displays the known items for each context before any additional items the user added from their SDK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noted @leeandher, lets give sorting alphabetically a go.

Copy link
Contributor Author

@Abdkhan14 Abdkhan14 May 21, 2024

Choose a reason for hiding this comment

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

@Abdkhan14 .sort mutates the original array, so this might in fact change the order. It would be safer to create a copy of contextItems before sorting

@JonasBa, he mentioned the ordering of cards. We are sorting card > items.

Screenshot 2024-05-21 at 12 17 24 PM

Copy link
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

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

Code looks good, but are there any instances that don't get receive sortAlphabetically = true? If not, you can probably skip the prop and just apply the sort for all renders of SectionCard

@Abdkhan14
Copy link
Contributor Author

Code looks good, but are there any instances that don't get receive sortAlphabetically = true? If not, you can probably skip the prop and just apply the sort for all renders of SectionCard

Yeah we don't sort the general Info sections.

@Abdkhan14 Abdkhan14 merged commit 06707e1 into master May 21, 2024
41 checks passed
@Abdkhan14 Abdkhan14 deleted the abdk/trace-drawer-sorting branch May 21, 2024 16:47
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants