-
Notifications
You must be signed in to change notification settings - Fork 644
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
[Rename] Display rename information on package detail page #7964
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
$(function () { | ||
'use strict'; | ||
|
||
// Configure the rename information container | ||
var container = $('#show-rename-content-container'); | ||
window.nuget.configureExpander("rename-content-container", "ChevronDown", null, "ChevronUp"); | ||
container.keydown(function (event) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be DRY with the deprecation below. Shared function, loop, whatever. |
||
if (event.which === 13) { // Enter | ||
$(event.target).click(); | ||
} | ||
}); | ||
|
||
// Configure the deprecation information container | ||
var container = $('#show-deprecation-content-container'); | ||
if ($('#deprecation-content-container').children().length) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.Collections.Generic; | ||
using NuGet.Services.Entities; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public interface IPackageRenameService | ||
{ | ||
IReadOnlyList<PackageRename> GetPackageRenames(PackageRegistration package); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Linq; | ||
using System.Data.Entity; | ||
using System.Collections.Generic; | ||
using NuGet.Services.Entities; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public class PackageRenameService : IPackageRenameService | ||
{ | ||
private readonly IEntityRepository<PackageRename> _packageRenameRepository; | ||
|
||
public PackageRenameService ( | ||
IEntityRepository<PackageRename> packageRenameRepository) | ||
{ | ||
_packageRenameRepository = packageRenameRepository ?? throw new ArgumentNullException(nameof(packageRenameRepository)); | ||
} | ||
|
||
public IReadOnlyList<PackageRename> GetPackageRenames(PackageRegistration packageRegistration) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this new query significantly impact the display package page performance? |
||
return _packageRenameRepository.GetAll() | ||
.Where(pr => pr.FromPackageRegistrationKey == packageRegistration.Key) | ||
.Include(pr => pr.ToPackageRegistration) | ||
.ToList(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@model DisplayPackageViewModel | ||
|
||
<div class="deprecation-container"> | ||
<div class="icon-text alert alert-info"> | ||
<div id="show-rename-content-container" class="deprecation-expander" tabindex="0" data-toggle="collapse" data-target="#rename-content-container" aria-expanded="false" aria-controls="rename-content-container" aria-labelledby="rename-container-label" role="button"> | ||
<div class="deprecation-expander" role="button"> | ||
<div class="deprecation-expander-container"> | ||
<i class="deprecation-expander-icon ms-Icon ms-Icon--Info" aria-hidden="true"></i> | ||
|
||
<div id="rename-container-label" class="deprecation-expander-info-right"> | ||
@{ | ||
if (Model.PackageRenames.Count == 1) | ||
{ | ||
@:This package has been renamed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Period at the end of sentence. |
||
} | ||
else | ||
{ | ||
@:This package has been renamed or split into new packages | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Period at the end of sentence. |
||
} | ||
} | ||
</div> | ||
</div> | ||
|
||
<div class="deprecation-expander-container"> | ||
<i class="deprecation-expander-icon deprecation-expander-info-right ms-Icon ms-Icon--ChevronDown" aria-hidden="true"></i> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="deprecation-content-container collapse" id="rename-content-container"> | ||
<ul class="list-unstyled"> | ||
@foreach (var packageRename in Model.PackageRenames) | ||
{ | ||
var renamePackageName = packageRename.ToPackageRegistration.Id; | ||
var renamePackageUrl = Url.Package(renamePackageName); | ||
<li><a href="@renamePackageUrl">@renamePackageName</a></li> | ||
} | ||
</ul> | ||
<p></p> | ||
|
||
@if (!string.IsNullOrEmpty(Model.RenamedMessage)) | ||
{ | ||
<b>Additional Details</b> | ||
<p>@Html.PreFormattedText(Model.RenamedMessage, Config)</p> | ||
} | ||
</div> | ||
</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.
This should be behind the flag as well, so we can turn if off if perf is an issue.