Skip to content

Show Package Owner profile links on Browse Tab#5766

Merged
donnie-msft merged 1 commit intodevfrom
dev-donnie-msft-ownerAuthorPmui
Apr 29, 2024
Merged

Show Package Owner profile links on Browse Tab#5766
donnie-msft merged 1 commit intodevfrom
dev-donnie-msft-ownerAuthorPmui

Conversation

@donnie-msft
Copy link
Copy Markdown
Contributor

@donnie-msft donnie-msft commented Apr 26, 2024

Bug

Fixes: NuGet/Home#12501
Spec: https://github.com/NuGet/Home/blob/dev/accepted/2023/owner-author-pmui.md

Regression? Last working version:

Description

Key points

  • On the Browse Tab, when a single package source is selected and it provides a resource, OwnerDetailsUriTemplateResourceV3, hyperlinks will be shown for each package owner in the PM UI Packages List. This is referred to as Supporting Known Owners.

  • The owner profile URLs are built from the template from that source and the link's ToolTip shows the full URL.

  • No telemetry is added in this PR.
    Screenshot of single package source Supporting Known Owners:
    image

  • Authors will never be shown in the packages list when the source Supports Known Owners.

  • In all other scenarios, Author will continue to be shown when Known Owners is not supported.
    Screenshot of single package source which does not Support Known Owners:
    image

Commentary

  • I'm introducing new ViewModels here, but no software design pattern or architectural improvements/refactoring is being done to existing Views or ViewModels in this PR. I'm happy to contribute to that type of refactoring work in a separate effort.
  • A new type, IOwnerDetailsUriService, provides an indicator for support for known owners, and a means to obtain an Owner Profile URL.
    • Currently, only a MultiSourcePackageMetadataProvider implements and provides this service:
      • A single package source is required to Support Known Owners.
      • No metadata merging decisions are being made in this PR.
  • PackageSearchMetadataContextInfo is the coming together of two things: Search results and package metadata. Owners belong to Search, therefore this context is where I'm materializing KnownOwner models.
  • Package Item ToolTips:
    • Still show "by author" when there's no Supported Known Owners.
    • Show "by owner" when there are Supported Known Owners.
      • I'm using the String here rather than calculating it from the KnownOwnerViewModels, as they should match. I kept this pattern here as I'd like to eventually refactor this class and use a more MVVM approach for the AuthorAndDownloadCount's view model.
  • Hyperlink events are handled by the ExecuteOpenExternalLink event similar to the Details Pane event. Telemetry can be added for owner profile links by simply providing a new property which this event will emit.
  • KnownOwnerViewModel represents known owners within Visual Studio UIs.
  • LastItemToVisibilityConverter allows for adding commas after each hyperlink, except the last one.

Accessibility

  • I did not test Psuedo-localization (PLOC) since the reflow design of the packages list is already handled - that is, it's truncated if it exceeds the width of the packages list.
  • Keyboard navigation visits each hyperlink
  • Screen-readers announce each hyperlink as "Hyperlink ", similar to other hyperlinks.
  • Follow-up: Add explanatory text into the ToolTip or explain that these profile URLs are owners from a particular source. Known Owner URL ToolTips don't mention the originating Package Source Home#13414
  • Accessibility Insights identified 1 bug which is a known WPF bug. I filed this to track it for when it's found by the test team: https://github.com/NuGet/Client.Engineering/issues/2801

PR Checklist

@donnie-msft donnie-msft requested a review from a team as a code owner April 26, 2024 00:12
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-ownerAuthorPmui branch from 3139c76 to a4fd5f2 Compare April 26, 2024 00:18
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-ownerAuthorPmui branch 2 times, most recently from aab2eba to c9f0c79 Compare April 27, 2024 18:16
@donnie-msft donnie-msft force-pushed the dev-donnie-msft-ownerAuthorPmui branch from c9f0c79 to 342535f Compare April 27, 2024 20:18
@donnie-msft donnie-msft merged commit 4020570 into dev Apr 29, 2024
@donnie-msft donnie-msft deleted the dev-donnie-msft-ownerAuthorPmui branch April 29, 2024 21:39
_link = knownOwner.Link;
}

public string Name => _name;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

public string Name {get;} is syntactic sugar over having a private and public field.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True, I created a field at some point during development, but it's not really necessary, I'll revise that.

public DateTimeOffset? Published { get; internal set; }
public IReadOnlyList<string>? OwnersList { get; internal set; }
public string? Owners { get; internal set; }
public IReadOnlyList<KnownOwner>? KnownOwners
Copy link
Copy Markdown
Member

@nkolev92 nkolev92 Apr 29, 2024

Choose a reason for hiding this comment

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

This class is going from a model DTO (post discussion), to something that has action logic in addition to being a model.

i don't have a clear recommendation, but something that stood out.

Copy link
Copy Markdown
Contributor Author

@donnie-msft donnie-msft Apr 29, 2024

Choose a reason for hiding this comment

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

Talked offline. This is kind of a DTO versus Model, so I'll move the calculation logic down into SearchObject.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swap authors for owners in Visual Studio Package Manager UI

3 participants