Files
HC_APTBS/Views/Pages/TestsPage.xaml
LucianoDev 0280a2fad1 feat: page-based navigation shell + Tests page wizard
Replace the monolithic MainWindow with a SelectedPage-driven shell
(Dashboard / Pump / Bench / Tests / Results / Settings). The Tests
page gets the Plan -> Preconditions -> Running -> Done wizard from
ui-structure.md \u00a74, backed by a 7-item precondition gate and
shared sub-views (PhaseCardView / TestSectionView / GraphicIndicatorView)
extracted from the now-deleted monolithic TestPanelView.

New VMs / views:
- Tests wizard: TestPreconditions, PhaseCard, GraphicIndicator,
  TestSection, TestPlan, TestRunning, TestDone
- Dashboard panels: DashboardConnection, DashboardReadings,
  DashboardAlarms, InterlockBanner, ResultHistory
- Pump / bench panels: PumpIdentificationPanel, PumpLiveData,
  UnlockPanel, BenchDriveControl, BenchReadings, RelayBank,
  TemperatureControl, DtcList, AuthGate
- Dialogs: generic ConfirmDialog, UserManageDialog, UserPromptDialog

Supporting changes:
- IsOilPumpOn exposed on MainViewModel for precondition evaluation
- RequiresAuth added to TestDefinition (XML round-trip)
- BipStatusDefinition + CompletedTestRun models
- ~35 new Test.* localization keys (en + es)
- Settings moved from modal dialog to full page
- Pause / Retry / Skip stubs in TestRunningView; full spec in
  docs/gap-test-running-controls.md for follow-up implementation
- docs/ui-structure.md captures the wizard design

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 13:11:34 +02:00

205 lines
10 KiB
XML

<UserControl x:Class="HC_APTBS.Views.Pages.TestsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:HC_APTBS.Models"
xmlns:uc="clr-namespace:HC_APTBS.Views.UserControls"
xmlns:vm="clr-namespace:HC_APTBS.ViewModels"
xmlns:vmp="clr-namespace:HC_APTBS.ViewModels.Pages"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1000"
d:DataContext="{d:DesignInstance Type=vmp:TestsPageViewModel, IsDesignTimeCreatable=False}">
<!--
Plan → Preconditions → Running → Done wizard (ui-structure.md §4).
DataContext: TestsPageViewModel.
Top row: 4-pill stepper. Middle: ContentControl routing CurrentStateVm
through typed DataTemplates. Bottom: wizard footer with Back / Next.
-->
<UserControl.Resources>
<!-- Step → View mappings -->
<DataTemplate DataType="{x:Type vmp:PlanStateViewModel}">
<uc:TestPlanView DataContext="{Binding TestPanel}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:TestPreconditionsViewModel}">
<uc:TestPreconditionsView/>
</DataTemplate>
<DataTemplate DataType="{x:Type vmp:RunningStateViewModel}">
<uc:TestRunningView DataContext="{Binding TestPanel}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vmp:TestsPageViewModel}">
<uc:TestDoneView/>
</DataTemplate>
<!-- Stepper pill style -->
<Style x:Key="StepPillStyle" TargetType="Border">
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Padding" Value="14,4"/>
<Setter Property="Margin" Value="0,0,6,0"/>
<Setter Property="Background" Value="#ECEFF1"/>
<Setter Property="BorderBrush" Value="#CFD8DC"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Wizard stepper -->
<Border Background="White" BorderBrush="#DDD" BorderThickness="0,0,0,1" Padding="10,8">
<ItemsControl>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<Border Style="{StaticResource StepPillStyle}">
<Border.Resources>
<Style TargetType="Border" BasedOn="{StaticResource StepPillStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Plan}">
<Setter Property="Background" Value="#1565C0"/>
<Setter Property="BorderBrush" Value="#0D47A1"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{DynamicResource Test.Wizard.Plan}" FontSize="12">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#455A64"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Plan}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<Border Style="{StaticResource StepPillStyle}">
<Border.Resources>
<Style TargetType="Border" BasedOn="{StaticResource StepPillStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Preconditions}">
<Setter Property="Background" Value="#1565C0"/>
<Setter Property="BorderBrush" Value="#0D47A1"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{DynamicResource Test.Wizard.Preconditions}" FontSize="12">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#455A64"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Preconditions}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<Border Style="{StaticResource StepPillStyle}">
<Border.Resources>
<Style TargetType="Border" BasedOn="{StaticResource StepPillStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Running}">
<Setter Property="Background" Value="#1565C0"/>
<Setter Property="BorderBrush" Value="#0D47A1"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{DynamicResource Test.Wizard.Running}" FontSize="12">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#455A64"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Running}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<Border Style="{StaticResource StepPillStyle}">
<Border.Resources>
<Style TargetType="Border" BasedOn="{StaticResource StepPillStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Done}">
<Setter Property="Background" Value="#1565C0"/>
<Setter Property="BorderBrush" Value="#0D47A1"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{DynamicResource Test.Wizard.Done}" FontSize="12">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#455A64"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CurrentState}"
Value="{x:Static models:TestFlowState.Done}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
</ItemsControl>
</Border>
<!-- Current step body -->
<ContentControl Grid.Row="1" Content="{Binding CurrentStateVm}"/>
<!-- Wizard footer: Back / Next -->
<Border Grid.Row="2" Padding="10,8"
Background="White" BorderBrush="#DDD" BorderThickness="0,1,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Content="{DynamicResource Test.Wizard.Back}"
Command="{Binding BackCommand}"
Padding="16,6" FontSize="12"/>
<Button Grid.Column="2"
Content="{DynamicResource Test.Wizard.Next}"
Command="{Binding NextCommand}"
Padding="16,6" FontSize="12"
FontWeight="SemiBold"/>
</Grid>
</Border>
</Grid>
</UserControl>