15-12-2022
This commit is contained in:
31
ECM.JobRunner.Web/Pages/ImportProfile/EditProfile.razor
Normal file
31
ECM.JobRunner.Web/Pages/ImportProfile/EditProfile.razor
Normal file
@@ -0,0 +1,31 @@
|
||||
@page "/profiles/import/{profileId:int}/edit"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@using ECM.JobRunner.Web.Pages.ImportStep;
|
||||
@inject NavigationManager Navigation;
|
||||
@inject ImportService Profile;
|
||||
|
||||
<PageTitle>Job bearbeiten</PageTitle>
|
||||
|
||||
<h3>Job bearbeiten</h3>
|
||||
|
||||
<ProfileForm ProfileId="ProfileId" OnValidSubmit="OnFormSubmit" />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public int ProfileId { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int StepId { get; set; }
|
||||
|
||||
private async void OnFormSubmit(EditContext ctx)
|
||||
{
|
||||
ImportProfile profile = (ImportProfile)ctx.Model;
|
||||
bool result = await Profile.UpdateProfile(profile);
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
Navigation.NavigateTo($"/profiles/import/{profile.Id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
27
ECM.JobRunner.Web/Pages/ImportProfile/NewProfile.razor
Normal file
27
ECM.JobRunner.Web/Pages/ImportProfile/NewProfile.razor
Normal file
@@ -0,0 +1,27 @@
|
||||
@page "/profiles/import/new"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject NavigationManager Navigation;
|
||||
@inject ImportService Import;
|
||||
|
||||
<PageTitle>Job erstellen</PageTitle>
|
||||
|
||||
<h3>Job erstellen</h3>
|
||||
|
||||
<ProfileForm ProfileId="ProfileId" OnValidSubmit="OnFormSubmit" />
|
||||
|
||||
@code {
|
||||
public int ProfileId = -1;
|
||||
|
||||
private async void OnFormSubmit(EditContext ctx)
|
||||
{
|
||||
ImportProfile profile = (ImportProfile)ctx.Model;
|
||||
|
||||
bool result = await Import.CreateProfile(profile);
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
Navigation.NavigateTo("/jobs");
|
||||
}
|
||||
}
|
||||
}
|
||||
212
ECM.JobRunner.Web/Pages/ImportProfile/ProfileForm.razor
Normal file
212
ECM.JobRunner.Web/Pages/ImportProfile/ProfileForm.razor
Normal file
@@ -0,0 +1,212 @@
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject ImportService Import;
|
||||
@inject JobService Jobs;
|
||||
|
||||
@if (profile == null)
|
||||
{
|
||||
<p>Form loading..</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<EditForm Model="profile" OnValidSubmit="OnValidSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
|
||||
<div class="row row-cols-1 row-cols-lg-2">
|
||||
<div class="col">
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="enabled" @bind="profile.Active">
|
||||
<label class="form-check-label" for="enabled">Aktiv</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3 form-check">
|
||||
<input class="form-check-input" type="checkbox" id="flexCheckDefault" @bind="profile.DeleteFiles">
|
||||
<label class="form-check-label" for="flexCheckDefault">
|
||||
Originaldateien nach Verarbeitung löschen
|
||||
</label>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input class="form-check-input" type="checkbox" id="flexCheckChecked" @bind="profile.IncludeSubfolders">
|
||||
<label class="form-check-label" for="flexCheckChecked">
|
||||
Unterstruktur des Quellverzeichnisses im Zielverzeichnis abbilden
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row row-cols-1 row-cols-lg-2">
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-card-text" viewBox="0 0 16 16">
|
||||
<path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z" />
|
||||
<path d="M3 5.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zM3 8a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9A.5.5 0 0 1 3 8zm0 2.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5z" />
|
||||
</svg> Name
|
||||
</label>
|
||||
<input type="text" class="form-control" id="name" aria-describedby="nameHelp" @bind="profile.Job.Name">
|
||||
<div id="nameHelp" class="form-text">Der Name des Jobs. Wird in der Übersicht angezeigt.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="jobType" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-seam" viewBox="0 0 16 16">
|
||||
<path d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z" />
|
||||
</svg> Objekttyp
|
||||
</label>
|
||||
<select class="form-select" aria-label="Job type selection" id="jobType" @bind="profile.ObjectTypeName">
|
||||
<option selected>Auswählen..</option>
|
||||
@if (objectTypes != null)
|
||||
{
|
||||
@foreach (ObjectType type in objectTypes)
|
||||
{
|
||||
<option value="@type.Name">@type.Name</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>
|
||||
|
||||
@*<div class="mb-3">
|
||||
<label for="jobType" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-robot" viewBox="0 0 16 16">
|
||||
<path d="M6 12.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5ZM3 8.062C3 6.76 4.235 5.765 5.53 5.886a26.58 26.58 0 0 0 4.94 0C11.765 5.765 13 6.76 13 8.062v1.157a.933.933 0 0 1-.765.935c-.845.147-2.34.346-4.235.346-1.895 0-3.39-.2-4.235-.346A.933.933 0 0 1 3 9.219V8.062Zm4.542-.827a.25.25 0 0 0-.217.068l-.92.9a24.767 24.767 0 0 1-1.871-.183.25.25 0 0 0-.068.495c.55.076 1.232.149 2.02.193a.25.25 0 0 0 .189-.071l.754-.736.847 1.71a.25.25 0 0 0 .404.062l.932-.97a25.286 25.286 0 0 0 1.922-.188.25.25 0 0 0-.068-.495c-.538.074-1.207.145-1.98.189a.25.25 0 0 0-.166.076l-.754.785-.842-1.7a.25.25 0 0 0-.182-.135Z" />
|
||||
<path d="M8.5 1.866a1 1 0 1 0-1 0V3h-2A4.5 4.5 0 0 0 1 7.5V8a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1v-.5A4.5 4.5 0 0 0 10.5 3h-2V1.866ZM14 7.5V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7.5A3.5 3.5 0 0 1 5.5 4h5A3.5 3.5 0 0 1 14 7.5Z" />
|
||||
</svg> Job Typ
|
||||
</label>
|
||||
<select class="form-select" aria-label="Job type selection" id="jobType" @bind="profile.Job.TypeId">
|
||||
<option selected>Auswählen..</option>
|
||||
@if (jobTypes != null)
|
||||
{
|
||||
@foreach (JobType type in jobTypes)
|
||||
{
|
||||
<option value="@type.Id">@type.Name</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<div id="cronHelp" class="form-text">Der Typ des Jobs.</div>
|
||||
</div>*@
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="sourceFolder" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
|
||||
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
|
||||
</svg> Quellverzeichnis
|
||||
|
||||
</label>
|
||||
<input type="text" class="form-control" id="sourceFolder" aria-describedby="sourceFolderHelp" @bind="profile.SourceFolder" />
|
||||
<div id="sourceFolderHelp" class="form-text">Lokales Verzeichnis, aus dem Dateien zur Verarbeitung gelesen werden.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="targetFolder" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-right" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 0-1 0v2A1.5 1.5 0 0 0 6.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-8A1.5 1.5 0 0 0 5 3.5v2a.5.5 0 0 0 1 0v-2z" />
|
||||
<path fill-rule="evenodd" d="M11.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H1.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
|
||||
</svg> Zielverzeichnis
|
||||
</label>
|
||||
<input type="text" class="form-control" id="targetFolder" aria-describedby="targetFolderHelp" @bind="profile.TargetFolder" />
|
||||
<div id="targetFolderHelp" class="form-text">Windream Verzeichnis, in das die verarbeiteten Dateien geschrieben werden.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="mb-3">
|
||||
<label for="cronExpression" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-alarm" viewBox="0 0 16 16">
|
||||
<path d="M8.5 5.5a.5.5 0 0 0-1 0v3.362l-1.429 2.38a.5.5 0 1 0 .858.515l1.5-2.5A.5.5 0 0 0 8.5 9V5.5z" />
|
||||
<path d="M6.5 0a.5.5 0 0 0 0 1H7v1.07a7.001 7.001 0 0 0-3.273 12.474l-.602.602a.5.5 0 0 0 .707.708l.746-.746A6.97 6.97 0 0 0 8 16a6.97 6.97 0 0 0 3.422-.892l.746.746a.5.5 0 0 0 .707-.708l-.601-.602A7.001 7.001 0 0 0 9 2.07V1h.5a.5.5 0 0 0 0-1h-3zm1.038 3.018a6.093 6.093 0 0 1 .924 0 6 6 0 1 1-.924 0zM0 3.5c0 .753.333 1.429.86 1.887A8.035 8.035 0 0 1 4.387 1.86 2.5 2.5 0 0 0 0 3.5zM13.5 1c-.753 0-1.429.333-1.887.86a8.035 8.035 0 0 1 3.527 3.527A2.5 2.5 0 0 0 13.5 1z" />
|
||||
</svg> Cron Expression
|
||||
</label>
|
||||
<input type="text" class="form-control" id="cronExpression" @bind="profile.Job.CronSchedule" aria-describedby="cronHelp">
|
||||
<div id="cronHelp" class="form-text">Die Zeitplan des Jobs. Erwartet eine <a href="https://www.quartz-scheduler.net/documentation/quartz-3.x/how-tos/crontrigger.html#examples" target="_blank">Quartz.NET Cron Expression.</a></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="backupFolder" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-life-preserver" viewBox="0 0 16 16">
|
||||
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm6.43-5.228a7.025 7.025 0 0 1-3.658 3.658l-1.115-2.788a4.015 4.015 0 0 0 1.985-1.985l2.788 1.115zM5.228 14.43a7.025 7.025 0 0 1-3.658-3.658l2.788-1.115a4.015 4.015 0 0 0 1.985 1.985L5.228 14.43zm9.202-9.202-2.788 1.115a4.015 4.015 0 0 0-1.985-1.985l1.115-2.788a7.025 7.025 0 0 1 3.658 3.658zm-8.087-.87a4.015 4.015 0 0 0-1.985 1.985L1.57 5.228A7.025 7.025 0 0 1 5.228 1.57l1.115 2.788zM8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6z" />
|
||||
</svg> Sicherungsverzeichnis
|
||||
</label>
|
||||
<input type="text" class="form-control" id="backupFolder" aria-describedby="backupFolderHelp" @bind="profile.BackupFolder" />
|
||||
<div id="backupFolderHelp" class="form-text">Lokales Verzeichnis, in das die zu verarbeiteten Dateien als Sicherheitskopie geschrieben werden.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="jobType" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-folder" viewBox="0 0 16 16">
|
||||
<path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a1.99 1.99 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4H2.19zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139C1.72 3.042 1.95 3 2.19 3h5.396l-.707-.707z" />
|
||||
</svg> Unterordner nach Datum
|
||||
</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>
|
||||
</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>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="exclusionRegex" class="form-label">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-regex" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 1 1 .707.707Zm9.9-.707a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.314.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707ZM6 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm5-6.5a.5.5 0 0 0-1 0v2.117L8.257 5.57a.5.5 0 0 0-.514.858L9.528 7.5 7.743 8.571a.5.5 0 1 0 .514.858L10 8.383V10.5a.5.5 0 1 0 1 0V8.383l1.743 1.046a.5.5 0 0 0 .514-.858L11.472 7.5l1.785-1.071a.5.5 0 1 0-.514-.858L11 6.617V4.5Z" />
|
||||
</svg> Ausschlussregex
|
||||
</label>
|
||||
<textarea type="text" class="form-control" id="exclusionRegex" aria-describedby="exclusionRegexHelp" rows="3" @bind="profile.FileExcludeRegex" />
|
||||
<div id="exclusionRegexHelp" class="form-text">Liste von Regular Expressions. Wird ein Match im Dateinamen gefunden, wird die Datei <strong>nicht</strong> verarbeitet. <a href="https://regexr.com/" target="_blank">Regular Expression Editor</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group mt-3" role="group" aria-label="Basic example">
|
||||
|
||||
<a class="btn btn-secondary" href="@GetBackUrl()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" />
|
||||
</svg> Back
|
||||
</a>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-save" viewBox="0 0 16 16">
|
||||
<path d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H9.5a1 1 0 0 0-1 1v7.293l2.646-2.647a.5.5 0 0 1 .708.708l-3.5 3.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L7.5 9.293V2a2 2 0 0 1 2-2H14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h2.5a.5.5 0 0 1 0 1H2z" />
|
||||
</svg> Save
|
||||
</button>
|
||||
</div>
|
||||
</EditForm>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public int ProfileId { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<EditContext> OnValidSubmit { get; set; }
|
||||
|
||||
private ImportProfile? profile;
|
||||
private List<JobType>? jobTypes;
|
||||
private List<ObjectType>? objectTypes;
|
||||
|
||||
protected string GetBackUrl()
|
||||
{
|
||||
return ProfileId == Constants.ENTITY_ID_NEW ? "profiles/import" : $"profiles/import/{ProfileId}";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
jobTypes = await Jobs.GetJobTypes();
|
||||
objectTypes = await Jobs.GetObjectTypes();
|
||||
|
||||
if (ProfileId == Constants.ENTITY_ID_NEW)
|
||||
{
|
||||
profile = new ImportProfile() { Id = Constants.ENTITY_ID_NEW, Job = new() };
|
||||
}
|
||||
else
|
||||
{
|
||||
profile = await Import.GetProfile(ProfileId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
118
ECM.JobRunner.Web/Pages/ImportProfile/ProfileIndex.razor
Normal file
118
ECM.JobRunner.Web/Pages/ImportProfile/ProfileIndex.razor
Normal file
@@ -0,0 +1,118 @@
|
||||
@page "/profiles/import"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
@inject JobService Jobs
|
||||
@inject ImportService Import;
|
||||
|
||||
<PageTitle>Import Profiles</PageTitle>
|
||||
|
||||
<h3>Import Profiles</h3>
|
||||
|
||||
@if (filteredProfiles == null)
|
||||
{
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Profiles..</li>
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<section class="mb-3">
|
||||
<input class="form-control" placeholder="Enter a filter query and press ENTER" type="text" @bind="FilterQuery" />
|
||||
</section>
|
||||
|
||||
<div class="list-group">
|
||||
@if (filteredProfiles.Count() == 0)
|
||||
{
|
||||
<a class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
No Jobs found.
|
||||
</div>
|
||||
|
||||
</a>
|
||||
}
|
||||
|
||||
@foreach (var profile in filteredProfiles)
|
||||
{
|
||||
<a href="/profiles/import/@profile.Id" class="list-group-item list-group-item-action d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
<span>
|
||||
@if (profile.Active)
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play-circle text-success" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M6.271 5.055a.5.5 0 0 1 .52.038l3.5 2.5a.5.5 0 0 1 0 .814l-3.5 2.5A.5.5 0 0 1 6 10.5v-5a.5.5 0 0 1 .271-.445z" />
|
||||
</svg>
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-stop-circle text-danger" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M5 6.5A1.5 1.5 0 0 1 6.5 5h3A1.5 1.5 0 0 1 11 6.5v3A1.5 1.5 0 0 1 9.5 11h-3A1.5 1.5 0 0 1 5 9.5v-3z" />
|
||||
</svg>
|
||||
}
|
||||
</span>
|
||||
<span>@profile.Job.Name</span>
|
||||
</div>
|
||||
@profile.Job.Name
|
||||
</div>
|
||||
|
||||
@if (profile.Active)
|
||||
{
|
||||
<span class="badge bg-success rounded-pill">Running</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="badge bg-danger rounded-pill">Stopped</span>
|
||||
}
|
||||
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="btn-group mt-3" role="group" aria-label="Basic example">
|
||||
<a class="btn btn-primary" href="profiles/import/new">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-circle" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z" />
|
||||
</svg> New
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<ImportProfile>? profiles;
|
||||
private List<ImportProfile>? filteredProfiles;
|
||||
|
||||
private string filterQuery = "";
|
||||
private string FilterQuery {
|
||||
get { return filterQuery; }
|
||||
set {
|
||||
filterQuery = value;
|
||||
OnFilterChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected async override void OnInitialized()
|
||||
{
|
||||
profiles = await Import.GetProfiles();
|
||||
filteredProfiles = profiles;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
protected void OnFilterChanged()
|
||||
{
|
||||
if (profiles != null)
|
||||
{
|
||||
filteredProfiles = profiles.
|
||||
Where(j => j.Job.Name.Contains(FilterQuery, StringComparison.OrdinalIgnoreCase)).
|
||||
ToList();
|
||||
|
||||
} else
|
||||
{
|
||||
filteredProfiles = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
139
ECM.JobRunner.Web/Pages/ImportProfile/ShowProfile.razor
Normal file
139
ECM.JobRunner.Web/Pages/ImportProfile/ShowProfile.razor
Normal file
@@ -0,0 +1,139 @@
|
||||
@page "/profiles/import/{profileId:int}"
|
||||
@using ECM.JobRunner.Common.JobRunnerReference;
|
||||
@using ECM.JobRunner.Web.Data;
|
||||
|
||||
@inject NavigationManager Navigation;
|
||||
@inject IJSRuntime JsRuntime;
|
||||
@inject JobService Jobs;
|
||||
@inject ImportService Import;
|
||||
|
||||
<PageTitle>Profile</PageTitle>
|
||||
|
||||
@if (profile == null)
|
||||
{
|
||||
<h3>Job</h3>
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">Loading Job..</li>
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<h3>
|
||||
@if (profile.Active)
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-play-circle text-success me-1" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M6.271 5.055a.5.5 0 0 1 .52.038l3.5 2.5a.5.5 0 0 1 0 .814l-3.5 2.5A.5.5 0 0 1 6 10.5v-5a.5.5 0 0 1 .271-.445z" />
|
||||
</svg>
|
||||
}
|
||||
else
|
||||
{
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-stop-circle text-danger me-1" viewBox="0 0 16 16">
|
||||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
|
||||
<path d="M5 6.5A1.5 1.5 0 0 1 6.5 5h3A1.5 1.5 0 0 1 11 6.5v3A1.5 1.5 0 0 1 9.5 11h-3A1.5 1.5 0 0 1 5 9.5v-3z" />
|
||||
</svg>
|
||||
}
|
||||
@profile.Job.Name
|
||||
</h3>
|
||||
|
||||
<ul class="list-group mb-3">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z" />
|
||||
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
|
||||
</svg> Quellverzeichnis
|
||||
</div>
|
||||
@profile.SourceFolder
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-right" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 0-1 0v2A1.5 1.5 0 0 0 6.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-8A1.5 1.5 0 0 0 5 3.5v2a.5.5 0 0 0 1 0v-2z" />
|
||||
<path fill-rule="evenodd" d="M11.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H1.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z" />
|
||||
</svg> Zielverzeichnis
|
||||
</div>
|
||||
@profile.TargetFolder
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-hourglass" viewBox="0 0 16 16">
|
||||
<path d="M2 1.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-1v1a4.5 4.5 0 0 1-2.557 4.06c-.29.139-.443.377-.443.59v.7c0 .213.154.451.443.59A4.5 4.5 0 0 1 12.5 13v1h1a.5.5 0 0 1 0 1h-11a.5.5 0 1 1 0-1h1v-1a4.5 4.5 0 0 1 2.557-4.06c.29-.139.443-.377.443-.59v-.7c0-.213-.154-.451-.443-.59A4.5 4.5 0 0 1 3.5 3V2h-1a.5.5 0 0 1-.5-.5zm2.5.5v1a3.5 3.5 0 0 0 1.989 3.158c.533.256 1.011.791 1.011 1.491v.702c0 .7-.478 1.235-1.011 1.491A3.5 3.5 0 0 0 4.5 13v1h7v-1a3.5 3.5 0 0 0-1.989-3.158C8.978 9.586 8.5 9.052 8.5 8.351v-.702c0-.7.478-1.235 1.011-1.491A3.5 3.5 0 0 0 11.5 3V2h-7z" />
|
||||
</svg> Nächste Ausführung
|
||||
</div>
|
||||
@nextExecution
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Profilschritte</h3>
|
||||
|
||||
<ECM.JobRunner.Web.Pages.ImportStep.ListSteps Profile="profile" />
|
||||
|
||||
<div class="btn-toolbar mt-3" role="toolbar" aria-label="Toolbar with button groups">
|
||||
<div class="btn-group me-2" role="group" aria-label="First group">
|
||||
<a class="btn btn-secondary" href="profiles/import">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z" />
|
||||
</svg> Back
|
||||
</a>
|
||||
<a class="btn btn-primary" href="profiles/import/@profile.Id/edit">
|
||||
<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> Edit
|
||||
</a>
|
||||
<a class="btn btn-danger" @onclick="DeleteJob">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3" viewBox="0 0 16 16">
|
||||
<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5ZM11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H2.506a.58.58 0 0 0-.01 0H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1h-.995a.59.59 0 0 0-.01 0H11Zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5h9.916Zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47ZM8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5Z" />
|
||||
</svg> Delete
|
||||
</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</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public int ProfileId { get; set; }
|
||||
|
||||
private ImportProfile? profile;
|
||||
private DateTime nextExecution;
|
||||
|
||||
protected async override void OnInitialized()
|
||||
{
|
||||
profile = await Import.GetProfile(ProfileId);
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
nextExecution = Jobs.GetNextExecutionTime(profile.Job.CronSchedule);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected async void DeleteJob()
|
||||
{
|
||||
if (profile != null)
|
||||
{
|
||||
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
|
||||
if (confirmed)
|
||||
{
|
||||
//if (await Jobs.DeleteJob(profile) == true)
|
||||
//{
|
||||
// Navigation.NavigateTo($"/jobs");
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user