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