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

[Organizations] Include reserved namespaces and package ownership requests in Manage Packages page filtering #5491

Merged
merged 12 commits into from
Mar 1, 2018

Conversation

scottbommarito
Copy link
Contributor

@scottbommarito scottbommarito commented Feb 16, 2018

#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:

  • You can now cancel any package ownership request made for another user to be an owner of a package you own from this page. Previously you had to do it from the Manage Package Owners page.
  • The package owner requests table shows all of the package's owners instead of the user who sent the request like it used to. I could show both, but I came to the conclusion that the requestor is pretty irrelevant information.
  • If a user tries to accept or reject a package ownership request for a package they are already an owner of, the request is deleted because it's no longer valid.

(the screenshots have the packages sections removed--no actual changes were made to these sections)

All packages:

image

Filtered by self:

image

Filtered by organization that self is collaborator of:

(doesn't show any requests because the current user can't do anything about them)

image

Filtered by organization that self is admin of:

image

@scottbommarito scottbommarito changed the title [Organizations] Include reserved namespaces and package ownership requests in Manage Packages Page filtering [Organizations] Include reserved namespaces and package ownership requests in Manage Packages page filtering Feb 16, 2018
@chenriksson
Copy link
Member

@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?

@scottbommarito
Copy link
Contributor Author

@chenriksson nice catch! should be easy to do

@scottbommarito
Copy link
Contributor Author

@chenriksson done!

@chenriksson
Copy link
Member

@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.

@scottbommarito
Copy link
Contributor Author

@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

@scottbommarito
Copy link
Contributor Author

scottbommarito commented Feb 16, 2018

@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));
Copy link
Member

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.

Copy link
Contributor Author

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');
Copy link
Member

Choose a reason for hiding this comment

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

awesome - thanks!

Copy link
Contributor Author

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');
}
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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>
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Member

@chenriksson chenriksson left a 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=""
Copy link
Member

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.

Copy link
Contributor Author

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>
Copy link
Member

Choose a reason for hiding this comment

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

see: Accessibility PR #5426

Keros complained about empty header columns, so I put hidden spans with a text description. I wonder if we should do that here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@scottbommarito scottbommarito merged commit d8371bd into dev Mar 1, 2018
@scottbommarito scottbommarito deleted the sb-orgmanpack branch March 1, 2018 20:41
@@ -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);
Copy link
Contributor

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.

@scottbommarito scottbommarito restored the sb-orgmanpack branch July 22, 2019 23:19
@scottbommarito scottbommarito deleted the sb-orgmanpack branch July 22, 2019 23:21
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.

3 participants