fixes the catalog page
This commit is contained in:
@ -54,6 +54,7 @@ namespace isnd.Data.Catalog
|
|||||||
long commitMax = 0;
|
long commitMax = 0;
|
||||||
foreach (var p in vitems)
|
foreach (var p in vitems)
|
||||||
{
|
{
|
||||||
|
if (p.LatestCommit==null) continue;
|
||||||
var pkg = p.ToPackage(apiBase);
|
var pkg = p.ToPackage(apiBase);
|
||||||
if (items.Contains(pkg)) continue;
|
if (items.Contains(pkg)) continue;
|
||||||
|
|
||||||
@ -69,8 +70,8 @@ namespace isnd.Data.Catalog
|
|||||||
}
|
}
|
||||||
items.Add(pkg);
|
items.Add(pkg);
|
||||||
}
|
}
|
||||||
Upper = upper.ToFullString();
|
Upper = upper?.ToFullString() ?? lower?.ToFullString();
|
||||||
Lower = lower.ToFullString();
|
Lower = lower?.ToFullString() ?? upper?.ToFullString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -10,6 +10,7 @@ using isnd.Entities;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace isnd.Data
|
namespace isnd.Data
|
||||||
{
|
{
|
||||||
@ -72,6 +73,6 @@ namespace isnd.Data
|
|||||||
return new Catalog.Package(apiBase, this.PackageId , FullString,
|
return new Catalog.Package(apiBase, this.PackageId , FullString,
|
||||||
new Catalog.PackageDetails(this, apiBase, apiBase + ApiConfig.Registration + "/" + this.PackageId + "/" + FullString + ".json"));
|
new Catalog.PackageDetails(this, apiBase, apiBase + ApiConfig.Registration + "/" + this.PackageId + "/" + FullString + ".json"));
|
||||||
}
|
}
|
||||||
public bool IsDeleted => LatestCommit.Action == PackageAction.DeletePackage;
|
public bool IsDeleted => LatestCommit?.Action == PackageAction.DeletePackage;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -211,9 +211,14 @@ namespace isnd.Services
|
|||||||
(string pkgId, string semver = null, string pkgType = null)
|
(string pkgId, string semver = null, string pkgType = null)
|
||||||
{
|
{
|
||||||
return (await dbContext.PackageVersions
|
return (await dbContext.PackageVersions
|
||||||
.Include(v => v.Package).Include(v => v.Package.Owner)
|
.Include(v => v.Package)
|
||||||
|
.Include(v => v.Package.LatestCommit)
|
||||||
|
.Include(v => v.Package.Owner)
|
||||||
|
.Include(v => v.LatestCommit)
|
||||||
.Where(v => v.PackageId == pkgId
|
.Where(v => v.PackageId == pkgId
|
||||||
&& v.FullString == semver).SingleOrDefaultAsync()).ToPackage(
|
&& v.FullString == semver
|
||||||
|
&& v.LatestCommit !=null
|
||||||
|
).SingleOrDefaultAsync()).ToPackage(
|
||||||
apiBase);
|
apiBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +242,7 @@ namespace isnd.Services
|
|||||||
return dbContext.PackageVersions
|
return dbContext.PackageVersions
|
||||||
.Include(v => v.Package)
|
.Include(v => v.Package)
|
||||||
.Include(v => v.Package.Owner)
|
.Include(v => v.Package.Owner)
|
||||||
|
.Include(v => v.Package.LatestCommit)
|
||||||
.Include(v => v.LatestCommit)
|
.Include(v => v.LatestCommit)
|
||||||
.Where(v => v.PackageId == pkgId && semver == v.FullString
|
.Where(v => v.PackageId == pkgId && semver == v.FullString
|
||||||
&& (pkgType == null || pkgType == v.Type)
|
&& (pkgType == null || pkgType == v.Type)
|
||||||
@ -264,6 +270,7 @@ namespace isnd.Services
|
|||||||
.Include(p => p.Versions)
|
.Include(p => p.Versions)
|
||||||
.Include(p => p.Owner)
|
.Include(p => p.Owner)
|
||||||
.Include(p => p.LatestCommit)
|
.Include(p => p.LatestCommit)
|
||||||
|
.Include(p => p.Versions[0].LatestCommit)
|
||||||
.SingleOrDefaultAsync(p => p.Id.ToLower() == query.Query);
|
.SingleOrDefaultAsync(p => p.Id.ToLower() == query.Query);
|
||||||
if (scope==null) return null;
|
if (scope==null) return null;
|
||||||
if (scope.Versions.Count==0) return null;
|
if (scope.Versions.Count==0) return null;
|
||||||
@ -283,8 +290,11 @@ namespace isnd.Services
|
|||||||
.Include(p => p.Owner)
|
.Include(p => p.Owner)
|
||||||
.Include(p => p.Versions)
|
.Include(p => p.Versions)
|
||||||
.Include(p => p.LatestCommit)
|
.Include(p => p.LatestCommit)
|
||||||
|
.Include(p => p.LatestCommit.Versions)
|
||||||
.Where(p => p.Id.StartsWith(query.Query)
|
.Where(p => p.Id.StartsWith(query.Query)
|
||||||
&& (query.Prerelease || p.Versions.Any(p => !p.IsPrerelease)))
|
&& p.LatestCommit != null
|
||||||
|
&& (query.Prerelease || p.Versions.Any(p => !p.IsPrerelease))
|
||||||
|
&& p.Versions.Count()>0)
|
||||||
.OrderBy(p => p.CommitNId);
|
.OrderBy(p => p.CommitNId);
|
||||||
|
|
||||||
return new PackageSearchResult(await scope.Skip(query.Skip).Take(query.Take)
|
return new PackageSearchResult(await scope.Skip(query.Skip).Take(query.Take)
|
||||||
|
@ -32,6 +32,5 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@Html.ActionLink("Edit", "Edit", new { pkgid = Model.PackageId, version = Model.FullString }) |
|
|
||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,8 +37,7 @@
|
|||||||
<button class="far fa-copy" style="float:right" onclick="navigator.clipboard.writeText($('#code').text());this.innerText='copied'" >copy</button>
|
<button class="far fa-copy" style="float:right" onclick="navigator.clipboard.writeText($('#code').text());this.innerText='copied'" >copy</button>
|
||||||
<pre><code id="code" ><PackageReference Include="@Model.pkgid" Version="@Model.latest.FullString" /></code></pre>
|
<pre><code id="code" ><PackageReference Include="@Model.pkgid" Version="@Model.latest.FullString" /></code></pre>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="controls">
|
||||||
@Html.ActionLink("Edit", "Edit", new { pkgid = Model.pkgid, version = Model.latest.FullString }) |
|
|
||||||
@Html.ActionLink("Delete", "Delete", new { pkgid = Model.pkgid, version= Model.latest.FullString }) |
|
@Html.ActionLink("Delete", "Delete", new { pkgid = Model.pkgid, version= Model.latest.FullString }) |
|
||||||
<a asp-action="Index">Back to List</a>
|
<a asp-action="Index">Back to List</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="border-top footer text-muted" style="position:bottom">
|
<footer class="border-top footer text-muted" style="position:bottom">
|
||||||
isn @SiteHelpers.SemVer © 2021-2022 Paul Schneider - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
isn @SiteHelpers.SemVer © 2021-2024 Paul Schneider - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||||
</footer>
|
</footer>
|
||||||
<!-- <script src="/lib/jquery/dist/jquery.slim.min.js" ></script>
|
<!-- <script src="/lib/jquery/dist/jquery.slim.min.js" ></script>
|
||||||
<script src="/lib/popper/popper.min.js"></script>
|
<script src="/lib/popper/popper.min.js"></script>
|
||||||
|
@ -114,7 +114,7 @@ namespace isnd.host.tests
|
|||||||
}
|
}
|
||||||
public string SPIIndexURI
|
public string SPIIndexURI
|
||||||
{
|
{
|
||||||
get => server.Addresses.First(a => a.StartsWith("https:")) + "/v3/index.json";
|
get => server.Addresses.First(a => a.StartsWith("http:")) + "/v3/index.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -5,6 +5,7 @@ using isn;
|
|||||||
using isnd.Data;
|
using isnd.Data;
|
||||||
using isnd.Entities;
|
using isnd.Entities;
|
||||||
using isnd.Interfaces;
|
using isnd.Interfaces;
|
||||||
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Hosting.Server;
|
using Microsoft.AspNetCore.Hosting.Server;
|
||||||
@ -46,32 +47,27 @@ namespace isnd.tests
|
|||||||
|
|
||||||
public void SetupHost()
|
public void SetupHost()
|
||||||
{
|
{
|
||||||
var webhostBuilder = new WebHostBuilder()
|
var builder = WebHost.CreateDefaultBuilder(new string[0]);
|
||||||
.UseKestrel()
|
|
||||||
.UseIISIntegration()
|
|
||||||
// .UseContentRoot("../../../../../src/isnd")
|
// .UseContentRoot("../../../../../src/isnd")
|
||||||
.UseStartup(typeof(Startup))
|
builder.UseStartup(typeof(Startup))
|
||||||
.ConfigureAppConfiguration((builderContext, config) =>
|
.ConfigureAppConfiguration((builderContext, config) =>
|
||||||
{
|
{
|
||||||
config.AddJsonFile("appsettings.json", false);
|
config.AddJsonFile("appsettings.json", true);
|
||||||
config.AddJsonFile("appsettings.Development.json", false);
|
config.AddJsonFile("appsettings.Development.json", false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Host = builder.Build();
|
||||||
|
|
||||||
Host = webhostBuilder.Build();
|
|
||||||
|
|
||||||
var logFactory = Host.Services.GetRequiredService<ILoggerFactory>();
|
var logFactory = Host.Services.GetRequiredService<ILoggerFactory>();
|
||||||
Logger = logFactory.CreateLogger<WebServerFixture>();
|
Logger = logFactory.CreateLogger<WebServerFixture>();
|
||||||
|
|
||||||
|
|
||||||
Host.Start(); //Starts listening on the configured addresses.
|
Host.Start(); //Starts listening on the configured addresses.
|
||||||
var server = Host.Services.GetRequiredService<IServer>();
|
var server = Host.Services.GetRequiredService<IServer>();
|
||||||
|
|
||||||
|
var addressFeatures = server.Features.Get<IServerAddressesFeature>();
|
||||||
|
|
||||||
var addressFeature = server.Features.Get<IServerAddressesFeature>();
|
foreach (var address in addressFeatures.Addresses)
|
||||||
|
|
||||||
foreach (var address in addressFeature.Addresses)
|
|
||||||
{
|
{
|
||||||
Addresses.Add(address);
|
Addresses.Add(address);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user