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

Fix minor bugs in Deprecation UI found in bug bash #6994

Merged
merged 2 commits into from Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Bootstrap/dist/css/bootstrap-theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -27,7 +27,7 @@
border-top: 0px;

.dropdown-selector {
height: 300px;
max-height: 300px;
overflow: auto;

.dropdown-filter {
Expand Down
5 changes: 5 additions & 0 deletions src/NuGetGallery/Scripts/gallery/common.js
Expand Up @@ -231,6 +231,11 @@
}
}

var tabIndex = element.attr('tabindex');
if (!!tabIndex && tabIndex >= 0) {
return true;
}

return element.is("audio") && !!element.attr("controls") ||
element.is("img") && !!element.attr("usemap") ||
element.is("input") && element.attr("type") !== "hidden" ||
Expand Down
9 changes: 7 additions & 2 deletions src/NuGetGallery/Scripts/gallery/page-manage-deprecation.js
Expand Up @@ -234,7 +234,7 @@ function ManageDeprecationViewModel(id, versionDeprecationStateDictionary, defau
// Show a warning if multiple versions are selected and at least one has an existing deprecation
// The user should be aware they are replacing existing deprecations
// Don't show an alert if a single version is selected because it is clear that the deprecation is being replaced
warningMessage = "Some of the package versions you selected have already been deprecated. These versions will have their deprecation information overriden or removed based on your actions.";
warningMessage = "Some of the package versions you selected have already been deprecated. All selected versions will have their deprecation information overridden or removed when you submit this form.";
}
} else if (hasVersionsWithExistingDeprecationState) {
// Show a warning if no reasons are selected and at least one selected version has an existing deprecation
Expand Down Expand Up @@ -572,5 +572,10 @@ function ManageDeprecationViewModel(id, versionDeprecationStateDictionary, defau
// Load the state for the default version.
loadDeprecationFormState(defaultVersion);

ko.applyBindings(this, $(".page-manage-deprecation")[0]);
var section = $(".page-manage-deprecation")[0];
// Only apply bindings if the form exists.
// In certain situations (the package is locked, user doesn't have permissions, etc) we do not render the form.
if (section) {
ko.applyBindings(this, section);
}
}
13 changes: 12 additions & 1 deletion src/NuGetGallery/Views/Packages/Manage.cshtml
Expand Up @@ -5,6 +5,8 @@
ViewBag.MdPageColumns = GalleryConstants.ColumnsFormMd;
}

@Html.Partial("_MultiSelectDropdown")

<section role="main" class="container main-container">
@ViewHelpers.AjaxAntiForgeryToken(Html)
<div class="row">
Expand All @@ -16,6 +18,15 @@
"Manage",
linkIdOnly: true))

@if (Model.IsLocked)
{
@ViewHelpers.AlertDanger(
@<text>
Package '@Model.Id' has been locked. Please contact
<a href="mailto:support@nuget.org?subject=@HttpUtility.UrlPathEncode(string.Format("Requesting support for a locked package - '{0}'", Model.Id))">support@nuget.org</a>
</text>)
}

@ViewHelpers.Section(
this,
"Owners",
Expand Down Expand Up @@ -103,7 +114,7 @@
var state = versionListedState[version];
// Update the listed checkbox to match the state of the package.
var listed = state.Listed;
$(".page-delete-package input#Listed")[0].checked = listed;
$(".page-delete-package input#Listed").prop('checked', listed);
// Update the text stating the download count on the delete form.
var downloadCount = state.DownloadCount;
$(".page-delete-package #downloadCount").text(downloadCount);
Expand Down
Expand Up @@ -32,7 +32,7 @@
<div class="deprecation-container">
<div class="icon-text alert alert-warning">
<div id="show-deprecation-content-container" class="deprecation-expander" tabindex="0" data-toggle="collapse" data-target="#deprecation-content-container" aria-expanded="false" aria-controls="deprecation-content-container" aria-labelledby="deprecation-container-label">
<div class="deprecation-expander">
<div class="deprecation-expander" role="button">
<div class="deprecation-expander-container">
<i class="deprecation-expander-icon ms-Icon ms-Icon--Warning" aria-hidden="true"></i>

Expand Down Expand Up @@ -93,14 +93,12 @@
}

<b>Suggested Alternatives</b>
<p>
Consider using <a href="@alternateUrl">@alternateText</a> instead of this package.
</p>
<p><a href="@alternateUrl">@alternateText</a></p>
}

