-
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
Add UI for validation tables (just orchestrator tables) #4861
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/NuGetGallery/Areas/Admin/Controllers/AdminControllerBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
src/NuGetGallery/Areas/Admin/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
// 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.Diagnostics.CodeAnalysis; | ||
using System.Web.Mvc; | ||
using NuGetGallery.Areas.Admin.ViewModels; | ||
using NuGetGallery.Configuration; | ||
|
||
namespace NuGetGallery.Areas.Admin.Controllers | ||
{ | ||
public partial class HomeController : AdminControllerBase | ||
{ | ||
private readonly IContentService _content; | ||
private readonly IGalleryConfigurationService _config; | ||
|
||
public HomeController(IContentService content) | ||
public HomeController(IContentService content, IGalleryConfigurationService config) | ||
{ | ||
_content = content; | ||
_content = content ?? throw new ArgumentNullException(nameof(content)); | ||
_config = config ?? throw new ArgumentNullException(nameof(config)); | ||
} | ||
|
||
[HttpGet] | ||
public virtual ActionResult Index() | ||
{ | ||
return View(); | ||
var viewModel = new HomeViewModel( | ||
showValidation: _config.Current.AsynchronousPackageValidationEnabled); | ||
|
||
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 ever be false? 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. The default |
||
return View(viewModel); | ||
} | ||
|
||
[HttpGet] | ||
|
63 changes: 63 additions & 0 deletions
63
src/NuGetGallery/Areas/Admin/Controllers/ValidationController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// 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.Collections.Generic; | ||
using System.Linq; | ||
using System.Web.Mvc; | ||
using NuGet.Versioning; | ||
using NuGetGallery.Areas.Admin.Services; | ||
using NuGetGallery.Areas.Admin.ViewModels; | ||
|
||
namespace NuGetGallery.Areas.Admin.Controllers | ||
{ | ||
public class ValidationController : AdminControllerBase | ||
{ | ||
private readonly ValidationAdminService _validationAdminService; | ||
|
||
public ValidationController(ValidationAdminService validationAdminService) | ||
{ | ||
_validationAdminService = validationAdminService ?? throw new ArgumentNullException(nameof(validationAdminService)); | ||
} | ||
|
||
[HttpGet] | ||
public virtual ActionResult Index() | ||
{ | ||
return View(nameof(Index), new ValidationPageViewModel()); | ||
} | ||
|
||
[HttpGet] | ||
public virtual ActionResult Search(string q) | ||
{ | ||
var packageValidationSets = _validationAdminService.Search(q ?? string.Empty); | ||
|
||
// Sort by lexigraphically package ID then put newer stuff on top. | ||
var groups = packageValidationSets | ||
.OrderBy(x => x.PackageId) | ||
.ThenByDescending(x => NuGetVersion.Parse(x.PackageNormalizedVersion)) | ||
.ThenByDescending(x => x.PackageKey) | ||
.ThenByDescending(x => x.Created) | ||
.ThenByDescending(x => x.Key) | ||
.GroupBy(x => x.PackageKey); | ||
|
||
var validatedPackages = new List<ValidatedPackageViewModel>(); | ||
foreach (var group in groups) | ||
{ | ||
foreach (var set in group) | ||
{ | ||
// Put completed validations first then put new validations on top. | ||
set.PackageValidations = set.PackageValidations | ||
.OrderByDescending(x => x.ValidationStatus) | ||
.ThenByDescending(x => x.ValidationStatusTimestamp) | ||
.ToList(); | ||
} | ||
|
||
var deletedStatus = _validationAdminService.GetPackageDeletedStatus(group.Key); | ||
var validatedPackage = new ValidatedPackageViewModel(group.ToList(), deletedStatus); | ||
validatedPackages.Add(validatedPackage); | ||
} | ||
|
||
return View(nameof(Index), new ValidationPageViewModel(q, validatedPackages)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 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. | ||
|
||
namespace NuGetGallery.Areas.Admin.Models | ||
{ | ||
public enum PackageDeletedStatus | ||
{ | ||
SoftDeleted, | ||
NotDeleted, | ||
Unknown, | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Simplified this interface to enable use on the
ValidationEntitiesContext
.