15-12-2022 ~ 2

This commit is contained in:
Jonathan Jenne
2022-12-15 15:59:38 +01:00
parent e4c5658c13
commit 63edd9e542
30 changed files with 331 additions and 214 deletions

View File

@@ -0,0 +1,40 @@
@page "/profiles/import/{profileId:int}/steps/new"
@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="-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;
// 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}");
}
}
}