90 lines
3.8 KiB
Plaintext
90 lines
3.8 KiB
Plaintext
@using ECM.JobRunner.Common.JobRunnerReference;
|
|
@using ECM.JobRunner.Web.Data;
|
|
@inject JobService Jobs;
|
|
|
|
@if (job == null)
|
|
{
|
|
<p>Form loading..</p>
|
|
}
|
|
else
|
|
{
|
|
<EditForm Model="job" OnValidSubmit="OnValidSubmit">
|
|
<DataAnnotationsValidator />
|
|
<ValidationSummary />
|
|
|
|
<div class="mb-3">
|
|
<label for="id" class="form-label">Id</label>
|
|
<input type="email" class="form-control" id="id" aria-describedby="nameHelp" @bind="job.Id" readonly="readonly">
|
|
<div id="nameHelp" class="form-text">Die Datenbank Id des Jobs.</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="name" class="form-label">Name</label>
|
|
<input type="text" class="form-control" id="name" aria-describedby="nameHelp" @bind="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="cronExpression" class="form-label">Cron Expression</label>
|
|
<input type="text" class="form-control" id="cronExpression" @bind="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="jobType" class="form-label">Job Typ</label>
|
|
<select class="form-select" aria-label="Job type selection" id="jobType" @bind="job.TypeId">
|
|
<option selected>Auswählen..</option>
|
|
@if (types != null)
|
|
{
|
|
@foreach (JobType type in types)
|
|
{
|
|
<option value="@type.Id">@type.Name</option>
|
|
}
|
|
}
|
|
</select>
|
|
<div id="cronHelp" class="form-text">Der Typ des Jobs.</div>
|
|
</div>
|
|
|
|
<div class="mb-3 form-check">
|
|
<input type="checkbox" class="form-check-input" id="enabled" @bind="job.Active">
|
|
<label class="form-check-label" for="enabled">Aktiv</label>
|
|
</div>
|
|
|
|
<div class="btn-group mt-3" role="group" aria-label="Basic example">
|
|
<a class="btn btn-secondary" href="jobs/@job.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>
|
|
<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 JobId { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<EditContext> OnValidSubmit { get; set; }
|
|
|
|
private JobDefinition? job = new();
|
|
private List<JobType>? types;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
types = await Jobs.GetJobTypes();
|
|
|
|
if (JobId == Constants.ENTITY_ID_NEW)
|
|
{
|
|
job = new JobDefinition() { Id = Constants.ENTITY_ID_NEW };
|
|
}
|
|
else
|
|
{
|
|
job = await Jobs.GetJob(JobId);
|
|
}
|
|
}
|
|
}
|