15-12-2022

This commit is contained in:
Jonathan Jenne
2022-12-15 11:53:59 +01:00
parent 8d6d81f488
commit e4c5658c13
31 changed files with 1020 additions and 274 deletions

View File

@@ -1,6 +1,7 @@
@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;
@@ -14,6 +15,9 @@
[Parameter]
public int ProfileId { get; set; }
[Parameter]
public int StepId { get; set; }
private async void OnFormSubmit(EditContext ctx)
{
ImportProfile profile = (ImportProfile)ctx.Model;

View File

@@ -8,10 +8,10 @@
<h3>Job erstellen</h3>
<ProfileForm JobId="JobId" OnValidSubmit="OnFormSubmit" />
<ProfileForm ProfileId="ProfileId" OnValidSubmit="OnFormSubmit" />
@code {
public int JobId = -1;
public int ProfileId = -1;
private async void OnFormSubmit(EditContext ctx)
{

View File

@@ -125,8 +125,6 @@ else
<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">
@@ -203,7 +201,7 @@ else
if (ProfileId == Constants.ENTITY_ID_NEW)
{
profile = new ImportProfile() { Id = Constants.ENTITY_ID_NEW };
profile = new ImportProfile() { Id = Constants.ENTITY_ID_NEW, Job = new() };
}
else
{

View File

@@ -72,27 +72,33 @@ else
</li>
</ul>
<h3>Verarbeitungsschritte</h3>
<h3>Profilschritte</h3>
<ECM.JobRunner.Web.Pages.ImportStep.List Profile="profile" />
<ECM.JobRunner.Web.Pages.ImportStep.ListSteps Profile="profile" />
<div class="btn-group mt-3" role="group" aria-label="Basic example">
<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 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>
}

View File

@@ -0,0 +1,38 @@
@page "/profiles/import/{profileId:int}/steps/{stepId:int}/edit"
@using ECM.JobRunner.Common.JobRunnerReference;
@using ECM.JobRunner.Web.Data;
@inject NavigationManager Navigation;
@inject ImportService Profile;
<PageTitle>Schritt bearbeiten</PageTitle>
<h3>Schritt bearbeiten</h3>
<StepForm ProfileId="ProfileId" StepId="StepId" OnValidSubmit="OnFormSubmit" />
@code {
[Parameter]
public int ProfileId { get; set; }
[Parameter]
public int StepId { get; set; }
public ImportProfile? profile;
private async void OnFormSubmit(EditContext ctx)
{
ImportProfile profile = await Profile.GetProfile(ProfileId);
ImportProfileStep step = (ImportProfileStep)ctx.Model;
// TODO: This is ugly and manual and needs to be abstracted.
var index = profile.Steps.ToList().FindIndex(s => s.Id == StepId);
profile.Steps[index] = step;
bool result = await Profile.UpdateProfile(profile);
if (result == true)
{
Navigation.NavigateTo($"/profiles/import/{profile.Id}");
}
}
}

View File

@@ -24,7 +24,7 @@ else
@foreach (var step in Profile.Steps)
{
<a href="#" class="list-group-item list-group-item-action d-flex justify-content-between align-items-start">
<a href="profiles/import/@Profile.Id/steps/@step.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>

View File

@@ -0,0 +1,178 @@
@page "/profiles/import/{profileId:int}/steps/{stepId:int}"
@using ECM.JobRunner.Common.JobRunnerReference;
@using ECM.JobRunner.Web.Data;
@inject NavigationManager Navigation;
@inject IJSRuntime JsRuntime;
@inject JobService Jobs;
@inject ImportService Import;
<PageTitle>Profilschritt</PageTitle>
@if (profile == null)
{
<h3>Job</h3>
<ul class="list-group">
<li class="list-group-item">Loading Job..</li>
</ul>
}
else
{
@if (step != null)
{
<h3>
@if (profile.Active)
{
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-bar-chart-steps text-success" viewBox="0 0 16 16">
<path d="M.5 0a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-1 0V.5A.5.5 0 0 1 .5 0zM2 1.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-4a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-1z" />
</svg>
}
else
{
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-bar-chart-steps text-danger" viewBox="0 0 16 16">
<path d="M.5 0a.5.5 0 0 1 .5.5v15a.5.5 0 0 1-1 0V.5A.5.5 0 0 1 .5 0zM2 1.5a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-4a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-6a.5.5 0 0 1-.5-.5v-1zm2 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-1z" />
</svg>
}
Schritt
</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-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> Index
</div>
@step.IndexName
</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-gear" viewBox="0 0 16 16">
<path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z" />
<path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z" />
</svg> Methode
</div>
@step.Method
</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-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
</svg> Scope
</div>
@step.Scope
</div>
</li>
</ul>
<ul class="list-group mb-3">
@if (!String.IsNullOrEmpty(step.Argument1))
{
<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-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
</svg> Argument1
</div>
@step.Argument1
</div>
</li>
}
@if (!String.IsNullOrEmpty(step.Argument2))
{
<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-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
</svg> Argument2
</div>
@step.Argument2
</div>
</li>
}
@if (!String.IsNullOrEmpty(step.Argument3))
{
<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-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
</svg> Argument3
</div>
@step.Argument3
</div>
</li>
}
</ul>
<div class="btn-group mt-3" role="group" aria-label="Basic example">
<a class="btn btn-secondary" href="profiles/import/@profile.Id">
<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/steps/@step.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>
}
}
@code {
[Parameter]
public int ProfileId { get; set; }
[Parameter]
public int StepId { get; set; }
private ImportProfile? profile;
private ImportProfileStep? step;
private DateTime nextExecution;
protected async override void OnInitialized()
{
profile = await Import.GetProfile(ProfileId);
if (profile != null)
{
step = profile.Steps.Where(s => s.Id == StepId).SingleOrDefault();
StateHasChanged();
}
}
protected async void DeleteJob()
{
if (profile != null)
{
bool confirmed = await JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?");
if (confirmed)
{
var steps = profile.Steps.Where(s => s.Id != StepId).ToArray();
profile.Steps = steps;
if (await Import.UpdateProfile(profile) == true)
{
Navigation.NavigateTo($"/profiles/import/{ProfileId}");
};
}
}
}
}

View File

@@ -0,0 +1,225 @@
@using ECM.JobRunner.Common.JobRunnerReference;
@using ECM.JobRunner.Web.Data;
@inject ImportService Import;
@inject JobService 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 $"/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 };
}
else
{
step = profile.Steps.Where(s => s.Id == StepId).SingleOrDefault();
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;
}
}