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

86 lines
4.3 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.AuthGateView"
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="240" d:DesignWidth="500">
<!--
Wraps any child content behind an operator-authentication gate.
DataContext = AuthGateViewModel. Set GatedContent via the attached-like
property below to supply the content to show when authenticated.
Usage (in a parent view):
<uc:AuthGateView DataContext="{Binding AdaptationAuth}">
<uc:AuthGateView.GatedContent>
<uc:DfiManageView DataContext="{Binding DfiViewModel}"/>
</uc:AuthGateView.GatedContent>
</uc:AuthGateView>
-->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
</UserControl.Resources>
<Grid>
<!-- ── Locked state: authenticate prompt ─────────────────────── -->
<Border Background="#F5F5F5" BorderBrush="#CCC" BorderThickness="1"
CornerRadius="4" Padding="20" Margin="6">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsAuthenticated}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="🔒"
HorizontalAlignment="Center" FontSize="40" Margin="0,0,0,8"/>
<TextBlock Text="{DynamicResource AuthGate.LockedTitle}"
FontSize="14" FontWeight="SemiBold"
HorizontalAlignment="Center" Margin="0,0,0,4"/>
<TextBlock Text="{DynamicResource AuthGate.LockedMessage}"
FontSize="12" Foreground="#666"
HorizontalAlignment="Center" TextWrapping="Wrap"
MaxWidth="360" TextAlignment="Center" Margin="0,0,0,14"/>
<Button Content="{DynamicResource AuthGate.Authenticate}"
Command="{Binding AuthenticateCommand}"
HorizontalAlignment="Center"
MinWidth="160" Height="34" FontWeight="Bold"/>
</StackPanel>
</Border>
<!-- ── Unlocked state: child content + re-lock button ─────────── -->
<Grid Visibility="{Binding IsAuthenticated, Converter={StaticResource BoolToVis}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="#E8F5E9" BorderBrush="#66BB6A"
BorderThickness="0,0,0,1" Padding="10,4" Margin="6,6,6,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock FontSize="12" Foreground="#2E7D32" VerticalAlignment="Center">
<Run Text="{DynamicResource AuthGate.UnlockedAs}"/>
<Run Text="{Binding AuthenticatedUser, Mode=OneWay}" FontWeight="Bold"/>
</TextBlock>
<Button Grid.Column="1"
Content="{DynamicResource AuthGate.Lock}"
Command="{Binding LockCommand}"
Height="22" MinWidth="70" FontSize="11"/>
</Grid>
</Border>
<ContentPresenter Grid.Row="1"
Content="{Binding GatedContent, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
</Grid>
</Grid>
</UserControl>