43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
@page "/profiles/import/{profileId:int}/steps/new"
|
|
@using ECM.JobRunner.Common.JobRunnerReference;
|
|
@using ECM.JobRunner.Web.Data;
|
|
@inject NavigationManager Navigation;
|
|
@inject ImportProfileService Profile;
|
|
|
|
<PageTitle>Neuen Schritt erstellen</PageTitle>
|
|
|
|
<h3>Neuen Schritt erstellen</h3>
|
|
|
|
<StepForm ProfileId="ProfileId" StepId="-1" 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;
|
|
|
|
if (profile == null)
|
|
return;
|
|
|
|
// TODO: This is ugly and manual and needs to be abstracted.
|
|
var steps = profile.Steps.ToList();
|
|
steps.Add(step);
|
|
|
|
profile.Steps = steps.ToArray();
|
|
|
|
bool result = await Profile.UpdateProfile(profile);
|
|
|
|
if (result == true)
|
|
{
|
|
Navigation.NavigateTo($"/profiles/import/{profile.Id}");
|
|
}
|
|
}
|
|
} |