Files
HC_APTBS/Views/UserControls/ResultHistoryView.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

148 lines
8.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<UserControl x:Class="HC_APTBS.Views.UserControls.ResultHistoryView"
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"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="320">
<!--
Session-only test-run history list.
DataContext: ResultsPageViewModel. Renders one row per CompletedTestRun in History.
-->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<TextBlock Grid.Row="0" Text="{DynamicResource Results.HistoryHeader}"
FontSize="13" FontWeight="SemiBold" Foreground="#333"
Margin="0,0,0,6"/>
<!-- Empty-state prompt -->
<Border Grid.Row="1"
Visibility="{Binding IsHistoryEmpty, Converter={StaticResource BoolToVis}}"
VerticalAlignment="Top" Padding="8" Margin="0,0,0,4"
Background="#F5F5F5" BorderBrush="#DDD" BorderThickness="1" CornerRadius="3">
<TextBlock Text="{DynamicResource Results.EmptyState}"
FontSize="12" Foreground="#777" FontStyle="Italic"
TextWrapping="Wrap"/>
</Border>
<!-- Entries list -->
<ListBox Grid.Row="1"
ItemsSource="{Binding History}"
SelectedItem="{Binding SelectedRun, Mode=TwoWay}"
BorderThickness="0"
Background="Transparent"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,0,0,4"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Padding="8,6" CornerRadius="3" BorderThickness="1" BorderBrush="#DDD"
Background="#FAFAFA">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Timestamp -->
<TextBlock Grid.Row="0" Grid.Column="0"
Text="{Binding CompletedAt, StringFormat='{}{0:dd/MM HH:mm:ss}'}"
FontFamily="Consolas" FontSize="11" Foreground="#555"/>
<!-- PASS / FAIL / INTERRUPTED pill -->
<Border Grid.Row="0" Grid.Column="1" Padding="5,1" CornerRadius="2"
Margin="4,0,0,0" VerticalAlignment="Center">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#B71C1C"/>
<Style.Triggers>
<DataTrigger Binding="{Binding OverallPassed}" Value="True">
<Setter Property="Background" Value="#2E7D32"/>
</DataTrigger>
<DataTrigger Binding="{Binding Interrupted}" Value="True">
<Setter Property="Background" Value="#FFB020"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Foreground="White" FontSize="10" FontWeight="Bold">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource Common.Fail}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding OverallPassed}" Value="True">
<Setter Property="Text" Value="{DynamicResource Common.Pass}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Interrupted}" Value="True">
<Setter Property="Text" Value="{DynamicResource Results.InterruptedLabel}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Border>
<!-- Delete (×) button -->
<Button Grid.Row="0" Grid.Column="2"
Content="&#x2715;"
Width="20" Height="20" Margin="4,0,0,0" Padding="0"
FontSize="11" FontWeight="Bold" Foreground="#999"
Background="Transparent" BorderThickness="0"
Cursor="Hand"
ToolTip="{DynamicResource Results.DeleteTooltip}"
Command="{Binding DataContext.RemoveEntryCommand,
RelativeSource={RelativeSource AncestorType=ListBox}}"
CommandParameter="{Binding Id}"/>
<!-- Pump identity -->
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
FontSize="12" FontWeight="SemiBold" Margin="0,2,0,0"
TextTrimming="CharacterEllipsis">
<Run Text="{Binding PumpModel, Mode=OneWay}"/>
<Run Text=" · "/>
<Run Text="{Binding PumpSerial, Mode=OneWay}"/>
</TextBlock>
<!-- Test names -->
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
Text="{Binding TestNames}"
FontSize="11" Foreground="#666" Margin="0,2,0,0"
TextTrimming="CharacterEllipsis"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Clear session -->
<Button Grid.Row="2"
Content="{DynamicResource Results.ClearSessionButton}"
Command="{Binding ClearHistoryCommand}"
Margin="0,6,0,0" Padding="6,3" HorizontalAlignment="Right"
FontSize="11"/>
</Grid>
</UserControl>