Split import into sources
This commit is contained in:
@@ -185,7 +185,7 @@ public class LayersController : Controller
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("AutoImportWithQueue/{apiKey}")]
|
[Route("AutoImportWithQueue/{apiKey}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> AutoImportWithQueue(string apiKey)
|
public IActionResult AutoImportWithQueue(string apiKey)
|
||||||
{
|
{
|
||||||
if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"])
|
if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"])
|
||||||
{
|
{
|
||||||
@@ -243,7 +243,7 @@ public class LayersController : Controller
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("ProcessQueue/{apiKey}")]
|
[Route("ProcessQueue/{apiKey}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IActionResult> ProcessQueue(string apiKey)
|
public IActionResult ProcessQueue(string apiKey)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
var allJobs = await _queue.GetJobs();
|
var allJobs = await _queue.GetJobs();
|
||||||
@@ -260,9 +260,9 @@ public class LayersController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("AutoImport/{apiKey}")]
|
[Route("AutoImport/{apiKey}/{nameFilter}")]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult AutoImport(string apiKey)
|
public IActionResult AutoImport(string apiKey, string nameFilter)
|
||||||
{
|
{
|
||||||
if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"])
|
if (Request.Host.Value != _configuration["apiLocalUrl"] || apiKey != _configuration["apiKey"])
|
||||||
{
|
{
|
||||||
@@ -277,11 +277,19 @@ public class LayersController : Controller
|
|||||||
var importWorkerLayers = _db.Layers
|
var importWorkerLayers = _db.Layers
|
||||||
.Include(x => x.Records)
|
.Include(x => x.Records)
|
||||||
.Where(x =>
|
.Where(x =>
|
||||||
|
x.Name != null && x.Name.Contains(nameFilter) &&
|
||||||
x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") &&
|
x.Records!.Any(y => y.Code == "Type" && y.Desc1 == "ImportWorker") &&
|
||||||
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True")
|
x.Records!.Any(y => y.Code == "IsEnabled" && y.Desc1 == "True")
|
||||||
)
|
)
|
||||||
.OrderBy(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
_logsController.AddEntry(new LogEntry
|
||||||
|
{
|
||||||
|
Title = $"Starting import: {nameFilter}, Admin layers count ({importWorkerLayers.Count})",
|
||||||
|
Type = LogEntryType.Info,
|
||||||
|
LogType = LogType.Import,
|
||||||
|
CreatedAt = DateTime.UtcNow
|
||||||
|
});
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (importWorkerLayers.Count == 0)
|
if (importWorkerLayers.Count == 0)
|
||||||
@@ -302,7 +310,6 @@ public class LayersController : Controller
|
|||||||
{
|
{
|
||||||
var type = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportType")?.Desc1 ??
|
var type = importWorker.Records!.FirstOrDefault(x => x.Code == "ImportType")?.Desc1 ??
|
||||||
"Standard";
|
"Standard";
|
||||||
var name = importWorker.Name;
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case "D1":
|
case "D1":
|
||||||
|
|||||||
Reference in New Issue
Block a user