REORG
This commit is contained in:
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -27,8 +27,8 @@
|
||||
"name": "web",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "publish",
|
||||
"program": "${workspaceFolder}/artifacts/isnd.dll",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/src/isnd/bin/Debug/netcoreapp2.1/isnd.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/src/isnd",
|
||||
"stopAtEntry": false,
|
||||
|
22
omnisharp.json
Normal file
22
omnisharp.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"dotnet": {
|
||||
"enabled": false
|
||||
},
|
||||
"msbuild": {
|
||||
"enabled": true
|
||||
},
|
||||
"Dnx": {
|
||||
"enabled": false
|
||||
},
|
||||
"Script": {
|
||||
"enabled": false
|
||||
},
|
||||
"fileOptions": {
|
||||
"systemExcludeSearchPatterns": [
|
||||
"**/bin/**/*",
|
||||
"**/obj/**/*",
|
||||
"**/node_modules/**/*"
|
||||
],
|
||||
"userExcludeSearchPatterns": []
|
||||
}
|
||||
}
|
@ -4,6 +4,10 @@ namespace isnd.Data.Catalog
|
||||
{
|
||||
public class PackageRegistrationIndexQuery : RegistrationPageIndex
|
||||
{
|
||||
public PackageRegistrationIndexQuery(string id) : base(id)
|
||||
{
|
||||
}
|
||||
|
||||
[JsonProperty("prerelease")]
|
||||
public bool Prerelease { get; set; }
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using isnd.Interfaces;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class PageRef : IObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Page Url
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Page entry count
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("count")]
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("commitId")]
|
||||
public string CommitId { get; set; }
|
||||
|
||||
[JsonProperty("commitTimeStamp")]
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,6 +3,10 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
/// <summary>
|
||||
/// Hosts a catalog entry,
|
||||
/// the atomic content reference
|
||||
/// </summary>
|
||||
public class RegistrationLeaf
|
||||
{
|
||||
/*
|
||||
|
@ -1,24 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPage
|
||||
public class RegistrationPage
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The URL to the registration page
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@id"), JsonRequired]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of registration leaves in the page
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("count"), JsonRequired]
|
||||
public int Count { get; set; }
|
||||
[JsonProperty("@id")]
|
||||
[JsonRequired]
|
||||
public string Id { get; }
|
||||
public RegistrationPage (string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// no The array of registration leaves and their associate metadata
|
||||
@ -26,7 +20,7 @@ namespace isnd.Data.Catalog
|
||||
/// <value></value>
|
||||
[JsonProperty("items")]
|
||||
|
||||
public RegistrationLeaf[] Items { get; set; }
|
||||
public List<RegistrationLeaf> Items { get; set; }
|
||||
/// <summary>
|
||||
/// The highest SemVer 2.0.0 version in the page (inclusive)
|
||||
/// </summary>
|
||||
@ -47,5 +41,9 @@ namespace isnd.Data.Catalog
|
||||
[JsonProperty("parent")]
|
||||
public string Parent { get; set; }
|
||||
|
||||
[JsonProperty("count")]
|
||||
public int Count { get; internal set; }
|
||||
public string CommitId { get; internal set; }
|
||||
public DateTime CommitTimeStamp { get; internal set; }
|
||||
}
|
||||
}
|
@ -1,13 +1,38 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPageIndex
|
||||
{
|
||||
/// <summary>
|
||||
/// Page Url
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set; }
|
||||
public RegistrationPageIndex(string id)
|
||||
{
|
||||
Id = id;
|
||||
Items = new List<RegistrationPage>();
|
||||
}
|
||||
|
||||
public RegistrationPageIndex(IEnumerable<RegistrationPage> pages)
|
||||
{
|
||||
Items = new List<RegistrationPage>(pages);
|
||||
}
|
||||
|
||||
public RegistrationPageIndex(string id, IEnumerable<RegistrationLeaf> leaves) : this(id)
|
||||
{
|
||||
// leaves;
|
||||
}
|
||||
|
||||
[JsonProperty("count")]
|
||||
public int Count { get => Items?.Length ?? 0; }
|
||||
public int Count { get => Items?.Count ?? 0; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public RegistrationPage[] Items { get; set; }
|
||||
public List<RegistrationPage> Items { get; set; }
|
||||
|
||||
public string CommitId { get; set; }
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using isnd.Interfaces;
|
||||
using isnd.Data.Catalog;
|
||||
|
||||
namespace isnd.Data.Packages.Catalog
|
||||
{
|
||||
public class CatalogIndex : IObject
|
||||
{
|
||||
[JsonProperty("@id")]
|
||||
public string Id { get; set ; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public List<PageRef> Items { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("count")]
|
||||
public int Count { get => Items?.Count ?? 0; }
|
||||
public string CommitId { get; set; }
|
||||
public DateTime CommitTimeStamp { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -57,7 +57,7 @@ namespace isnd.Data.Packages
|
||||
var v = Versions.First();
|
||||
RegistrationLeaf leave = new RegistrationLeaf
|
||||
{
|
||||
Id = bid + Id + ".json",
|
||||
Id = bid + Id + "/" + v.FullString + ".json",
|
||||
PackageContent = v.NugetLink,
|
||||
Entry = new CatalogEntry
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ namespace isnd.Helpers
|
||||
return v.Package.OwnerId == userId;
|
||||
}
|
||||
|
||||
public static RegistrationPage[] CreateRegistrationPages(this IEnumerable<RegistrationLeaf> leaves,
|
||||
public static RegistrationPageIndex CreateRegistrationPages(this IEnumerable<RegistrationLeaf> leaves,
|
||||
string bid)
|
||||
{
|
||||
List<RegistrationPage> pages = new List<RegistrationPage>();
|
||||
@ -28,19 +28,18 @@ namespace isnd.Helpers
|
||||
var lbi = leaves.Where(l=>l.Entry.Id == id).OrderBy(l=>
|
||||
new Version(l.Entry.version));
|
||||
var latest = new Version(lbi.Last().Entry.version);
|
||||
pages.Add(new RegistrationPage
|
||||
{
|
||||
Id = bid + id + "/" + latest.Major + "."
|
||||
pages.Add(new RegistrationPage(bid + id + "/" + latest.Major + "."
|
||||
+ latest.Minor + "."
|
||||
+ latest.Build,
|
||||
+ latest.Build)
|
||||
{
|
||||
Count = lbi.Count(),
|
||||
Lower = new Version(lbi.First().Entry.version),
|
||||
Upper = latest,
|
||||
Items = lbi.ToArray(),
|
||||
Items = lbi.ToList(),
|
||||
Parent = bid + id + "/" + ApiConfig.IndexDotJson,
|
||||
});
|
||||
}
|
||||
return pages.ToArray();
|
||||
return new RegistrationPageIndex(pages);
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,6 @@ namespace isnd.Interfaces
|
||||
string CatalogBaseUrl { get; }
|
||||
AutoCompleteResult AutoComplete(string pkgid, int skip, int take, bool prerelease = false, string packageType = null);
|
||||
|
||||
CatalogIndex GetCatalogIndex();
|
||||
string[] GetVersions(string pkgid, NuGetVersion parsedVersion, bool prerelease = false, string packageType = null, int skip = 0, int take = 25);
|
||||
RegistrationPageIndex SearchByName(string query, int skip, int take, bool prerelease = false, string packageType = null);
|
||||
IEnumerable<Resource> GetResources(IUnleash unleashĈlient);
|
||||
@ -28,6 +27,8 @@ namespace isnd.Interfaces
|
||||
Task<PackageVersion> GetPackageAsync(string pkgid, string version, string type);
|
||||
IEnumerable<PackageVersion> GetCatalogLeaf(string pkgId, string semver, string pkgType);
|
||||
IEnumerable<RegistrationLeaf> SearchById(string pkgId, string semver, string pkgType);
|
||||
|
||||
RegistrationPageIndex GetCatalogIndex();
|
||||
}
|
||||
|
||||
}
|
@ -139,10 +139,8 @@ namespace isnd.Services
|
||||
var pkgs = scope.Skip(skip).Take(take).ToArray();
|
||||
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}/";
|
||||
var leaves = pkgs.Select(p => p.ToLeave(bid));
|
||||
return new RegistrationPageIndex
|
||||
{
|
||||
Items = leaves.CreateRegistrationPages(bid)
|
||||
};
|
||||
|
||||
return new RegistrationPageIndex(bid, leaves);
|
||||
}
|
||||
|
||||
public AutoCompleteResult AutoComplete(string id,
|
||||
@ -184,15 +182,15 @@ namespace isnd.Services
|
||||
.Skip(skip).Take(take).ToArray();
|
||||
}
|
||||
|
||||
public static CatalogIndex CurrentCatalogIndex { get; protected set; }
|
||||
public static List<Page> CurrentCatalogPages { get; protected set; }
|
||||
public static RegistrationPageIndex CurrentCatalogIndex { get; protected set; }
|
||||
public static List<RegistrationPage> CurrentCatalogPages { get; protected set; }
|
||||
|
||||
public string CatalogBaseUrl => extUrl;
|
||||
|
||||
private IsndSettings isndSettings;
|
||||
private string extUrl;
|
||||
|
||||
public virtual CatalogIndex GetCatalogIndex()
|
||||
public virtual RegistrationPageIndex GetCatalogIndex()
|
||||
{
|
||||
if (CurrentCatalogIndex == null)
|
||||
{
|
||||
@ -207,35 +205,28 @@ namespace isnd.Services
|
||||
var oldIndex = CurrentCatalogIndex;
|
||||
var oldPages = CurrentCatalogPages;
|
||||
string baseid = extUrl + ApiConfig.Catalog;
|
||||
string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}/";
|
||||
string basepageid = extUrl + ApiConfig.CatalogPage;
|
||||
CurrentCatalogIndex = new CatalogIndex
|
||||
{
|
||||
Id = baseid,
|
||||
Items = new List<PageRef>()
|
||||
};
|
||||
CurrentCatalogPages = new List<Page>();
|
||||
CurrentCatalogIndex = new RegistrationPageIndex(baseid);
|
||||
CurrentCatalogPages = new List<RegistrationPage>();
|
||||
|
||||
var scope = dbContext.Commits.OrderBy(c => c.TimeStamp);
|
||||
|
||||
PageRef pageRef = null;
|
||||
Page page = null;
|
||||
RegistrationPage page = null;
|
||||
i = isndSettings.CatalogPageLen;
|
||||
foreach (var commit in scope)
|
||||
{
|
||||
if (i >= this.isndSettings.CatalogPageLen)
|
||||
{
|
||||
page = new Page
|
||||
page = new RegistrationPage(basepageid + "-" + p++)
|
||||
{
|
||||
Id = basepageid + "-" + p++,
|
||||
Parent = baseid,
|
||||
CommitId = commit.CommitId,
|
||||
CommitTimeStamp = commit.CommitTimeStamp,
|
||||
Items = new List<PackageRef>()
|
||||
CommitTimeStamp = commit.CommitTimeStamp
|
||||
};
|
||||
CurrentCatalogPages.Add(page);
|
||||
pageRef = new PageRef
|
||||
var pageRef = new RegistrationPage(page.Id)
|
||||
{
|
||||
Id = page.Id,
|
||||
CommitId = commit.CommitId,
|
||||
CommitTimeStamp = commit.CommitTimeStamp
|
||||
};
|
||||
@ -247,21 +238,14 @@ namespace isnd.Services
|
||||
.Include(pkg => pkg.LatestVersion)
|
||||
.Where(
|
||||
pkg => pkg.Versions.Count(v => v.CommitId == commit.CommitId) > 0
|
||||
);
|
||||
).GroupBy((q)=> q.Id);
|
||||
// pkg.Versions.OrderByDescending(vi => vi.CommitNId).First().FullString
|
||||
foreach (var pkg in validPkgs)
|
||||
foreach (var pkgid in validPkgs)
|
||||
{
|
||||
var v = pkg.Versions.
|
||||
Where(cv => cv.CommitId == commit.CommitId)
|
||||
.OrderByDescending(vc => vc.CommitNId).First();
|
||||
|
||||
StringBuilder refid = new StringBuilder(extUrl);
|
||||
refid.AppendFormat("{0}/{1}/{2}", ApiConfig.CatalogLeaf, v.PackageId
|
||||
, v.FullString);
|
||||
if (v.Type != null)
|
||||
refid.AppendFormat("/{0}", v.Type);
|
||||
|
||||
var pkgref = new PackageRef
|
||||
StringBuilder refid = new StringBuilder(bidreg);
|
||||
refid.AppendFormat("{0}/",
|
||||
pkgid.Key);
|
||||
/* var pkgref = new PackageRef
|
||||
{
|
||||
Version = v.FullString,
|
||||
LastCommit = v.LatestCommit,
|
||||
@ -272,8 +256,9 @@ namespace isnd.Services
|
||||
RefType = v.LatestCommit.Action == PackageAction.PublishPackage
|
||||
? "nuget:PackageDetails" :
|
||||
"nuget:PackageDelete"
|
||||
};
|
||||
page.Items.Add(pkgref);
|
||||
}; */
|
||||
foreach (var pkgv in pkgid)
|
||||
page.Items.Add(pkgv.ToLeave(bidreg));
|
||||
}
|
||||
reason = commit;
|
||||
i++;
|
||||
|
@ -25,10 +25,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Items[0].Items[0].Id)
|
||||
@Html.DisplayNameFor(model => model.Items[0].Id)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Items[0].Items[0].Entry.Description)
|
||||
@Html.DisplayNameFor(model => model.Items[0].CommitId)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user