update
This commit is contained in:
@@ -1,44 +1,64 @@
|
||||
<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>
|
||||
@implements IDisposable
|
||||
|
||||
<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 ="d-flex w-100 h-100 flex-column">
|
||||
<EditForm EditContext="EditContext">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<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 class="mb-2">
|
||||
<label class="form-label">Navigation Type</label>
|
||||
<InputSelect class="form-select" @bind-Value="Model.NavigationType" TValue="NavigationType">
|
||||
@foreach (var t in NavigationTypes)
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</InputSelect>
|
||||
<ValidationMessage For="@(() => Model.NavigationType)" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Height (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Config.Height" />
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Radius (wheel)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.RadiusWheel" />
|
||||
<ValidationMessage For="@(() => Model.RadiusWheel)" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Width (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.Width" />
|
||||
<ValidationMessage For="@(() => Model.Width)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Config.Description" />
|
||||
</div>
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Length (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.Length" />
|
||||
<ValidationMessage For="@(() => Model.Length)" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Height (m)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.Height" />
|
||||
<ValidationMessage For="@(() => Model.Height)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Model.Description" />
|
||||
<ValidationMessage For="@(() => Model.Description)" />
|
||||
</div>
|
||||
</EditForm>
|
||||
<div class="flex-grow-1" />
|
||||
<div>
|
||||
@if (Model.CreatedAt != default || Model.UpdatedAt != default)
|
||||
{
|
||||
<div class="d-flex justify-content-end mt-2">
|
||||
<small class="text-muted">Created: @Model.CreatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
<small class="text-muted ms-3">Updated: @Model.UpdatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
@@ -47,17 +67,26 @@
|
||||
[Parameter]
|
||||
public EventCallback<RobotConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotConfigDto Config = new();
|
||||
private EditContext? EditContext;
|
||||
private IEnumerable<NavigationType> NavigationTypes => Enum.GetValues(typeof(NavigationType)).Cast<NavigationType>();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Config = Model ?? new();
|
||||
if (EditContext is null || !EditContext.Model!.Equals(Model))
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
EditContext = new EditContext(Model);
|
||||
EditContext.OnFieldChanged += EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
private void EditContext_OnFieldChanged(object? sender, FieldChangedEventArgs e)
|
||||
{
|
||||
Model = Config;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
_ = ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,47 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
@implements IDisposable
|
||||
<div class="d-flex w-100 h-100 flex-column">
|
||||
<EditForm EditContext="EditContext">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">PLC Address</label>
|
||||
<InputText class="form-control" @bind-Value="Local.PLCAddress" />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">PLC Address</label>
|
||||
<InputText class="form-control" @bind-Value="Model.PLCAddress" />
|
||||
<ValidationMessage For="@(() => Model.PLCAddress)" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.PLCPort" />
|
||||
<ValidationMessage For="@(() => Model.PLCPort)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.PLCPort" />
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Unit Id</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.PLCUnitId" />
|
||||
<ValidationMessage For="@(() => Model.PLCUnitId)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Unit Id</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.PLCUnitId" />
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Model.Description" />
|
||||
<ValidationMessage For="@(() => Model.Description)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</EditForm>
|
||||
<div class="flex-grow-1" />
|
||||
<div>
|
||||
@if (Model.CreatedAt != default || Model.UpdatedAt != default)
|
||||
{
|
||||
<div class="d-flex justify-content-end mt-2">
|
||||
<small class="text-muted">Created: @Model.CreatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
<small class="text-muted ms-3">Updated: @Model.UpdatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
@@ -35,16 +50,25 @@
|
||||
[Parameter]
|
||||
public EventCallback<RobotPlcConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotPlcConfigDto Local = new();
|
||||
private EditContext? EditContext;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Local = Model is not null ? Model with { } : new RobotPlcConfigDto();
|
||||
if (EditContext is null || !EditContext.Model!.Equals(Model))
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
EditContext = new EditContext(Model);
|
||||
EditContext.OnFieldChanged += EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
private void EditContext_OnFieldChanged(object? sender, FieldChangedEventArgs e)
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
_ = ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,70 @@
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Very Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedVerySlow" />
|
||||
@implements IDisposable
|
||||
<div class="d-flex w-100 h-100 flex-column">
|
||||
<EditForm EditContext="EditContext">
|
||||
<DataAnnotationsValidator />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Very Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedVerySlow" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedVerySlow)" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedSlow" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedSlow)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Slow (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedSlow" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Normal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedNormal" />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Normal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedNormal" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedNormal)" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Medium (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedMedium" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedMedium)" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Medium (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedMedium" />
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Optimal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedOptimal" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedOptimal)" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedFast" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedFast)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-6">
|
||||
<label class="form-label">Optimal (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedOptimal" />
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Very Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Model.SafetySpeedVeryFast" />
|
||||
<ValidationMessage For="@(() => Model.SafetySpeedVeryFast)" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedFast" />
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Model.Description" />
|
||||
<ValidationMessage For="@(() => Model.Description)" />
|
||||
</div>
|
||||
</EditForm>
|
||||
<div class="flex-grow-1" />
|
||||
<div>
|
||||
@if (Model.CreatedAt != default || Model.UpdatedAt != default)
|
||||
{
|
||||
<div class="d-flex justify-content-end mt-2">
|
||||
<small class="text-muted">Created: @Model.CreatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
<small class="text-muted ms-3">Updated: @Model.UpdatedAt.ToString("dd/MM/yyyy HH:mm:ss")</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Very Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedVeryFast" />
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
@@ -53,17 +73,25 @@
|
||||
[Parameter]
|
||||
public EventCallback<RobotSafetyConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSafetyConfigDto Local = new();
|
||||
private EditContext? EditContext;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// Work on a shallow copy (record) so parent instance isn't mutated until submit
|
||||
Local = Model is not null ? Model with { } : new RobotSafetyConfigDto();
|
||||
if (EditContext is null || !EditContext.Model!.Equals(Model))
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
EditContext = new EditContext(Model);
|
||||
EditContext.OnFieldChanged += EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
private void EditContext_OnFieldChanged(object? sender, FieldChangedEventArgs e)
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
_ = ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (EditContext is not null) EditContext.OnFieldChanged -= EditContext_OnFieldChanged;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
@implements IDisposable
|
||||
@implements IDisposable
|
||||
|
||||
<div class="d-flex w-100 h-100 flex-column">
|
||||
<EditForm EditContext="EditContext">
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
<div class="d-flex w-100 h-100 flex-column">
|
||||
<EditForm EditContext="EditContext">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="serialNumber">Serial Number</label>
|
||||
<InputText id="serialNumber" class="form-control" @bind-Value="Model.SerialNumber" />
|
||||
<ValidationMessage For="@(() => Model.SerialNumber)" />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="serialNumber">Serial Number</label>
|
||||
<InputText id="serialNumber" class="form-control" @bind-Value="Model.SerialNumber" />
|
||||
<ValidationMessage For="@(() => Model.SerialNumber)" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label" for="prefix">Topic Prefix</label>
|
||||
<InputText id="prefix" class="form-control" @bind-Value="Model.VDA5050TopicPrefix"/>
|
||||
<ValidationMessage For="@(() => Model.VDA5050TopicPrefix)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
|
||||
@@ -201,6 +201,7 @@ public partial class RobotConfigManager
|
||||
template.VDA5050Password,
|
||||
template.VDA5050Manufacturer,
|
||||
template.VDA5050Version,
|
||||
template.VDA5050TopicPrefix,
|
||||
template.VDA5050PublishRepeat,
|
||||
template.VDA5050EnablePassword,
|
||||
template.VDA5050EnableTls
|
||||
@@ -373,6 +374,7 @@ public partial class RobotConfigManager
|
||||
SelectedVda.VDA5050Password,
|
||||
SelectedVda.VDA5050Manufacturer,
|
||||
SelectedVda.VDA5050Version,
|
||||
SelectedVda.VDA5050TopicPrefix,
|
||||
SelectedVda.VDA5050PublishRepeat,
|
||||
SelectedVda.VDA5050EnablePassword,
|
||||
SelectedVda.VDA5050EnableTls,
|
||||
|
||||
Reference in New Issue
Block a user