Initial commit
This commit is contained in:
@@ -0,0 +1,114 @@
|
||||
@page "/robot-models"
|
||||
|
||||
@rendermode InteractiveWebAssemblyNoPrerender
|
||||
|
||||
<PageTitle>Robot Model Management</PageTitle>
|
||||
|
||||
@using RobotNet10.FleetManager.Client.Services
|
||||
@using RobotNet10.FleetManager.Client.Components.RobotModelManager
|
||||
@using RobotNet10.FleetManager.Client.Components.RobotModelManager.Dialogs
|
||||
@using RobotNet10.FleetManager.Shared.DTOs.RobotModel
|
||||
@inject RobotModelApiService ApiService
|
||||
@inject IDialogService DialogService
|
||||
@inject ISnackbar Snackbar
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraExtraLarge" Class="mt-4">
|
||||
<!-- Header -->
|
||||
<MudPaper Class="pa-4 mb-4 align-content-center" MinHeight="80px">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Spacing="3">
|
||||
<MudText Typo="Typo.h5">Robot Model Management</MudText>
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudTextField Value="@searchText"
|
||||
Placeholder="Search robot models..."
|
||||
Variant="Variant.Outlined"
|
||||
Adornment="Adornment.Start"
|
||||
AdornmentIcon="@Icons.Material.Filled.Search"
|
||||
Margin="Margin.Dense"
|
||||
Style="min-width: 250px;"
|
||||
Immediate="false"
|
||||
T="string"
|
||||
ValueChanged="TextSearchChanged"
|
||||
Clearable="true" />
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Add"
|
||||
Variant="Variant.Filled"
|
||||
Color="Color.Success"
|
||||
OnClick="HandleCreate">
|
||||
Add Robot Model
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
|
||||
<!-- Main Content -->
|
||||
<MudGrid>
|
||||
<!-- Left: List Panel (60%) -->
|
||||
<MudItem xs="12" md="7">
|
||||
<RobotModelListPanel @ref="ListPanelRef"
|
||||
ApiService="@ApiService"
|
||||
SelectedRobotModelChanged="SelectedRobotModelChanged"
|
||||
SearchText="@searchText" />
|
||||
</MudItem>
|
||||
|
||||
<!-- Right: Details Panel (40%) -->
|
||||
<MudItem xs="12" md="5">
|
||||
<MudPaper Class="pa-3" Elevation="1" Style="height: calc(100vh - 169px); overflow-y: auto;">
|
||||
|
||||
@if (selectedRobotModel != null)
|
||||
{
|
||||
<RobotModelDetailsPanel RobotModel="@selectedRobotModel" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body1" Align="Align.Center" Class="mt-8">
|
||||
Select a robot model to view details
|
||||
</MudText>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudContainer>
|
||||
|
||||
<MudThemeProvider IsDarkMode />
|
||||
<MudPopoverProvider />
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
|
||||
@code {
|
||||
private string searchText = string.Empty;
|
||||
private RobotModelDto? selectedRobotModel;
|
||||
private RobotModelListPanel? ListPanelRef;
|
||||
|
||||
private async Task TextSearchChanged(string text)
|
||||
{
|
||||
searchText = text;
|
||||
if (ListPanelRef != null)
|
||||
{
|
||||
await ListPanelRef.SearchAsync(text);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleCreate()
|
||||
{
|
||||
var parameters = new DialogParameters
|
||||
{
|
||||
["ApiService"] = ApiService
|
||||
};
|
||||
|
||||
var dialog = await DialogService.ShowAsync<CreateRobotModelDialog>("Create Robot Model", parameters,
|
||||
new DialogOptions { MaxWidth = MaxWidth.Medium, FullWidth = true });
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (result != null && !result.Canceled)
|
||||
{
|
||||
await ListPanelRef?.LoadDataAsync()!;
|
||||
Snackbar.Add("Robot model created successfully", Severity.Success);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectedRobotModelChanged(RobotModelDto? model)
|
||||
{
|
||||
selectedRobotModel = model;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user