231 lines
12 KiB
Plaintext
231 lines
12 KiB
Plaintext
@using ECM.JobRunner.Common.JobRunnerReference;
|
|
@using ECM.JobRunner.Web.Data;
|
|
@inject ImportProfileService Import;
|
|
@inject HelperService Jobs;
|
|
|
|
@if (step == null || profile == null)
|
|
{
|
|
<p>Form loading..</p>
|
|
}
|
|
else
|
|
{
|
|
<EditForm Model="step" 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="step.Active">
|
|
<label class="form-check-label" for="enabled">Aktiv</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row row-cols-1 row-cols-lg-2">
|
|
|
|
<div class="mb-3">
|
|
<label for="stepIndex" 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> Index
|
|
</label>
|
|
<select class="form-select" aria-label="Job type selection" id="stepIndex" @bind="step.IndexName">
|
|
<option selected>Auswählen..</option>
|
|
@if (profile.ObjectType.Indexes != null)
|
|
{
|
|
@foreach (string index in profile.ObjectType.Indexes)
|
|
{
|
|
<option value="@index">@index</option>
|
|
}
|
|
}
|
|
</select>
|
|
<div id="stepIndexHelp" class="form-text">Der Windream Index, in den das Ergebnis des Schritte geschrieben wird</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="stepScope" class="form-label">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-braces" viewBox="0 0 16 16">
|
|
<path d="M2.114 8.063V7.9c1.005-.102 1.497-.615 1.497-1.6V4.503c0-1.094.39-1.538 1.354-1.538h.273V2h-.376C3.25 2 2.49 2.759 2.49 4.352v1.524c0 1.094-.376 1.456-1.49 1.456v1.299c1.114 0 1.49.362 1.49 1.456v1.524c0 1.593.759 2.352 2.372 2.352h.376v-.964h-.273c-.964 0-1.354-.444-1.354-1.538V9.663c0-.984-.492-1.497-1.497-1.6zM13.886 7.9v.163c-1.005.103-1.497.616-1.497 1.6v1.798c0 1.094-.39 1.538-1.354 1.538h-.273v.964h.376c1.613 0 2.372-.759 2.372-2.352v-1.524c0-1.094.376-1.456 1.49-1.456V7.332c-1.114 0-1.49-.362-1.49-1.456V4.352C13.51 2.759 12.75 2 11.138 2h-.376v.964h.273c.964 0 1.354.444 1.354 1.538V6.3c0 .984.492 1.497 1.497 1.6z" />
|
|
</svg> Basis
|
|
</label>
|
|
<select class="form-select" aria-label="Job type selection" id="stepScope" @bind="step.Scope">
|
|
<option selected value="">Basis auswählen..</option>
|
|
<option value="FILE">Dateiname</option>
|
|
<option value="FOLDER">Ordnerpfad</option>
|
|
</select>
|
|
<div id="stepScopeHelp" class="form-text">Basiswert, auf den die Funktion angewendet wird.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="stepMethod" class="form-label">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear-fill" viewBox="0 0 16 16">
|
|
<path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" />
|
|
</svg> Funktion
|
|
</label>
|
|
<select class="form-select" aria-label="Job type selection" id="stepMethod" value="@step.Method" @onchange="OnMethodChange">
|
|
<option selected value="">Methode auswählen..</option>
|
|
<option value="SUBSTRING">Substring</option>
|
|
<option value="REGEX">Regular Expression</option>
|
|
<option value="VALUE">Statischer Wert</option>
|
|
<option value="ALL">Unverändert lassen</option>
|
|
</select>
|
|
<div id="stepMethodHelp" class="form-text">Funktion, die auf den Wert angewendet wird.</div>
|
|
</div>
|
|
|
|
@if (arg1 != null)
|
|
{
|
|
<div class="mb-3">
|
|
<label for="Argument1" class="form-label">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-1-circle" viewBox="0 0 16 16">
|
|
<path d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8Zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM9.283 4.002V12H7.971V5.338h-.065L6.072 6.656V5.385l1.899-1.383h1.312Z" />
|
|
</svg> @arg1.name
|
|
</label>
|
|
<input type="text" class="form-control" id="Argument1" aria-describedby="Argument1Help" @bind="step.Argument1" />
|
|
<div id="Argument1Help" class="form-text">@arg1.helpText</div>
|
|
</div>
|
|
}
|
|
|
|
@if (arg2 != null)
|
|
{
|
|
<div class="mb-3">
|
|
<label for="Argument2" class="form-label">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-2-circle" viewBox="0 0 16 16">
|
|
<path d="M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8Zm15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM6.646 6.24v.07H5.375v-.064c0-1.213.879-2.402 2.637-2.402 1.582 0 2.613.949 2.613 2.215 0 1.002-.6 1.667-1.287 2.43l-.096.107-1.974 2.22v.077h3.498V12H5.422v-.832l2.97-3.293c.434-.475.903-1.008.903-1.705 0-.744-.557-1.236-1.313-1.236-.843 0-1.336.615-1.336 1.306Z" />
|
|
</svg> @arg2.name
|
|
</label>
|
|
<input type="text" class="form-control" id="Argument2" aria-describedby="Argument2Help" @bind="step.Argument2" />
|
|
<div id="Argument2Help" class="form-text">@arg2.helpText</div>
|
|
</div>
|
|
}
|
|
|
|
@if (arg3 != null)
|
|
{
|
|
<div class="mb-3">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-3-circle" viewBox="0 0 16 16">
|
|
<path d="M7.918 8.414h-.879V7.342h.838c.78 0 1.348-.522 1.342-1.237 0-.709-.563-1.195-1.348-1.195-.79 0-1.312.498-1.348 1.055H5.275c.036-1.137.95-2.115 2.625-2.121 1.594-.012 2.608.885 2.637 2.062.023 1.137-.885 1.776-1.482 1.875v.07c.703.07 1.71.64 1.734 1.917.024 1.459-1.277 2.396-2.93 2.396-1.705 0-2.707-.967-2.754-2.144H6.33c.059.597.68 1.06 1.541 1.066.973.006 1.6-.563 1.588-1.354-.006-.779-.621-1.318-1.541-1.318Z" />
|
|
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8Z" />
|
|
</svg> @arg3.name
|
|
<input type="text" class="form-control" id="Argument3" aria-describedby="Argument3Help" @bind="step.Argument3" />
|
|
<div id="Argument3Help" class="form-text">@arg3.helpText</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 int StepId { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<EditContext> OnValidSubmit { get; set; }
|
|
|
|
private ImportProfileStep? step;
|
|
private ImportProfile? profile;
|
|
|
|
private StepArgument? arg1 = null;
|
|
private StepArgument? arg2 = null;
|
|
private StepArgument? arg3 = null;
|
|
|
|
protected string GetBackUrl()
|
|
{
|
|
return StepId < 0 ? $"/profiles/import/{ProfileId}/steps" : $"/profiles/import/{ProfileId}/steps/{StepId}";
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
profile = await Import.GetProfile(ProfileId);
|
|
|
|
if (profile == null)
|
|
return;
|
|
|
|
if (StepId == Constants.ENTITY_ID_NEW)
|
|
{
|
|
step = new ImportProfileStep() { Id = Constants.ENTITY_ID_NEW, ProfileId = ProfileId };
|
|
}
|
|
else
|
|
{
|
|
step = profile.Steps.Where(s => s.Id == StepId).SingleOrDefault();
|
|
|
|
if (step != null)
|
|
{
|
|
SetMethodArgs(step.Method);
|
|
|
|
}
|
|
}
|
|
StateHasChanged();
|
|
}
|
|
|
|
protected void OnMethodChange(ChangeEventArgs e)
|
|
{
|
|
if (step == null || e.Value == null)
|
|
return;
|
|
|
|
step.Method = e.Value.ToString();
|
|
|
|
if (step.Method != null)
|
|
{
|
|
SetMethodArgs(step.Method);
|
|
}
|
|
}
|
|
|
|
protected void SetMethodArgs(string method)
|
|
{
|
|
switch (method)
|
|
{
|
|
case "SUBSTRING":
|
|
arg1 = new StepArgument() { name = "Index", helpText = "Index" };
|
|
arg2 = new StepArgument() { name = "Length", helpText = "Length" };
|
|
arg3 = null;
|
|
break;
|
|
|
|
case "REGEX":
|
|
arg1 = new StepArgument() { name = "Regex", helpText = "Regex" };
|
|
arg2 = new StepArgument() { name = "Match Value", helpText = "Match Value" };
|
|
arg3 = new StepArgument() { name = "Not Match Value", helpText = "Not Match Value" };
|
|
break;
|
|
|
|
case "VALUE":
|
|
arg1 = new StepArgument() { name = "Value", helpText = "Value" };
|
|
arg2 = null;
|
|
arg3 = null;
|
|
break;
|
|
|
|
default:
|
|
arg1 = null;
|
|
arg2 = null;
|
|
arg3 = null;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
class StepArgument
|
|
{
|
|
public string name = "";
|
|
public string helpText = "";
|
|
}
|
|
|
|
}
|
|
|