@if (!string.IsNullOrEmpty(Model.CustomMessage))
{
<b>Package owner message</b>
<b>Additional Details</b>
<p>@Model.CustomMessage</p>
}
</div>
Expand Down
19 changes: 9 additions & 10 deletions src/NuGetGallery/Views/Packages/_ManageDeprecation.cshtml
@@ -1,27 +1,26 @@
@model ManagePackageViewModel

<div class="page-manage-deprecation">
<span>Deprecating a package will warn all consumers of the package who use it in their projects.</span>

@if (!Model.VersionSelectList.Any())
{
@ViewHelpers.AlertInfo(
@<text>
<span>There are no versions that can be deprecated.</span>
</text>)
@ViewHelpers.AlertInfo(@<text>There are no versions that can be deprecated.</text>)
}
else if (!Model.CanDeprecate)
{
@ViewHelpers.AlertWarning(@<text>You do not have permission to deprecate this package.</text>)
@ViewHelpers.AlertDanger(@<text>You do not have permission to deprecate this package.</text>)
}
else if (Model.IsLocked)
{
@ViewHelpers.AlertDanger(@<text>Locked packages cannot be deprecated.</text>)
}
else
{
<span>Deprecating a package will warn all consumers of the package who use it in their projects.</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be attributed with AlertInfo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's meant to appear as plain text at the top of the section as a description. We could make it an AlertInfo but I'm not sure if it's necessary or if it would look better.

image


<div data-bind="template: { name: 'add-deprecation-template' }"></div>
}
</div>

@Html.Partial("_MultiSelectDropdown")

<script type="text/html" id="add-deprecation-template">
<div class="deprecation-section form-group">
<label id="dropdown-label" class="deprecation-section-header">Select version(s)</label>
Expand Down Expand Up @@ -150,7 +149,7 @@
<div class="security-detail-list-item alert-info">
<div class="security-detail-list-item-header">
<div>
<a data-bind="text: id, attr: { href: $parent.getUrlFromId(id) }, css: { 'security-detail-list-item-existing': fromAutocomplete, 'security-detail-list-item-missing': !fromAutocomplete }"></a>
<a data-bind="text: id, attr: { href: $parent.getUrlFromId(id) }, css: { 'security-detail-list-item-existing': fromAutocomplete, 'security-detail-list-item-missing': !fromAutocomplete }" target="_blank"></a>
<span data-bind="visible: name || !fromAutocomplete">
&nbsp;-&nbsp;
<span data-bind="visible: name, text: name"></span>
Expand Down
Expand Up @@ -30,8 +30,7 @@
@ViewHelpers.AlertDanger(
@<text>
<span>
Package '@Model.Id' has been locked. This means you cannot publish a new version or change the listing status of a published package version. Please contact
<a href="mailto:support@nuget.org?subject=@HttpUtility.UrlPathEncode(string.Format("Requesting support for a locked package - '{0}'", Model.Id))">support@nuget.org</a>.
You cannot update the documentation of a locked package.
</span>
</text>)
</div>
Expand Down
23 changes: 2 additions & 21 deletions src/NuGetGallery/Views/Packages/_ManageListing.cshtml
Expand Up @@ -10,35 +10,16 @@

@if (!Model.VersionSelectList.Any())
{
@ViewHelpers.AlertInfo(
@<text>
<span>There are no versions that can have their listing state changed.</span>
</text>)
@ViewHelpers.AlertInfo(@<text>There are no versions that can have their listing state changed.</text>)
}
else if (Model.IsLocked && !User.IsAdministrator())
{
<div class="validation-error-message-list">
@ViewHelpers.AlertDanger(
@<text>
<span>
Package '@Model.Id' has been locked. This means you cannot publish a new version or change the listing status of a published package version. Please contact
<a href="mailto:support@nuget.org?subject=@HttpUtility.UrlPathEncode(string.Format("Requesting support for a locked package - '{0}'", Model.Id))">support@nuget.org</a>.
</span>
</text>)
@ViewHelpers.AlertDanger(@<text>You cannot change the listing state of a locked package.</text>)
</div>
}
else
{
if (Model.IsLocked && User.IsAdministrator())
{
<div class="validation-error-message-list">
@ViewHelpers.AlertDanger(
@<text>
<span>Package '@Model.Id' has been locked.</span>
</text>)
</div>
}

<label for="input-select-version" id="package-version-label">Select version</label>

@Html.DropDownList("version-selection", Model.VersionSelectList,
Expand Down