Skip to content

Commit

Permalink
Merge pull request #8047 from NuGet/dev
Browse files Browse the repository at this point in the history
[ReleasePrep][2020.06.15]RI of dev into master
  • Loading branch information
loic-sharma authored Jun 16, 2020
2 parents eb15a10 + 5019705 commit 64d210f
Show file tree
Hide file tree
Showing 14 changed files with 411 additions and 40 deletions.
14 changes: 6 additions & 8 deletions src/Bootstrap/dist/css/bootstrap-theme.css

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

7 changes: 7 additions & 0 deletions src/Bootstrap/less/theme/page-display-package.less
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@
font-weight: 400;
}
}

.reserved-indicator {
width: 14px;
margin-bottom: 3px;
margin-left: 2px;
vertical-align: middle;
}
}

.used-by-adjust-table-head {
Expand Down
4 changes: 1 addition & 3 deletions src/NuGetGallery.Services/Models/PackageDependent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ public class PackageDependent
public string Id { get; set; }
public int DownloadCount { get; set; }
public string Description { get; set; }

// TODO Add verify checkmark
// https://github.com/NuGet/NuGetGallery/issues/4718
public bool IsVerified { get; set; }
}
}

4 changes: 2 additions & 2 deletions src/NuGetGallery.Services/PackageManagement/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ private IReadOnlyCollection<PackageDependent> GetListOfDependents(string id)
join p in _entitiesContext.Packages on pd.PackageKey equals p.Key
join pr in _entitiesContext.PackageRegistrations on p.PackageRegistrationKey equals pr.Key
where p.IsLatestSemVer2 && pd.Id == id
group 1 by new { pr.Id, pr.DownloadCount, p.Description } into ng
group 1 by new { pr.Id, pr.DownloadCount, pr.IsVerified, p.Description } into ng
orderby ng.Key.DownloadCount descending
select new PackageDependent { Id = ng.Key.Id, DownloadCount = ng.Key.DownloadCount, Description = ng.Key.Description }
select new PackageDependent { Id = ng.Key.Id, DownloadCount = ng.Key.DownloadCount, IsVerified = ng.Key.IsVerified, Description = ng.Key.Description }
).Take(packagesDisplayed).ToList();

return listPackages;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace NuGetGallery.Migrations
{
using System.Data.Entity.Migrations;

public partial class AddIndexToPackageDependencies : DbMigration
{
public override void Up()
{
// "WITH (ONLINE = ON)" is not supported on all editions of SQL Server. We want to create the index in the background
// when we are deploying to our live environment on Azure (which supports online index creation).
// Editions: https://docs.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql?view=sql-server-ver15#arguments
// We used sp_executesql because it is blocked on SQL that does not support "WITH (ONLINE = ON)".
Sql(@"IF SERVERPROPERTY ('edition') = 'SQL Azure'
BEGIN
EXECUTE sp_executesql N'CREATE NONCLUSTERED INDEX [IX_PackageDependencies_Id] ON [dbo].[PackageDependencies] ([Id])
INCLUDE ([PackageKey])
WITH (ONLINE = ON)'
END
ELSE
BEGIN
CREATE NONCLUSTERED INDEX [IX_PackageDependencies_Id] ON [dbo].[PackageDependencies] ([Id])
INCLUDE ([PackageKey])
END");
}

public override void Down()
{
DropIndex(table: "PackageDependencies", name: "IX_PackageDependencies_Id");
}
}
}

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/NuGetGallery/NuGetGallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@
<Compile Include="Migrations\202004030548285_AddPackageRename.designer.cs">
<DependentUpon>202004030548285_AddPackageRename.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202006011927336_AddIndexToPackageDependencies.cs" />
<Compile Include="Migrations\202006011927336_AddIndexToPackageDependencies.designer.cs">
<DependentUpon>202006011927336_AddIndexToPackageDependencies.cs</DependentUpon>
</Compile>
<Compile Include="Services\ConfigurationIconFileProvider.cs" />
<Compile Include="Services\IconUrlDeprecationValidationMessage.cs" />
<Compile Include="Services\GravatarProxyResult.cs" />
Expand Down Expand Up @@ -1337,6 +1341,7 @@
<Content Include="Content\gallery\img\orange-circle.svg" />
<Content Include="Content\gallery\img\purple-circle-225x225.png" />
<Content Include="Content\gallery\img\purple-circle.svg" />
<Content Include="Content\gallery\img\reserved-indicator-14x14.png" />
<Content Include="Content\gallery\img\reserved-indicator-20x20.png" />
<Content Include="Content\gallery\img\reserved-indicator-256x256.png" />
<Content Include="Content\gallery\img\reserved-indicator-25x25.png" />
Expand Down Expand Up @@ -1614,6 +1619,9 @@
<EmbeddedResource Include="Migrations\202004030548285_AddPackageRename.resx">
<DependentUpon>202004030548285_AddPackageRename.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202006011927336_AddIndexToPackageDependencies.resx">
<DependentUpon>202006011927336_AddIndexToPackageDependencies.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="OData\QueryAllowed\Data\apiv1packages.json" />
<EmbeddedResource Include="OData\QueryAllowed\Data\apiv1search.json" />
<EmbeddedResource Include="OData\QueryAllowed\Data\apiv2getupdates.json" />
Expand Down
18 changes: 14 additions & 4 deletions src/NuGetGallery/Scripts/gallery/page-api-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

this.PackageOwners = packageOwners;
this.packageViewModels = [];

// Generic API key properties.
this._SetPackageSelection = function (packages) {
$.each(self.packageViewModels, function (i, m) {
Expand Down Expand Up @@ -107,10 +107,12 @@
}

this.PackageOwner(existingOwner);
} else {

} else if (this.PackageOwners.length == 1) {
this.PackageOwner(this.PackageOwners[0]);
}
}
};

this.Key = ko.observable(0);
this.Type = ko.observable();
this.Value = ko.observable();
Expand All @@ -123,7 +125,7 @@
this.Scopes = ko.observableArray();
this.Packages = ko.observableArray();
this.GlobPattern = ko.observable();

// Properties used for the form
this.PendingDescription = ko.observable();

Expand All @@ -133,6 +135,10 @@
return self.PackageOwner() && self.PackageOwner().Owner;
}, this);
this.PackageOwner.subscribe(function (newOwner) {
if (newOwner == null) {
return;
}

// When the package owner scope is changed, update the selected action scopes to those that are allowed on behalf of the new package owner.
var isPushNewSelected = function () {
return self.PushScope() === initialData.PackagePushScope;
Expand Down Expand Up @@ -328,6 +334,10 @@
this.PackageOwner.subscribe(function (newValue) {
// Initialize each package ID as a view model. This view model is used to track manual checkbox checks
// and whether the glob pattern matches the ID.
if (newValue == null) {
return;
}

var packageIdToViewModel = {};
self.packageViewModels = [];
$.each(newValue.PackageIds, function (i, packageId) {
Expand Down
7 changes: 7 additions & 0 deletions src/NuGetGallery/Views/Packages/DisplayPackage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,13 @@
<a class="text-left ngp-link" href="@Url.Package(item.Id)">
@(item.Id)
</a>
@if (item.IsVerified)
{
<img class="reserved-indicator"
src="~/Content/gallery/img/reserved-indicator.svg"
@ViewHelpers.ImageFallback(Url.Absolute("~/Content/gallery/img/reserved-indicator-14x14.png"))
title="@Strings.ReservedNamespace_ReservedIndicatorTooltip" />
}
<div class="row used-by-desc">
<span>@(item.Description)</span>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/NuGetGallery/Views/Users/ApiKeys.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,19 @@
}
</div>

<div class="row" style="@(Model.PackageOwners.Count == 1 ? "display:none" : "")">
<div class="row">
<div class="col-sm-7 form-group">
<label data-bind="attr: { for: PackageOwnerId,
id: PackageOwnerId() + '-label' }">Package Owner</label>
<select class="form-control"
data-bind="attr: { id: PackageOwnerId,
<select class="form-control"
data-bind="attr: { id: PackageOwnerId,
name: PackageOwnerId,
'aria-labelledby': PackageOwnerId() + '-label' },
options: PackageOwners, value: PackageOwner, optionsText: 'Owner'"></select>
options: PackageOwners, value: PackageOwner, optionsText: 'Owner', optionsCaption: 'Select an owner...' "></select>
<div class="has-error">
<span class="field-validation-valid help-block"
data-bind="text: PackageOwner() ? '' : 'A package owner must be selected.'" aria-live="polite" role="alert"></span>
</div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
Loading

0 comments on commit 64d210f

Please sign in to comment.