REORG
This commit is contained in:
parent
fcea41f8c1
commit
f46ca00de9
13 changed files with 105 additions and 125 deletions
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue