update
This commit is contained in:
63
RobotApp.Client/Pages/Components/Config/RobotConfig.razor
Normal file
63
RobotApp.Client/Pages/Components/Config/RobotConfig.razor
Normal file
@@ -0,0 +1,63 @@
|
||||
<EditForm Model="@Config" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Navigation Type</label>
|
||||
<InputSelect class="form-select" @bind-Value="Config.NavigationType" TValue="NavigationType">
|
||||
@foreach (var t in NavigationTypes)
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Radius (wheel)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.RadiusWheel" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Width (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Width" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Length (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Length" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Height (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Height" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Config.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotConfigDto Config = new();
|
||||
private IEnumerable<NavigationType> NavigationTypes => Enum.GetValues(typeof(NavigationType)).Cast<NavigationType>();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Config = Model ?? new();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Config;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user