-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
5 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
{ | ||
"RepoPath": "src/PackageRegistryService/StagingArea/invenio/[email protected]", | ||
"FileName": "[email protected]", | ||
"LastUpdated": "2024-02-23T16:27:27+01:00", | ||
"LastUpdated": "2024-02-23T16:27:26+01:00", | ||
"Metadata": { | ||
"Name": "invenio", | ||
"Description": "Validates if the ARC contains the necessary metadata to be publishable via Invenio.\nThe following metadata is required:\n - Investigation has title and description\n - All persons in Investigation Contacts must have a name, last name, affiliation and valid email\n", | ||
|
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
15 changes: 13 additions & 2 deletions
15
src/PackageRegistryService/Pages/Components/PackageSummary.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
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,6 +1,41 @@ | ||
namespace PackageRegistryService.Pages | ||
using Microsoft.AspNetCore.Http.HttpResults; | ||
using Microsoft.EntityFrameworkCore; | ||
using PackageRegistryService.Models; | ||
using PackageRegistryService.Pages.Components; | ||
|
||
namespace PackageRegistryService.Pages | ||
{ | ||
public static class Package | ||
{ | ||
public static async Task<ContentHttpResult> Render(string packageName, ValidationPackageDb database) | ||
{ | ||
var packages = await | ||
database.ValidationPackages | ||
.Where(p => p.Name == packageName) | ||
.ToArrayAsync(); | ||
|
||
var latestPackage = | ||
packages | ||
.OrderByDescending(p => p.MajorVersion) | ||
.ThenByDescending(p => p.MinorVersion) | ||
.ThenByDescending(p => p.PatchVersion) | ||
.FirstOrDefault(); | ||
|
||
var content = Layout.Render( | ||
activeNavbarItem: "", | ||
title: $"Package {packageName} - ARC validation package registry API", | ||
content: $@"<h1>Validation Package <mark>{packageName}</mark></h1> | ||
<pre> | ||
<code> | ||
arc-validate package install {packageName} | ||
arc-validate package install {packageName} --package-version {latestPackage.GetSemanticVersionString()} | ||
</code> | ||
</pre> | ||
" | ||
); | ||
|
||
return TypedResults.Text(content: content, contentType: "text/html"); | ||
} | ||
} | ||
} |
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