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>
174 lines
10 KiB
XML
174 lines
10 KiB
XML
<UserControl x:Class="HC_APTBS.Views.UserControls.TestPreconditionsView"
|
|
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:vm="clr-namespace:HC_APTBS.ViewModels"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="520" d:DesignWidth="680"
|
|
d:DataContext="{d:DesignInstance Type=vm:TestPreconditionsViewModel, IsDesignTimeCreatable=False}">
|
|
<!--
|
|
Preconditions checklist (Tests page wizard step 4b).
|
|
DataContext: TestPreconditionsViewModel.
|
|
Rows auto-refresh as underlying properties change; Start button is disabled
|
|
until AllPassed is true.
|
|
-->
|
|
<UserControl.Resources>
|
|
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
|
|
</UserControl.Resources>
|
|
|
|
<Border Background="White" BorderBrush="#DDD" BorderThickness="1" CornerRadius="4" Padding="14">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Title -->
|
|
<TextBlock Grid.Row="0"
|
|
Text="{DynamicResource Test.Precheck.Title}"
|
|
FontSize="16" FontWeight="SemiBold" Foreground="#222"
|
|
Margin="0,0,0,10"/>
|
|
|
|
<!-- Auth gate (only when a required test has RequiresAuth=true) -->
|
|
<Border Grid.Row="1"
|
|
Background="#FFF8E1" BorderBrush="#F0C24A" BorderThickness="1"
|
|
CornerRadius="3" Padding="10,8" Margin="0,0,0,10"
|
|
Visibility="{Binding IsAuthRequired, Converter={StaticResource BoolToVis}}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
|
<TextBlock Text="{DynamicResource Test.Precheck.AuthBanner}"
|
|
FontSize="12" FontWeight="SemiBold" Foreground="#7A5A00"/>
|
|
<TextBlock Text="{Binding TestAuth.AuthenticatedUser}"
|
|
FontSize="11" Foreground="#7A5A00"
|
|
Visibility="{Binding TestAuth.IsAuthenticated, Converter={StaticResource BoolToVis}}"/>
|
|
</StackPanel>
|
|
<Button Grid.Column="1"
|
|
Content="{DynamicResource Test.Precheck.AuthButton}"
|
|
Command="{Binding TestAuth.AuthenticateCommand}"
|
|
Padding="10,4" FontSize="12"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Checklist -->
|
|
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto">
|
|
<ItemsControl ItemsSource="{Binding Items}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type vm:PreconditionItemViewModel}">
|
|
<Border BorderBrush="#EEE" BorderThickness="0,0,0,1" Padding="0,8">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="32"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- Status glyph -->
|
|
<Border Grid.Column="0" Width="20" Height="20"
|
|
CornerRadius="10" VerticalAlignment="Center"
|
|
HorizontalAlignment="Left"
|
|
Margin="0,0,8,0">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Background" Value="#E74C3C"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsSatisfied}" Value="True">
|
|
<Setter Property="Background" Value="#26C200"/>
|
|
</DataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding IsSatisfied}" Value="False"/>
|
|
<Condition Binding="{Binding IsRequired}" Value="False"/>
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="Background" Value="#BBB"/>
|
|
</MultiDataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
Foreground="White" FontSize="12" FontWeight="Bold">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Text" Value="✕"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsSatisfied}" Value="True">
|
|
<Setter Property="Text" Value="✓"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</Border>
|
|
|
|
<!-- Label + remediation text -->
|
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
|
<TextBlock Text="{Binding Label}" FontSize="13" Foreground="#222"/>
|
|
<TextBlock Text="{Binding RemediationText}"
|
|
FontSize="11" Foreground="#888">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsSatisfied}" Value="True">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
|
|
<!-- Fix-it button -->
|
|
<Button Grid.Column="2"
|
|
Content="{DynamicResource Test.Precheck.FixButton}"
|
|
Command="{Binding NavigateToFixCommand}"
|
|
Padding="8,3" FontSize="11" Margin="8,0,0,0"
|
|
Visibility="{Binding HasRemediation, Converter={StaticResource BoolToVis}}"/>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
|
|
<!-- Start button row -->
|
|
<Grid Grid.Row="3" Margin="0,14,0,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Column="0" VerticalAlignment="Center"
|
|
FontSize="12" Foreground="#666"
|
|
Text="{DynamicResource Test.Precheck.NotReady}">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Visibility" Value="Visible"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding AllPassed}" Value="True">
|
|
<Setter Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
<TextBlock Grid.Column="0" VerticalAlignment="Center"
|
|
FontSize="12" Foreground="#26C200" FontWeight="SemiBold"
|
|
Text="{DynamicResource Test.Precheck.Ready}"
|
|
Visibility="{Binding AllPassed, Converter={StaticResource BoolToVis}}"/>
|
|
|
|
<Button Grid.Column="1"
|
|
Content="{DynamicResource Test.StartTest}"
|
|
Command="{Binding StartTestCommand}"
|
|
Padding="18,6" FontSize="14" FontWeight="Bold"
|
|
Background="#26C200" Foreground="White" BorderThickness="0"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</UserControl>
|