MachineConfigView was two left-pinned cards (MaxWidth 480/640, HAlign Left) stacked in a DockPanel — right half of wide window empty, items list capped at 320px. Now root Grid Auto,*,Auto: header top, footer (validation + Save/Cancel) bottom full-width, body Grid Auto,* — fixed 380px form left, data-items card stretches to fill width + height (scrollable). Layout only; no binding/VM/command change. Dashboard/Detail already fill correctly — untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
135 lines
6 KiB
XML
135 lines
6 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
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:Junction.App.ViewModels"
|
|
mc:Ignorable="d"
|
|
x:Class="Junction.App.Views.MachineConfigView"
|
|
x:DataType="vm:MachineConfigViewModel"
|
|
x:CompileBindings="True">
|
|
|
|
<!-- header / body / footer -->
|
|
<Grid Margin="20" RowDefinitions="Auto,*,Auto">
|
|
|
|
<!-- Header -->
|
|
<TextBlock Grid.Row="0" Classes="h1"
|
|
Text="{Binding Title}"
|
|
Margin="0,0,0,16" />
|
|
|
|
<!-- Body: fixed form column + stretching data-items column -->
|
|
<Grid Grid.Row="1" ColumnDefinitions="Auto,*">
|
|
|
|
<!-- Form -->
|
|
<Border Grid.Column="0" Classes="card" Width="380" VerticalAlignment="Top">
|
|
<StackPanel Spacing="12">
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Classes="fieldLabel" Text="Name" />
|
|
<TextBox Text="{Binding Name}" Watermark="Machine name" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Classes="fieldLabel" Text="Protocol" />
|
|
<ComboBox ItemsSource="{Binding AvailableProtocols}"
|
|
SelectedItem="{Binding SelectedProtocol}"
|
|
HorizontalAlignment="Stretch"
|
|
PlaceholderText="Select a protocol" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Classes="fieldLabel" Text="Agent URL" />
|
|
<TextBox Text="{Binding AgentUrl}" Watermark="http://host:5000" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Spacing="4">
|
|
<TextBlock Classes="fieldLabel" Text="Poll Interval (seconds)" />
|
|
<TextBox Text="{Binding PollIntervalSeconds}" Width="120" HorizontalAlignment="Left" />
|
|
</StackPanel>
|
|
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- Data items to monitor (fills remaining width + height) -->
|
|
<Border Grid.Column="1" Classes="card" Margin="16,0,0,0" HorizontalAlignment="Stretch">
|
|
<DockPanel>
|
|
|
|
<TextBlock DockPanel.Dock="Top" Classes="h2" Text="Data items to monitor"
|
|
Margin="0,0,0,8" />
|
|
|
|
<!-- Controls row -->
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="8" Margin="0,0,0,8">
|
|
<Button Content="Load available items"
|
|
Command="{Binding LoadItemsCommand}" />
|
|
<Button Content="Select all"
|
|
Command="{Binding SelectAllCommand}" />
|
|
<Button Content="Select none"
|
|
Command="{Binding SelectNoneCommand}" />
|
|
<ProgressBar IsIndeterminate="True"
|
|
IsVisible="{Binding IsProbing}"
|
|
Width="120" VerticalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<!-- Status message -->
|
|
<TextBlock DockPanel.Dock="Top" Classes="subtle"
|
|
Text="{Binding ItemsStatus}"
|
|
IsVisible="{Binding HasItemsStatus}"
|
|
TextWrapping="Wrap" Margin="0,0,0,8" />
|
|
|
|
<!-- Column header -->
|
|
<Border DockPanel.Dock="Top"
|
|
BorderThickness="0,0,0,1"
|
|
BorderBrush="{DynamicResource CardBorderBrush}"
|
|
Padding="0,0,0,4" Margin="0,0,0,4">
|
|
<Grid ColumnDefinitions="Auto,2*,1.2*,1.2*,1*" Margin="0,0,8,0">
|
|
<TextBlock Grid.Column="0" Text="" Width="28" />
|
|
<TextBlock Grid.Column="1" Classes="fieldLabel" Text="Name" />
|
|
<TextBlock Grid.Column="2" Classes="fieldLabel" Text="Type" />
|
|
<TextBlock Grid.Column="3" Classes="fieldLabel" Text="Category" />
|
|
<TextBlock Grid.Column="4" Classes="fieldLabel" Text="Units" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Scrollable checklist (fills remaining height) -->
|
|
<ScrollViewer>
|
|
<ItemsControl ItemsSource="{Binding AvailableItems}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:SelectableDataItemViewModel">
|
|
<Grid ColumnDefinitions="Auto,2*,1.2*,1.2*,1*" Margin="0,3">
|
|
<CheckBox Grid.Column="0" Width="28"
|
|
IsChecked="{Binding IsSelected}"
|
|
VerticalAlignment="Center" />
|
|
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
|
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" TextWrapping="Wrap" />
|
|
<TextBlock Text="{Binding Id}" Classes="subtle" FontSize="11" TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
<TextBlock Grid.Column="2" Text="{Binding Type}" VerticalAlignment="Center" TextWrapping="Wrap" />
|
|
<TextBlock Grid.Column="3" Text="{Binding Category}" VerticalAlignment="Center" TextWrapping="Wrap" />
|
|
<TextBlock Grid.Column="4" Text="{Binding Units}" VerticalAlignment="Center" TextWrapping="Wrap" />
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<!-- Footer: validation hint + action bar, full width -->
|
|
<StackPanel Grid.Row="2" Spacing="0">
|
|
<!-- Inline validation hint -->
|
|
<TextBlock Text="{Binding ValidationError}"
|
|
IsVisible="{Binding HasValidationError}"
|
|
Foreground="{DynamicResource DangerBrush}"
|
|
TextWrapping="Wrap"
|
|
Margin="0,12,0,0" />
|
|
|
|
<!-- Action bar -->
|
|
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,16,0,0">
|
|
<Button Classes="accent" Content="Save" Command="{Binding SaveCommand}" IsDefault="True" />
|
|
<Button Content="Cancel" Command="{Binding CancelCommand}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
</UserControl>
|