update
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
public NavModel[] Navs = [
|
||||
new(){Icon = "mdi-view-dashboard", Path="/", Label = "Dashboard", Match = NavLinkMatch.All},
|
||||
new(){Icon = "mdi-map-legend", Path="/maps-manager", Label = "Mapping", Match = NavLinkMatch.All},
|
||||
new(){Icon = "mdi-application-cog", Path="/robot-config", Label = "Config", Match = NavLinkMatch.All},
|
||||
];
|
||||
|
||||
private bool collapseNavMenu = true;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
50
RobotApp.Client/Pages/Components/Config/RobotPLCConfig.razor
Normal file
50
RobotApp.Client/Pages/Components/Config/RobotPLCConfig.razor
Normal file
@@ -0,0 +1,50 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
<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>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.PLCPort" />
|
||||
</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>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotPlcConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotPlcConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotPlcConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Local = Model is not null ? Model with { } : new RobotPlcConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<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" />
|
||||
</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>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Medium (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedMedium" />
|
||||
</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>
|
||||
<div class="col-6">
|
||||
<label class="form-label">Fast (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SafetySpeedFast" />
|
||||
</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]
|
||||
public RobotSafetyConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotSafetyConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSafetyConfigDto Local = new();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.EnableSimulation" />
|
||||
<label class="form-check-label">Enable Simulation</label>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Velocity (m/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxVelocity" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Max Angular Velocity (rad/s)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationMaxAngularVelocity" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Acceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationAcceleration" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Deceleration (m/s²)</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.SimulationDeceleration" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotSimulationConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotSimulationConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotSimulationConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
// Use record 'with' to create a shallow copy so parent isn't mutated until submit
|
||||
Local = Model is not null ? Model with { } : new RobotSimulationConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<EditForm Model="@Local" OnValidSubmit="OnSubmit">
|
||||
<DataAnnotationsValidator />
|
||||
<ValidationSummary />
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Serial Number</label>
|
||||
<InputText class="form-control" @bind-Value="Local.SerialNumber" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Manufacturer</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Manufacturer" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Host</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050HostServer" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Port</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.VDA5050Port" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Publish Repeat</label>
|
||||
<InputNumber class="form-control" @bind-Value="Local.VDA5050PublishRepeat" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row g-2 mb-2">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Username</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050UserName" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Password</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Password" type="password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Version</label>
|
||||
<InputText class="form-control" @bind-Value="Local.VDA5050Version" />
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.VDA5050EnablePassword" />
|
||||
<label class="form-check-label">Enable Password</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-2">
|
||||
<InputCheckbox class="form-check-input" @bind-Value="Local.VDA5050EnableTls" />
|
||||
<label class="form-check-label">Enable TLS</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Description</label>
|
||||
<InputTextArea class="form-control" @bind-Value="Local.Description" />
|
||||
</div>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RobotVDA5050ConfigDto Model { get; set; } = new();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<RobotVDA5050ConfigDto> ModelChanged { get; set; }
|
||||
|
||||
private RobotVDA5050ConfigDto Local = new();
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Local = Model is not null ? Model with { } : new RobotVDA5050ConfigDto();
|
||||
}
|
||||
|
||||
private async Task OnSubmit()
|
||||
{
|
||||
Model = Local;
|
||||
await ModelChanged.InvokeAsync(Model);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,60 @@
|
||||
<div class="view">
|
||||
<h4>Infomations</h4>
|
||||
<h4 class="info-title">Informations</h4>
|
||||
|
||||
<div class="info-grid">
|
||||
<div class="info-col">
|
||||
<dl class="info-list">
|
||||
<dt class="info-term">X (m)</dt>
|
||||
<dd class="info-desc">@Localization.X.ToString("F3")</dd>
|
||||
|
||||
<dt class="info-term">Y (m)</dt>
|
||||
<dd class="info-desc">@Localization.Y.ToString("F3")</dd>
|
||||
|
||||
<dt class="info-term">Theta (rad)</dt>
|
||||
<dd class="info-desc">@Localization.Theta.ToString("F4")</dd>
|
||||
|
||||
<dt class="info-term">Theta (deg)</dt>
|
||||
<dd class="info-desc">@($"{Localization.Theta * 180.0 / Math.PI:F2}°")</dd>
|
||||
|
||||
<dt class="info-term">Ready</dt>
|
||||
<dd class="info-desc">@((Localization.IsReady) ? "Yes" : "No")</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="info-col">
|
||||
<dl class="info-list">
|
||||
<dt class="info-term">SlamState</dt>
|
||||
<dd class="info-desc">@Localization.SlamState</dd>
|
||||
|
||||
<dt class="info-term">SlamDetail</dt>
|
||||
<dd class="info-desc text-truncate" title="@Localization.SlamStateDetail">@Localization.SlamStateDetail</dd>
|
||||
|
||||
<dt class="info-term">Active Map</dt>
|
||||
<dd class="info-desc text-truncate" title="@Localization.CurrentActiveMap">@Localization.CurrentActiveMap</dd>
|
||||
|
||||
<dt class="info-term">Reliability</dt>
|
||||
<dd class="info-desc">@($"{Localization.Reliability:F1}%")</dd>
|
||||
|
||||
<dt class="info-term">MatchingScore</dt>
|
||||
<dd class="info-desc">@($"{Localization.MatchingScore:F1}%")</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private class LocalizationDto
|
||||
{
|
||||
public bool IsReady { get; set; }
|
||||
public double X { get; set; }
|
||||
public double Y { get; set; }
|
||||
public double Theta { get; set; }
|
||||
public string SlamState { get; set; } = "Localization";
|
||||
public string SlamStateDetail { get; set; } = "/r/n";
|
||||
public string CurrentActiveMap { get; set; } = "Localization";
|
||||
public double Reliability { get; set; }
|
||||
public double MatchingScore { get; set; }
|
||||
}
|
||||
|
||||
private LocalizationDto Localization = new();
|
||||
}
|
||||
|
||||
@@ -5,9 +5,117 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
background-color: var(--mud-palette-surface);
|
||||
border-radius: var(--mud-default-borderradius);
|
||||
background-color: var(--mud-palette-surface, #ffffff);
|
||||
border-radius: var(--mud-default-borderradius, 8px);
|
||||
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
box-shadow: var(--mud-elevation-10);
|
||||
padding: 15px;
|
||||
box-shadow: var(--mud-elevation-10, 0 4px 12px rgba(0,0,0,0.08));
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.view::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 6px;
|
||||
border-top-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
background: linear-gradient(180deg, var(--mud-palette-primary, #1976d2), rgba(25,118,210,0.7));
|
||||
}
|
||||
|
||||
.info-title {
|
||||
margin: 0 0 10px 12px;
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: var(--mud-palette-primary, #1976d2);
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: flex-start;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
.info-col {
|
||||
flex: 1 1 50%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.info-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.info-list dt,
|
||||
.info-list dd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.info-term {
|
||||
width: 42%;
|
||||
text-align: right;
|
||||
padding-right: 12px;
|
||||
color: var(--mud-palette-text-secondary, rgba(0,0,0,0.6));
|
||||
font-weight: 600;
|
||||
box-sizing: border-box;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.info-desc {
|
||||
width: 58%;
|
||||
text-align: left;
|
||||
font-weight: 700;
|
||||
color: var(--mud-palette-text-primary, rgba(0,0,0,0.85));
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.text-truncate {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.info-list dt + dd {
|
||||
border-bottom: 1px dashed rgba(0,0,0,0.03);
|
||||
}
|
||||
|
||||
.ready-yes {
|
||||
color: var(--mud-palette-success, #2e7d32);
|
||||
}
|
||||
|
||||
.ready-no {
|
||||
color: var(--mud-palette-error, #d32f2f);
|
||||
}
|
||||
|
||||
.percent {
|
||||
color: var(--mud-palette-primary, #1976d2);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.info-grid {
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.info-term {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.info-desc {
|
||||
width: 55%;
|
||||
}
|
||||
}
|
||||
|
||||
208
RobotApp.Client/Pages/RobotConfigManager.razor
Normal file
208
RobotApp.Client/Pages/RobotConfigManager.razor
Normal file
@@ -0,0 +1,208 @@
|
||||
@page "/robot-config"
|
||||
@rendermode InteractiveWebAssemblyNoPrerender
|
||||
@attribute [Authorize]
|
||||
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
@using RobotApp.Common.Shares.Enums
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Robot Configuration</PageTitle>
|
||||
|
||||
<div class="d-flex w-100 h-100 p-2 overflow-hidden flex-column">
|
||||
<div class="rcm-toolbar">
|
||||
<div class="rcm-toolbar-left">
|
||||
<label class="rcm-label" for="configType">Config Type</label>
|
||||
<div class="rcm-select-wrapper">
|
||||
<select id="configType" class="form-select rcm-select" @bind="SelectedType">
|
||||
@foreach (var type in Enum.GetValues<RobotConfigType>())
|
||||
{
|
||||
<option value="@type">@type</option>
|
||||
}
|
||||
</select>
|
||||
<span class="rcm-select-icon" aria-hidden="true">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path d="M7 10l5 5 5-5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rcm-toolbar-right">
|
||||
<div class="rcm-action-group">
|
||||
<button type="button" class="btn rcm-icon-btn" data-tooltip="Add config" aria-label="Add">
|
||||
<i class="mdi mdi-plus" aria-hidden="true"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn rcm-icon-btn" data-tooltip="Update config" aria-label="Update">
|
||||
<i class="mdi mdi-content-save" aria-hidden="true"></i>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn rcm-icon-btn rcm-danger" data-tooltip="Delete config" aria-label="Delete">
|
||||
<i class="mdi mdi-delete" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content rcm-content flex-grow-1 d-flex gap-3 mt-3">
|
||||
<div class="card p-2 config-list rcm-config-list">
|
||||
<div class="card-body list-body p-0">
|
||||
@switch (SelectedType)
|
||||
{
|
||||
case RobotConfigType.VDA5050:
|
||||
@RenderList(VdaConfigs, () => SelectVda)
|
||||
break;
|
||||
case RobotConfigType.Safety:
|
||||
@RenderList(SafetyConfigs, () => SelectSafety)
|
||||
break;
|
||||
case RobotConfigType.Simulation:
|
||||
@RenderList(SimulationConfigs, () => SelectSimulation)
|
||||
break;
|
||||
case RobotConfigType.PLC:
|
||||
@RenderList(PlcConfigs, () => SelectPlc)
|
||||
break;
|
||||
case RobotConfigType.Core:
|
||||
@RenderList(CoreConfigs, () => SelectCore)
|
||||
break;
|
||||
default:
|
||||
<div class="p-2">No configs.</div>
|
||||
break;
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card p-2 config-content rcm-config-content">
|
||||
<div class="card-body">
|
||||
@if (!HasSelection)
|
||||
{
|
||||
<div class="text-muted">Select a config from the list or click Add to create one.</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@switch (SelectedType)
|
||||
{
|
||||
case RobotConfigType.VDA5050:
|
||||
<RobotApp.Client.Pages.Components.Config.RobotVDA5050Config @bind-Model="SelectedVda" />
|
||||
break;
|
||||
case RobotConfigType.Safety:
|
||||
<RobotApp.Client.Pages.Components.Config.RobotSafetyConfig @bind-Model="SelectedSafety" />
|
||||
break;
|
||||
case RobotConfigType.Simulation:
|
||||
<RobotApp.Client.Pages.Components.Config.RobotSimulationConfig @bind-Model="SelectedSimulation" />
|
||||
break;
|
||||
case RobotConfigType.PLC:
|
||||
<RobotApp.Client.Pages.Components.Config.RobotPLCConfig @bind-Model="SelectedPlc" />
|
||||
break;
|
||||
case RobotConfigType.Core:
|
||||
<RobotApp.Client.Pages.Components.Config.RobotConfig @bind-Model="SelectedCore" />
|
||||
break;
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<RobotVDA5050ConfigDto> VdaConfigs { get; } = [];
|
||||
private List<RobotSafetyConfigDto> SafetyConfigs { get; } = [];
|
||||
private List<RobotSimulationConfigDto> SimulationConfigs { get; } = [];
|
||||
private List<RobotPlcConfigDto> PlcConfigs { get; } = [];
|
||||
private List<RobotConfigDto> CoreConfigs { get; } = [];
|
||||
|
||||
private RobotVDA5050ConfigDto? SelectedVda { get; set; }
|
||||
private RobotSafetyConfigDto? SelectedSafety { get; set; }
|
||||
private RobotSimulationConfigDto? SelectedSimulation { get; set; }
|
||||
private RobotPlcConfigDto? SelectedPlc { get; set; }
|
||||
private RobotConfigDto? SelectedCore { get; set; }
|
||||
|
||||
private RobotConfigType SelectedType { get; set; } = RobotConfigType.VDA5050;
|
||||
|
||||
private int SelectedIndex { get; set; } = -1;
|
||||
|
||||
private bool HasSelection => SelectedIndex >= 0;
|
||||
|
||||
RenderFragment RenderList<T>(List<T> list, Func<Action<int>> selectFactory) where T : class
|
||||
{
|
||||
return builder =>
|
||||
{
|
||||
if (list is null || !list.Any())
|
||||
{
|
||||
builder.OpenElement(0, "div");
|
||||
builder.AddAttribute(1, "class", "p-2 text-muted");
|
||||
builder.AddContent(2, "No configs found.");
|
||||
builder.CloseElement();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.OpenElement(3, "ul");
|
||||
builder.AddAttribute(4, "class", "list-group list-group-flush");
|
||||
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var idx = i;
|
||||
builder.OpenElement(10 + i * 5, "li");
|
||||
builder.AddAttribute(11 + i * 5, "class", $"list-group-item {(SelectedIndex==idx ? "active" : "")}");
|
||||
builder.AddAttribute(12 + i * 5, "style", "cursor:pointer;padding:0.75rem 1rem;");
|
||||
builder.AddAttribute(13 + i * 5, "onclick", EventCallback.Factory.Create(this, () => selectFactory()(idx)));
|
||||
|
||||
// Only show ConfigName
|
||||
var nameProp = item.GetType().GetProperty("ConfigName");
|
||||
var name = nameProp?.GetValue(item)?.ToString() ?? "Unnamed";
|
||||
builder.AddContent(14 + i * 5, name);
|
||||
|
||||
// Show active badge at end if IsActive == true
|
||||
var isActiveProp = item.GetType().GetProperty("IsActive");
|
||||
var isActive = isActiveProp?.GetValue(item) is bool b && b;
|
||||
if (isActive)
|
||||
{
|
||||
builder.OpenElement(15 + i * 5, "span");
|
||||
builder.AddAttribute(16 + i * 5, "class", "badge bg-success ms-2 float-end");
|
||||
builder.AddContent(17 + i * 5, "Active");
|
||||
builder.CloseElement();
|
||||
}
|
||||
|
||||
builder.CloseElement();
|
||||
}
|
||||
|
||||
builder.CloseElement();
|
||||
};
|
||||
}
|
||||
|
||||
private Action<int> SelectVda => idx =>
|
||||
{
|
||||
SelectedIndex = idx;
|
||||
SelectedVda = idx >= 0 && idx < VdaConfigs.Count ? VdaConfigs[idx] with { } : null;
|
||||
StateHasChanged();
|
||||
};
|
||||
|
||||
private Action<int> SelectSafety => idx =>
|
||||
{
|
||||
SelectedIndex = idx;
|
||||
SelectedSafety = idx >= 0 && idx < SafetyConfigs.Count ? SafetyConfigs[idx] with { } : null;
|
||||
StateHasChanged();
|
||||
};
|
||||
|
||||
private Action<int> SelectSimulation => idx =>
|
||||
{
|
||||
SelectedIndex = idx;
|
||||
SelectedSimulation = idx >= 0 && idx < SimulationConfigs.Count ? SimulationConfigs[idx] with { } : null;
|
||||
StateHasChanged();
|
||||
};
|
||||
|
||||
private Action<int> SelectPlc => idx =>
|
||||
{
|
||||
SelectedIndex = idx;
|
||||
SelectedPlc = idx >= 0 && idx < PlcConfigs.Count ? PlcConfigs[idx] with { } : null;
|
||||
StateHasChanged();
|
||||
};
|
||||
|
||||
private Action<int> SelectCore => idx =>
|
||||
{
|
||||
SelectedIndex = idx;
|
||||
SelectedCore = idx >= 0 && idx < CoreConfigs.Count ? CoreConfigs[idx] with { } : null;
|
||||
StateHasChanged();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
375
RobotApp.Client/Pages/RobotConfigManager.razor.css
Normal file
375
RobotApp.Client/Pages/RobotConfigManager.razor.css
Normal file
@@ -0,0 +1,375 @@
|
||||
/* Toolbar layout */
|
||||
.rcm-toolbar {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: linear-gradient(180deg, rgba(30,30,30,0.95), rgba(20,20,20,0.95));
|
||||
color: #e6e6e6;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 0.375rem;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.6);
|
||||
border: 1px solid rgba(255,255,255,0.04);
|
||||
}
|
||||
|
||||
/* Content layout: take remaining height */
|
||||
.rcm-content {
|
||||
height: calc(100vh - 90px); /* approximate toolbar + padding height; adjust if needed */
|
||||
min-height: 0; /* allow flex children to shrink properly */
|
||||
}
|
||||
|
||||
/* Config list uses flexible basis and can shrink instead of forcing overflow */
|
||||
.rcm-config-list {
|
||||
/* replace fixed width with flex basis + shrink */
|
||||
flex: 0 1 35%; /* flex-grow:0, flex-shrink:1, flex-basis:35% */
|
||||
min-width: 240px; /* allow smaller than before but keep readable */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Config content uses remaining space and can shrink/grow */
|
||||
.rcm-config-content {
|
||||
flex: 1 1 65%; /* flex-grow:1 to take remaining, flex-shrink:1 */
|
||||
min-width: 220px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Make card body scrollable if content overflows */
|
||||
.config-list .list-body,
|
||||
.rcm-config-content .card-body,
|
||||
.config-list .list-body ul {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Ensure list-body and editor body expand to fill container */
|
||||
.config-list .list-body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.rcm-config-content .card-body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Make config list body fill available height and scroll when content overflows */
|
||||
.rcm-config-list .card-body.list-body {
|
||||
flex: 1 1 auto; /* expand to fill container */
|
||||
min-height: 0; /* allow flex children to shrink in many browsers */
|
||||
overflow: auto; /* enable scrolling when content overflows */
|
||||
padding: 0.25rem 0.5rem; /* keep slight padding for list */
|
||||
}
|
||||
|
||||
/* Ensure the list itself doesn't add extra margins that affect scrolling */
|
||||
.rcm-config-list .list-group {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Each list item keeps its padding but stays in flow */
|
||||
.rcm-config-list .list-group-item {
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
/* List items spacing */
|
||||
.list-group-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Left side controls (robot id + select) */
|
||||
.rcm-toolbar-left {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* Right side action buttons */
|
||||
.rcm-toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Group buttons with small spacing */
|
||||
.rcm-action-group {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
/* Inputs sizing */
|
||||
.rcm-input {
|
||||
width: 160px;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid rgba(255,255,255,0.06);
|
||||
color: #e6e6e6;
|
||||
}
|
||||
|
||||
.rcm-select-wrapper {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Make select background brighter and match button gradients (blue tone similar to Update) */
|
||||
.rcm-select {
|
||||
width: 180px;
|
||||
margin-left: 6px; /* bring select closer to left controls */
|
||||
background: linear-gradient(180deg, #4aa0db, #2b87c9);
|
||||
border: 1px solid rgba(0,0,0,0.12);
|
||||
color: #fff;
|
||||
appearance: none;
|
||||
padding-right: 28px; /* space for icon */
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
|
||||
}
|
||||
|
||||
/* Hover effect: slightly brighter */
|
||||
.rcm-select-wrapper:hover .rcm-select {
|
||||
background: linear-gradient(180deg, #5bb6ee, #399ad6);
|
||||
border-color: rgba(58,123,184,0.22);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* Select icon color to contrast with brighter select */
|
||||
.rcm-select-icon {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
pointer-events: none;
|
||||
color: rgba(255,255,255,0.9);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Toolbar labels */
|
||||
.rcm-label {
|
||||
font-size: 0.9rem;
|
||||
margin-right: 6px;
|
||||
color: #cfcfcf;
|
||||
}
|
||||
|
||||
/* Minor button styling to match toolbar */
|
||||
.rcm-btn {
|
||||
min-width: 84px;
|
||||
}
|
||||
|
||||
/* Icon button styles */
|
||||
.rcm-icon-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 38px;
|
||||
height: 34px;
|
||||
padding: 0.25rem;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: #e6e6e6;
|
||||
border: 1px solid rgba(255,255,255,0.04);
|
||||
}
|
||||
|
||||
.rcm-icon-btn svg {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Icon button hover and focus states */
|
||||
.rcm-icon-btn:hover, .rcm-icon-btn:focus {
|
||||
background: rgba(255,255,255,0.03);
|
||||
color: #fff;
|
||||
border-color: rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.rcm-danger {
|
||||
color: #ffb3b3;
|
||||
border-color: rgba(255,100,100,0.18);
|
||||
}
|
||||
|
||||
/* Adjust bootstrap button colors for dark toolbar when using outline variants */
|
||||
.rcm-toolbar .btn-outline-primary {
|
||||
color: #cfe2ff;
|
||||
border-color: rgba(95,160,255,0.2);
|
||||
}
|
||||
|
||||
.rcm-toolbar .btn-outline-success {
|
||||
color: #d4f5d4;
|
||||
border-color: rgba(60,200,120,0.18);
|
||||
}
|
||||
|
||||
.rcm-toolbar .btn-outline-danger {
|
||||
color: #ffcfcf;
|
||||
border-color: rgba(255,100,100,0.18);
|
||||
}
|
||||
|
||||
/* Specific styles for action buttons (Add, Update, Delete) */
|
||||
.rcm-action-group button[aria-label="Add"] {
|
||||
background: linear-gradient(180deg, #4bb24b, #2f9a2f); /* bright green */
|
||||
color: #fff;
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Add"]:hover {
|
||||
background: linear-gradient(180deg, #66d166, #3fb83f);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Add"]:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px rgba(56,160,56,0.18);
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Update"] {
|
||||
background: linear-gradient(180deg, #4aa0db, #2b87c9); /* bright blue */
|
||||
color: #fff;
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset;
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Update"]:hover {
|
||||
background: linear-gradient(180deg, #5bb6ee, #399ad6);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Update"]:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px rgba(58,123,184,0.18);
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Delete"] {
|
||||
background: linear-gradient(180deg, #ff6b6b, #e04848); /* bright red */
|
||||
color: #fff;
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Delete"]:hover {
|
||||
background: linear-gradient(180deg, #ff8282, #ec5b5b);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Delete"]:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 3px rgba(224,72,72,0.18);
|
||||
}
|
||||
|
||||
/* Ensure icons inside the action buttons remain visible */
|
||||
.rcm-action-group button[aria-label="Add"] .mdi,
|
||||
.rcm-action-group button[aria-label="Update"] .mdi,
|
||||
.rcm-action-group button[aria-label="Delete"] .mdi {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Ensure dropdown options use dark theme matching select */
|
||||
.rcm-select option {
|
||||
background-color: #141414 !important;
|
||||
color: #e6e6e6 !important;
|
||||
}
|
||||
|
||||
/* Hover/active state inside dropdown */
|
||||
.rcm-select option:hover,
|
||||
.rcm-select option:checked {
|
||||
background-color: #2b87c9 !important; /* match update button blue */
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Optgroup styling (if used) */
|
||||
.rcm-select optgroup {
|
||||
color: #e6e6e6;
|
||||
background: #141414;
|
||||
}
|
||||
|
||||
/* Tooltip for action buttons using data-tooltip attribute */
|
||||
.rcm-action-group button[data-tooltip] {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.rcm-action-group button[data-tooltip]::after {
|
||||
content: attr(data-tooltip);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(8px);
|
||||
bottom: -9999px; /* hidden by default below flow */
|
||||
background: rgba(20,20,20,0.98);
|
||||
color: #fff;
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
white-space: nowrap;
|
||||
box-shadow: 0 2px 6px rgba(0,0,0,0.5);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.12s ease, transform 0.12s ease;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
/* Arrow below tooltip */
|
||||
.rcm-action-group button[data-tooltip]::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: -9999px;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background: rgba(20,20,20,0.98);
|
||||
transform-origin: center;
|
||||
rotate: 45deg;
|
||||
z-index: 49;
|
||||
}
|
||||
|
||||
/* Show tooltip on hover */
|
||||
.rcm-action-group button[data-tooltip]:hover::after,
|
||||
.rcm-action-group button[data-tooltip]:hover::before {
|
||||
bottom: -45px; /* reduced gap: place tooltip closer to the button */
|
||||
opacity: 1;
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
/* Adjust for danger button (slightly different color) */
|
||||
.rcm-action-group button[data-tooltip].rcm-danger::after {
|
||||
background: rgba(224,72,72,0.95);
|
||||
}
|
||||
|
||||
/* Slightly lift the button on hover to match tooltip */
|
||||
.rcm-action-group button[data-tooltip]:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
/* Tooltip backgrounds matching their buttons */
|
||||
.rcm-action-group button[aria-label="Add"][data-tooltip]::after {
|
||||
background: linear-gradient(180deg, #4bb24b, #2f9a2f);
|
||||
}
|
||||
.rcm-action-group button[aria-label="Add"][data-tooltip]::before {
|
||||
background: #2f9a2f;
|
||||
}
|
||||
|
||||
.rcm-action-group button[aria-label="Update"][data-tooltip]::after {
|
||||
background: linear-gradient(180deg, #4aa0db, #2b87c9);
|
||||
}
|
||||
.rcm-action-group button[aria-label="Update"][data-tooltip]::before {
|
||||
background: #2b87c9;
|
||||
}
|
||||
|
||||
/* Delete already had a red variant, update the arrow to match precisely */
|
||||
.rcm-action-group button[aria-label="Delete"][data-tooltip]::after,
|
||||
.rcm-action-group button[data-tooltip].rcm-danger::after {
|
||||
background: linear-gradient(180deg, #ff6b6b, #e04848);
|
||||
}
|
||||
.rcm-action-group button[aria-label="Delete"][data-tooltip]::before,
|
||||
.rcm-action-group button[data-tooltip].rcm-danger::before {
|
||||
background: #e04848;
|
||||
}
|
||||
|
||||
/* Ensure tooltip text stays readable on gradients */
|
||||
.rcm-action-group button[data-tooltip]::after {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Active badge in config list: make slightly larger and more visible */
|
||||
.rcm-config-list .list-group-item .badge {
|
||||
font-size: 1.05rem; /* slightly larger */
|
||||
padding: 0.45rem 0.8rem;
|
||||
border-radius: 0.5rem;
|
||||
line-height: 1;
|
||||
margin-left: 0.6rem;
|
||||
opacity: 0.98;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -11,3 +11,5 @@
|
||||
@using RobotApp.Client
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
@using MudBlazor
|
||||
@using RobotApp.Common.Shares.Dtos
|
||||
@using RobotApp.Common.Shares.Enums
|
||||
Reference in New Issue
Block a user