-
Notifications
You must be signed in to change notification settings - Fork 643
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
[Organizations] Include reserved namespaces and package ownership requests in Manage Packages page filtering #5491
Conversation
@scottbommarito Per screenshots, looks like we show logo with org owners in the Owners column, but not the New Owner column. Is this easy to fix? |
@chenriksson nice catch! should be easy to do |
@chenriksson done! |
@scottbommarito I'm not sure we need a separate cancel owner request icon... UI is simpler without. Instead, could 'X' mean reject the request if the user is the receiver, but mean cancel the request if the user is the sender (or another admin)? Both essentially close the request, which is similar enough to the end user... IMHO. |
@chenriksson smart catch--we only need to show either the reject or the cancel icon, because the end result is the same for the user lol |
@chenriksson done as well! also updated screenshots |
var received = userReceived.Union(orgReceived); | ||
|
||
var sent = _packageService.FindPackagesByAnyMatchingOwner(currentUser, true, false) | ||
.SelectMany(p => _packageOwnerRequestService.GetPackageOwnershipRequests(package: p.PackageRegistration)); |
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.
For perf issue #5461, I'm trying to rework the query in FindPackagesByAnyMatchingOwner, which is currently really inefficient. This API fetches the latest version of each registration. Due to our concurrency issue with the IsLatest columns, it ends up fetching all package rows for all matching owners and sorting on NuGetVersion in the client (Gallery).
If possible, can you avoid adding this second call to FindPackagesByAnyMatchingOwner
? It's going to make #5461 twice as bad.
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.
good catch! I can reuse the results from when it's called earlier.
+ ' / ' | ||
+ downloadsCount.toLocaleString() | ||
+ ' download' + (downloadsCount == 1 ? '' : 's'); | ||
+ ' download' + (downloadsCount === 1 ? '' : 's'); |
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.
awesome - thanks!
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.
I was tired of those LINT errors haha
|
||
function formatReservedNamespacesData(namespacesCount) { | ||
return namespacesCount.toLocaleString() + " namespace" + (namespacesCount === 1 ? '' : 's'); | ||
} |
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.
I wonder if we can add a pluralize helper in common.js?
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.
I'm a little skeptical about adding something like this given that
1 - the code here is (less than) a one-liner
2 - the actual problem of pluralization is very complex (if someone supplies "octopus" they might expect it to be pluralized to "octopi")
I'm fine with adding a function just for this file because it is used 3 times but beyond that scope might be misleading.
} | ||
|
||
// Immediately load initial expander data | ||
showInitialPackagesData("#listed-data", initialData.ListedPackages); | ||
showInitialPackagesData("#unlisted-data", initialData.UnlistedPackages); | ||
showInitialReservedNamespaceData("#namespaces-data", initialData.ReservedNamespaces); | ||
showInitialOwnerRequestsData("#requests-received-data", initialData.RequestsReceived); | ||
showInitialOwnerRequestsData("#requests-sent-data", initialData.RequestsSent); |
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.
Looks great - I know this was a lot of work!
</text>, expanded: false) | ||
} | ||
</div> | ||
</div> |
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.
We could still consider moving sections into partials, like I did for Account/ManageOrganizations views. It might be nice to reduce the size of this file.
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.
Not sure how to best split this up...I could split the templates into their own partials but there's still gonna be a massive script section at the end.
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.
Feel free to leave as-is, and I can re-evaluate when I do my work for #5461
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.
LGTM!
<tbody data-bind="foreach: Requests"> | ||
<tr class="manage-package-listing" data-bind="visible: Visible"> | ||
<td class="align-middle hidden-xs"> | ||
<img class="package-icon img-responsive" aria-hidden="true" alt="" |
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.
accessibility requires alt for images, so I assume we should use non-empty here.
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.
alt
was empty for the package icon in the packages lists. Not sure what to put there but I'll figure it out.
<table class="table"> | ||
<thead> | ||
<tr class="manage-package-headings"> | ||
<th class="hidden-xs"></th> |
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.
Keros complained about empty header columns, so I put hidden spans with a text description. I wonder if we should do that here too.
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.
Fixed!
@@ -1301,6 +1301,8 @@ public virtual Task<ActionResult> RejectPendingOwnershipRequest(string id, strin | |||
|
|||
if (package.Owners.Any(o => o.MatchesUser(user))) | |||
{ | |||
// If the user is already an owner, clean up the invalid request. | |||
await _packageOwnershipManagementService.DeletePackageOwnershipRequestAsync(package, user); |
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.
Probably this should not throw.
#5310
Previously, only the listed packages and unlisted packages sections were included in the filtering. This change adds the reserved namespaces and package ownership requests sections to the filtering.
A couple notable changes are:
(the screenshots have the packages sections removed--no actual changes were made to these sections)
All packages:
Filtered by self:
Filtered by organization that self is collaborator of:
(doesn't show any requests because the current user can't do anything about them)
Filtered by organization that self is admin of: