Permalink
Browse files

Merge pull request #4609 from NuGet/dev

[ReleasePrep][2017.09.01] RI of dev into master
  • Loading branch information...
2 parents e72e08a + f554558 commit 9eb4bc49f7f34339b0fc4a6183f9265509961cdd @agr agr committed on GitHub Sep 5, 2017
Showing with 2,453 additions and 344 deletions.
  1. +20 −8 src/Bootstrap/dist/css/bootstrap-theme.css
  2. +5 −0 src/Bootstrap/less/theme/base.less
  3. +9 −4 src/Bootstrap/less/theme/common-list-packages.less
  4. +19 −20 src/Bootstrap/less/theme/common-user-package-list.less
  5. +12 −10 src/Bootstrap/less/theme/page-display-package.less
  6. +1 −2 src/Bootstrap/less/theme/page-list-packages.less
  7. +6 −2 src/NuGetGallery.Core/Auditing/CloudAuditingService.cs
  8. +18 −0 src/NuGetGallery.Core/Entities/EntitiesContext.cs
  9. +1 −0 src/NuGetGallery.Core/Entities/IEntitiesContext.cs
  10. +6 −0 src/NuGetGallery.Core/Entities/PackageRegistration.cs
  11. +39 −0 src/NuGetGallery.Core/Entities/ReservedNamespace.cs
  12. +23 −0 src/NuGetGallery.Core/Entities/SuspendDbExecutionStrategy.cs
  13. +4 −0 src/NuGetGallery.Core/Entities/User.cs
  14. +16 −0 src/NuGetGallery.Core/ICloudStorageStatusDependency.cs
  15. +3 −0 src/NuGetGallery.Core/NuGetGallery.Core.csproj
  16. +92 −69 src/NuGetGallery/App_Start/DefaultDependenciesModule.cs
  17. +95 −0 src/NuGetGallery/App_Start/StorageDependent.cs
  18. +9 −7 src/NuGetGallery/Authentication/AuthenticationService.cs
  19. +31 −0 src/NuGetGallery/Authentication/PasswordResetResult.cs
  20. +21 −7 src/NuGetGallery/Configuration/AppConfiguration.cs
  21. +32 −7 src/NuGetGallery/Configuration/IAppConfiguration.cs
  22. +20 −8 src/NuGetGallery/Content/gallery/css/bootstrap-theme.css
  23. BIN src/NuGetGallery/Content/gallery/img/reserved-indicator-20x20.png
  24. BIN src/NuGetGallery/Content/gallery/img/reserved-indicator-25x25.png
  25. +7 −0 src/NuGetGallery/Content/gallery/img/reserved-indicator.svg
  26. +2 −2 src/NuGetGallery/Controllers/StatisticsController.cs
  27. +12 −5 src/NuGetGallery/Controllers/UsersController.cs
  28. +1 −0 src/NuGetGallery/Infrastructure/Lucene/ExternalSearchService.cs
  29. +2 −0 src/NuGetGallery/Infrastructure/Lucene/LuceneSearchService.cs
  30. +1 −0 src/NuGetGallery/Infrastructure/PackageIndexEntity.cs
  31. +29 −0 src/NuGetGallery/Migrations/201708241907124_PrefixReservation.Designer.cs
  32. +66 −0 src/NuGetGallery/Migrations/201708241907124_PrefixReservation.cs
  33. +126 −0 src/NuGetGallery/Migrations/201708241907124_PrefixReservation.resx
  34. +13 −0 src/NuGetGallery/NuGetGallery.csproj
  35. +4 −2 src/NuGetGallery/Scripts/gallery/page-display-package.js
  36. +4 −2 src/NuGetGallery/Scripts/gallery/stats-dimensions.js
  37. +1 −1 src/NuGetGallery/Services/CloudBlobFileStorageService.cs
  38. +23 −14 src/NuGetGallery/Services/CloudReportService.cs
  39. +2 −0 src/NuGetGallery/Services/IPackageService.cs
  40. +75 −0 src/NuGetGallery/Services/IReservedNamespaceService.cs
  41. +2 −4 src/NuGetGallery/Services/PackageDeleteService.cs
  42. +15 −0 src/NuGetGallery/Services/PackageService.cs
  43. +263 −0 src/NuGetGallery/Services/ReservedNamespaceService.cs
  44. +7 −4 src/NuGetGallery/Services/StatusService.cs
  45. +84 −3 src/NuGetGallery/Strings.Designer.cs
  46. +29 −2 src/NuGetGallery/Strings.resx
  47. +2 −0 src/NuGetGallery/ViewModels/ListPackageItemViewModel.cs
  48. +31 −0 src/NuGetGallery/ViewModels/PackageManagerViewModel.cs
  49. +2 −2 src/NuGetGallery/ViewModels/StatisticsPackagesReport.cs
  50. +3 −3 src/NuGetGallery/ViewModels/StatisticsPivot.cs
  51. +18 −0 src/NuGetGallery/ViewModels/ThirdPartyPackageManagerViewModel.cs
  52. +4 −0 src/NuGetGallery/Views/Packages/Delete.cshtml
  53. +98 −27 src/NuGetGallery/Views/Packages/DisplayPackage.cshtml
  54. +1 −0 src/NuGetGallery/Views/Pages/Home.cshtml
  55. +8 −0 src/NuGetGallery/Views/Shared/_ListPackage.cshtml
  56. +2 −1 src/NuGetGallery/Views/Shared/_SearchBar.cshtml
  57. +5 −0 src/NuGetGallery/Views/Statistics/_PivotTable.cshtml
  58. +17 −5 src/NuGetGallery/Web.config
  59. +114 −0 tests/NuGetGallery.Facts/App_Start/StorageDependentFacts.cs
  60. +25 −13 tests/NuGetGallery.Facts/Authentication/AuthenticationServiceFacts.cs
  61. +3 −3 tests/NuGetGallery.Facts/Controllers/StatisticsControllerFacts.cs
  62. +75 −6 tests/NuGetGallery.Facts/Controllers/UsersControllerFacts.cs
  63. +29 −12 tests/NuGetGallery.Facts/Infrastructure/LuceneSearchServiceFacts.cs
  64. +3 −0 tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj
  65. +9 −46 tests/NuGetGallery.Facts/Services/ReflowPackageServiceFacts.cs
  66. +569 −0 tests/NuGetGallery.Facts/Services/ReservedNamespaceServiceFacts.cs
  67. +1 −43 tests/NuGetGallery.Facts/Services/UserServiceFacts.cs
  68. +12 −0 tests/NuGetGallery.Facts/TestUtils/FakeEntitiesContext.cs
  69. +172 −0 tests/NuGetGallery.Facts/TestUtils/TestServiceUtility.cs
