23-12-2022
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using DigitalData.Modules.Logging;
|
||||
using DigitalData.Modules.Filesystem;
|
||||
using ECM.JobRunner.Common.JobRunnerReference;
|
||||
using System;
|
||||
|
||||
@@ -8,14 +9,21 @@ namespace ECM.JobRunner.Web.Data
|
||||
{
|
||||
private readonly Logger logger;
|
||||
private readonly IEDMIServiceChannel channel;
|
||||
private readonly DigitalData.Modules.Filesystem.File fileEx;
|
||||
|
||||
public event EventHandler<string>? PageTitleChanged;
|
||||
|
||||
public HelperService(LoggingService Logging, WcfService Wcf)
|
||||
{
|
||||
logger = Logging.LogConfig.GetLogger();
|
||||
fileEx = new DigitalData.Modules.Filesystem.File(Logging.LogConfig);
|
||||
channel = Wcf.Channel;
|
||||
}
|
||||
|
||||
public string GetDateDirectory(DateTime date)
|
||||
{
|
||||
return fileEx.GetDateString(date);
|
||||
}
|
||||
|
||||
public void SetPageTitle(string title)
|
||||
{
|
||||
@@ -61,8 +69,6 @@ namespace ECM.JobRunner.Web.Data
|
||||
waiting = executingItems.Where(i => i.Successful && i.Waiting == true).Count()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public DateTime GetNextExecutionTime(string pCronExpression)
|
||||
{
|
||||
Quartz.CronExpression expression = new(pCronExpression);
|
||||
|
||||
@@ -56,7 +56,19 @@ namespace ECM.JobRunner.Web.Data
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RunProfile(ImportProfile profile)
|
||||
{
|
||||
try
|
||||
{
|
||||
await channel.RunJobAsync(new RunJobRunJobRequest() { JobId = profile.JobId });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> CreateProfile(ImportProfile profile) =>
|
||||
await DoUpdateProfile(profile, UpdateProfileUpdateProfileRequest.UpdateProfileAction.Create);
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\DDModules\Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDModules\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
private List<StatusItem>? filteredEntries;
|
||||
|
||||
private int dateFilter = 1;
|
||||
private bool showWaiting = true;
|
||||
private bool showWaiting = false;
|
||||
|
||||
// TODO: implement more filters
|
||||
private bool showSuccessful = true;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject ImportProfileService Import;
|
||||
@inject HelperService Jobs;
|
||||
@inject WcfService Service;
|
||||
|
||||
@if (profile == null)
|
||||
@@ -144,9 +143,10 @@ else
|
||||
</label>
|
||||
<select class="form-select" aria-label="Job type selection" id="jobType" @bind="profile.SubfolderDateFormat">
|
||||
<option selected value="">Keine Unterordner</option>
|
||||
<option value="YYYY">YYYY (@DateTime.Now.ToString("yyyy"))</option>
|
||||
<option value="YYYY-MM">YYYY-MM (@DateTime.Now.ToString("yyyy-MM"))</option>
|
||||
<option value="YYYY-MM-DD">YYYY-MM-DD (@DateTime.Now.ToString("yyyy-MM-dd"))</option>
|
||||
@foreach (var dateString in GetSubdirectoryDateStrings())
|
||||
{
|
||||
<option value=@dateString.formatString>@dateString.prettyName (@dateString.exampleValue)</option>
|
||||
}
|
||||
</select>
|
||||
<div id="cronHelp" class="form-text">Der Windream Objekttyp, dem das Profil zugeordnet wird. Bestimmt u.a., welche Indexe zur Verfügung stehen.</div>
|
||||
</div>
|
||||
@@ -195,6 +195,24 @@ else
|
||||
return ProfileId == Constants.ENTITY_ID_NEW ? "profiles/import" : $"profiles/import/{ProfileId}";
|
||||
}
|
||||
|
||||
private List<SubdirectoryDateString> GetSubdirectoryDateStrings()
|
||||
{
|
||||
return new()
|
||||
{
|
||||
new() {prettyName = $"YYYY", exampleValue = $"{DateTime.Now:yyyy}", formatString = "yyyy" },
|
||||
new() {prettyName = $"YYYY\\MM", exampleValue = $"{DateTime.Now:yyyy\\\\MM}", formatString = "yyyy\\MM" },
|
||||
new() {prettyName = $"YYYY\\MM\\DD", exampleValue = $"{DateTime.Now:yyyy\\\\MM\\\\dd}", formatString = "yyyy\\MM\\dd" }
|
||||
};
|
||||
}
|
||||
|
||||
private class SubdirectoryDateString
|
||||
{
|
||||
public string? prettyName;
|
||||
public string? exampleValue;
|
||||
public string? formatString;
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
jobTypes = await Service.GetJobTypes();
|
||||
|
||||
@@ -84,9 +84,21 @@ else
|
||||
</svg> Delete
|
||||
</a>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-warning" @onclick="RunProfile">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play-fill" viewBox="0 0 16 16">
|
||||
<path d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z" />
|
||||
</svg> Profil manuell starten
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex-column flex-fill"></div>
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-secondary" href="profiles/import/@profile.Id/steps">Profilschritte bearbeiten (@profile.Steps.Length)</a>
|
||||
<a class="btn btn-primary" href="profiles/import/@profile.Id/steps">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
|
||||
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z" />
|
||||
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z" />
|
||||
</svg> Profilschritte bearbeiten (@profile.Steps.Length)
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -110,6 +122,18 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
protected async void RunProfile()
|
||||
{
|
||||
if (profile != null)
|
||||
{
|
||||
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
|
||||
if (confirmed)
|
||||
{
|
||||
await Import.RunProfile(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async void DeleteJob()
|
||||
{
|
||||
if (profile != null)
|
||||
|
||||
Reference in New Issue
Block a user