@@ -252,6 +252,10 @@ img.package-icon {
.checkbox .label-sibling {
margin-left: 20px;
}
+.break-word {
+ word-break: break-all;
+ word-break: break-word;
+}
#edit-metadata-form-container .loading:after {
display: inline-block;
/* ascii code for the ellipsis character */
@@ -328,6 +332,12 @@ img.package-icon {
word-break: break-all;
word-break: break-word;
}
+.list-packages .package .package-header .reserved-indicator {
+ width: 20px;
+ margin-top: 3px;
+ margin-left: 3px;
+ vertical-align: top;
+}
.list-packages .package .package-header .package-by {
margin-left: 10px;
color: #000;
@@ -584,12 +594,17 @@ img.package-icon {
}
.page-package-details .package-title {
margin-bottom: 24px;
- word-break: break-all;
- word-break: break-word;
}
.page-package-details .package-title div {
margin-top: 2px;
}
+.page-package-details .package-title .reserved-indicator {
+ width: 25px;
+}
+.page-package-details .package-details-main {
+ word-break: break-all;
+ word-break: break-word;
+}
.page-package-details .package-details-info .ms-Icon-ul li {
margin-bottom: 15px;
}
@@ -643,7 +658,6 @@ img.package-icon {
font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
line-height: 1.5;
color: #fff;
- word-wrap: break-word;
background-color: #002440;
border-color: #002440;
border-style: solid;
@@ -658,11 +672,9 @@ img.package-icon {
line-height: 1.5;
vertical-align: baseline;
}
-.page-package-details .install-tabs #package-manager .install-script span::before {
- content: "PM> ";
-}
-.page-package-details .install-tabs #dotnet-cli .install-script span::before {
- content: "> ";
+.page-package-details .install-tabs .tab-pane .alert {
+ width: 100%;
+ margin: 0;
}
.page-downloads .list-tools li {
margin-top: 20px;
@@ -322,3 +322,8 @@ img.package-icon {
margin-left: 20px;
}
}
+
+.break-word {
+ word-break: break-all;
+ word-break: break-word;
+}
@@ -7,11 +7,17 @@
.package-header {
.package-title {
+ .break-word;
font-size: 24px;
font-weight: 300;
line-height: 0.9;
- word-break: break-all;
- word-break: break-word;
+ }
+
+ .reserved-indicator {
+ margin-top: 3px;
+ margin-left: 3px;
+ vertical-align: top;
+ width: 20px;
}
.package-by {
@@ -36,11 +42,10 @@
}
.package-details {
+ .break-word;
margin-top: 8px;
color: @text-color;
line-height: 20px;
- word-break: break-all;
- word-break: break-word;
}
@@ -1,27 +1,26 @@
.user-package-list {
- .manage-package-listing {
- .package-icon {
- max-height: 2em;
- min-width: 20px;
- }
-
- .align-middle {
- vertical-align: middle;
- }
+ .manage-package-listing {
+ .package-icon {
+ max-height: 2em;
+ min-width: 20px;
+ }
- .package-id {
- word-break: break-all;
- word-break: break-word;
- }
+ .align-middle {
+ vertical-align: middle;
+ }
- .package-controls {
- @media (min-width: @screen-sm-min) {
- white-space: nowrap;
- }
- }
+ .package-id {
+ .break-word;
}
- .table {
- border-bottom: 1px solid @table-border-color;
+ .package-controls {
+ @media (min-width: @screen-sm-min) {
+ white-space: nowrap;
+ }
}
+ }
+
+ .table {
+ border-bottom: 1px solid @table-border-color;
+ }
}
@@ -9,12 +9,18 @@
.package-title {
margin-bottom: 24px;
- word-break: break-all;
- word-break: break-word;
div {
margin-top: 2px;
}
+
+ .reserved-indicator {
+ width: 25px;
+ }
+ }
+
+ .package-details-main {
+ .break-word;
}
.package-details-info {
@@ -89,7 +95,6 @@
padding: 0 10px 8px 10px;
width: 100%;
max-width: 1px;
- word-wrap: break-word;
line-height: 1.5;
// Add a border with the same color as the background to support visual callout
// in high contrast mode (since borders are shown).
@@ -108,14 +113,11 @@
line-height: 1.5;
}
}
- }
- #package-manager .install-script span::before {
- content: "PM> ";
- }
-
- #dotnet-cli .install-script span::before {
- content: "> ";
+ .alert {
+ margin: 0;
+ width: 100%;
+ }
}
}
}
@@ -6,8 +6,7 @@
.row-heading {
.cell-heading {
h1 {
- word-break: break-all;
- word-break: break-word;
+ .break-word;
}
}
@@ -14,7 +14,7 @@ namespace NuGetGallery.Auditing
/// <summary>
/// Writes audit records to a specific container in the Cloud Storage Account provided
/// </summary>
- public class CloudAuditingService : AuditingService
+ public class CloudAuditingService : AuditingService, ICloudStorageStatusDependency
{
public static readonly string DefaultContainerName = "auditing";
@@ -26,7 +26,6 @@ public class CloudAuditingService : AuditingService
public CloudAuditingService(string instanceId, string localIP, string storageConnectionString, Func<Task<AuditActor>> getOnBehalfOf)
: this(instanceId, localIP, GetContainer(storageConnectionString), getOnBehalfOf)
{
-
}
public CloudAuditingService(string instanceId, string localIP, CloudBlobContainer auditContainer, Func<Task<AuditActor>> getOnBehalfOf)
@@ -121,5 +120,10 @@ private static CloudBlobContainer GetContainer(string storageConnectionString)
throw;
}
}
+
+ public Task<bool> IsAvailableAsync()
+ {
+ return _auditContainer.ExistsAsync();
+ }
}
}
@@ -43,6 +43,7 @@ public EntitiesContext(string connectionString, bool readOnly)
public IDbSet<Scope> Scopes { get; set; }
public IDbSet<User> Users { get; set; }
public IDbSet<UserSecurityPolicy> UserSecurityPolicies { get; set; }
+ public IDbSet<ReservedNamespace> ReservedNamespaces { get; set; }
IDbSet<T> IEntitiesContext.Set<T>()
{
@@ -127,6 +128,23 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder)
.HasForeignKey(p => p.UserKey)
.WillCascadeOnDelete(true);
+ modelBuilder.Entity<ReservedNamespace>()
+ .HasKey(p => p.Key);
+
+ modelBuilder.Entity<ReservedNamespace>()
+ .HasMany<PackageRegistration>(rn => rn.PackageRegistrations)
+ .WithMany(pr => pr.ReservedNamespaces)
+ .Map(prrn => prrn.ToTable("ReservedNamespaceRegistrations")
+ .MapLeftKey("ReservedNamespaceKey")
+ .MapRightKey("PackageRegistrationKey"));
+
+ modelBuilder.Entity<ReservedNamespace>()
+ .HasMany<User>(pr => pr.Owners)
+ .WithMany(u => u.ReservedNamespaces)
+ .Map(c => c.ToTable("ReservedNamespaceOwners")
+ .MapLeftKey("ReservedNamespaceKey")
+ .MapRightKey("UserKey"));
+
modelBuilder.Entity<UserSecurityPolicy>()
.HasKey(p => p.Key);
@@ -15,6 +15,7 @@ public interface IEntitiesContext
IDbSet<Scope> Scopes { get; set; }
IDbSet<User> Users { get; set; }
IDbSet<UserSecurityPolicy> UserSecurityPolicies { get; set; }
+ IDbSet<ReservedNamespace> ReservedNamespaces { get; set; }
Task<int> SaveChangesAsync();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set", Justification="This is to match the EF terminology.")]
@@ -13,15 +13,21 @@ public PackageRegistration()
{
Owners = new HashSet<User>();
Packages = new HashSet<Package>();
+ ReservedNamespaces = new HashSet<ReservedNamespace>();
}
[StringLength(CoreConstants.MaxPackageIdLength)]
[Required]
public string Id { get; set; }
public int DownloadCount { get; set; }
+
+ public bool IsVerified { get; set; }
+
public virtual ICollection<User> Owners { get; set; }
public virtual ICollection<Package> Packages { get; set; }
+ public virtual ICollection<ReservedNamespace> ReservedNamespaces { get; set; }
+
public int Key { get; set; }
}
}
@@ -0,0 +1,39 @@
+// 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 System.ComponentModel.DataAnnotations;
+
+namespace NuGetGallery
+{
+ public class ReservedNamespace : IEntity
+ {
+ public ReservedNamespace()
+ : this(value: null, isSharedNamespace: false, isPrefix: false)
+ {
+ }
+
+ public ReservedNamespace(string value, bool isSharedNamespace, bool isPrefix)
+ {
+ Value = value;
+ IsSharedNamespace = isSharedNamespace;
+ IsPrefix = isPrefix;
+ PackageRegistrations = new HashSet<PackageRegistration>();
+ Owners = new HashSet<User>();
+ }
+
+ [StringLength(CoreConstants.MaxPackageIdLength)]
+ [Required]
+ public string Value { get; set; }
+
+ public bool IsSharedNamespace { get; set; }
+
+ public bool IsPrefix { get; set; }
+
+ public virtual ICollection<PackageRegistration> PackageRegistrations { get; set; }
+ public virtual ICollection<User> Owners { get; set; }
+
+ [Key]
+ public int Key { get; set; }
+ }
+}
@@ -0,0 +1,23 @@
+// 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;
+
+namespace NuGetGallery
+{
+ /// <summary>
+ /// Define the execution strategy for the EntitiesConfiguration for connection resiliency and retries
+ /// </summary>
+ public class SuspendDbExecutionStrategy : IDisposable
+ {
+ public SuspendDbExecutionStrategy()
+ {
+ EntitiesConfiguration.SuspendExecutionStrategy = true;
+ }
+
+ public void Dispose()
+ {
+ EntitiesConfiguration.SuspendExecutionStrategy = false;
+ }
+ }
+}
@@ -19,6 +19,7 @@ public User(string username)
{
Credentials = new List<Credential>();
SecurityPolicies = new List<UserSecurityPolicy>();
+ ReservedNamespaces = new HashSet<ReservedNamespace>();
Roles = new List<Role>();
Username = username;
}
@@ -36,8 +37,11 @@ public User(string username)
public string Username { get; set; }
public virtual ICollection<Role> Roles { get; set; }
+
public bool EmailAllowed { get; set; }
+ public virtual ICollection<ReservedNamespace> ReservedNamespaces { get; set; }
+
[DefaultValue(true)]
public bool NotifyPackagePushed { get; set; }
Oops, something went wrong.

0 comments on commit 9eb4bc4

Please sign in to comment.