With sizes in the language's units, the left-to-right number cells of the Import
tables and the Jobs speed and time-left columns put the unit after the number on
screen, so an Arabic or Hebrew reader met the unit first ("18,6 كيلوبايت"), and the
fixed column cut the longer word off. These cells and their headers now follow the
reading direction at the end of the cell, and the Import size columns size to their
content; bare numbers (percentages) stay left-to-right islands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
222 lines
15 KiB
XML
222 lines
15 KiB
XML
<UserControl x:Class="Titano.App.Sections.JobsView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
|
xmlns:s="clr-namespace:Titano.App.Sections"
|
|
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
|
xmlns:j="clr-namespace:Titano.App.Jobs">
|
|
<UserControl.Resources>
|
|
<Style x:Key="Text.Muted" TargetType="TextBlock" BasedOn="{StaticResource Text.Cell}">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsDimmed}" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<!-- Numbers stay right-aligned in both reading directions (DESIGN §4 tables). -->
|
|
<Style x:Key="Text.MutedNumber" TargetType="TextBlock" BasedOn="{StaticResource Text.Muted}">
|
|
<Setter Property="TextAlignment" Value="Right" />
|
|
<Setter Property="FlowDirection" Value="LeftToRight" />
|
|
</Style>
|
|
<!-- Speeds and times left carry the language's unit ("2 د"): they read in its direction, at the end of the cell like their header. -->
|
|
<Style x:Key="Text.MutedEnd" TargetType="TextBlock" BasedOn="{StaticResource Text.Muted}">
|
|
<Setter Property="TextAlignment" Value="Right" />
|
|
</Style>
|
|
<Style x:Key="Text.HeaderEnd" TargetType="TextBlock" BasedOn="{StaticResource Text.Header}">
|
|
<Setter Property="TextAlignment" Value="Right" />
|
|
</Style>
|
|
<Style x:Key="ProgressBar.Job" TargetType="ProgressBar" BasedOn="{StaticResource {x:Type ProgressBar}}">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsDone}" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Success}" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding IsFailed}" Value="True">
|
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Error}" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<ItemsPanelTemplate x:Key="Panel.Row">
|
|
<StackPanel Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
<ItemsPanelTemplate x:Key="Panel.Wrap">
|
|
<WrapPanel />
|
|
</ItemsPanelTemplate>
|
|
<!-- Filter chip (Jobs.html, aria-pressed): one of a group, so screen readers hear which filter is on. -->
|
|
<Style x:Key="RadioButton.Chip" TargetType="RadioButton" BasedOn="{StaticResource Button.Base}">
|
|
<Setter Property="Height" Value="30" />
|
|
<Setter Property="Padding" Value="12,0" />
|
|
<Setter Property="Typography.NumeralAlignment" Value="Tabular" />
|
|
<Setter Property="ui:ControlState.CornerRadius" Value="15" />
|
|
<Style.Triggers>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
|
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<!-- A row reads as its job and state; Tab goes to its buttons. -->
|
|
<Style x:Key="ListBoxItem.Job" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
|
<Setter Property="AutomationProperties.Name" Value="{Binding AccessibleName}" />
|
|
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding StateText}" />
|
|
</Style>
|
|
</UserControl.Resources>
|
|
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Toolbar in visual (and Tab) order: state chips · search, then workers, Pause all, Clear done. The search moves under
|
|
the chips before anything is cut (+40 % text at 1200 px). -->
|
|
<Grid Margin="20,12">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<WrapPanel VerticalAlignment="Center">
|
|
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Wrap}" Focusable="False" VerticalAlignment="Center">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type s:JobFilterChip}">
|
|
<RadioButton Style="{StaticResource RadioButton.Chip}" GroupName="JobFilters" Content="{Binding Text}" IsChecked="{Binding IsSelected, Mode=OneWay}"
|
|
Command="{Binding SelectCommand}" ToolTip="{Binding ToolTip}" Margin="0,1,8,1" />
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
<StackPanel Orientation="Horizontal" Margin="0,1,0,1">
|
|
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="6,0,14,0" VerticalAlignment="Center" />
|
|
<TextBox Width="240" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
|
|
ui:Field.Placeholder="{l:Loc Jobs.Search}" ToolTip="{l:Loc Tooltips.Jobs.Search}" AutomationProperties.Name="{l:Loc Jobs.Search}" />
|
|
</StackPanel>
|
|
</WrapPanel>
|
|
<TextBlock Grid.Column="1" Text="{Binding WorkersText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="12,0,0,0"
|
|
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Jobs.Workers}" Visibility="{Binding HasWorkers, Converter={StaticResource BoolToVisibility}}" />
|
|
<Button Grid.Column="2" Content="{l:Loc Jobs.PauseAll}" Command="{Binding PauseAllCommand}" ToolTip="{l:Loc Tooltips.Jobs.PauseAll}" Margin="12,0,0,0" VerticalAlignment="Center" />
|
|
<Button Grid.Column="3" Content="{l:Loc Jobs.ClearDone}" Command="{Binding ClearDoneCommand}" ToolTip="{l:Loc Tooltips.Jobs.ClearDone}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
|
</Grid>
|
|
|
|
<Border Grid.Row="1" Style="{StaticResource Border.Panel}" Margin="20,0,20,12" Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
|
|
<!-- Header and rows share their columns (Jobs.html grid-template-columns): the same 14 px padding, the actions column sized
|
|
by its widest row in every row, and the list's scroll-bar gutter always kept (10 px), mirrored on the header's right. -->
|
|
<Grid Grid.IsSharedSizeScope="True">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Header -->
|
|
<Border BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="14,8,24,8">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="28" />
|
|
<ColumnDefinition Width="120" />
|
|
<ColumnDefinition Width="1.6*" MinWidth="120" />
|
|
<ColumnDefinition Width="*" MinWidth="120" MaxWidth="240" />
|
|
<ColumnDefinition Width="90" />
|
|
<ColumnDefinition Width="80" />
|
|
<ColumnDefinition Width="110" />
|
|
<ColumnDefinition Width="120" />
|
|
<ColumnDefinition Width="Auto" MinWidth="150" SharedSizeGroup="JobActions" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Kind}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Target}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Progress}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="4" Style="{StaticResource Text.HeaderEnd}" Text="{l:Loc Jobs.Column.Speed}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="5" Style="{StaticResource Text.HeaderEnd}" Text="{l:Loc Jobs.Column.Left}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="6" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Where}" Margin="16,0,0,0" />
|
|
<TextBlock Grid.Column="7" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.State}" Margin="10,0,0,0" />
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Rows: queue order, then the history; expandable log tail. Tab walks every row button (the rows take no focus). -->
|
|
<ListBox x:Name="JobList" Grid.Row="1" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Job}"
|
|
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.ScrollChanged="OnScrollChanged"
|
|
KeyboardNavigation.TabNavigation="Continue" AutomationProperties.Name="{l:Loc Shell.Nav.Jobs}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type j:JobRowViewModel}">
|
|
<StackPanel>
|
|
<Border x:Name="Row" Height="38" Background="Transparent" Padding="14,0">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="28" />
|
|
<ColumnDefinition Width="120" />
|
|
<ColumnDefinition Width="1.6*" MinWidth="120" />
|
|
<ColumnDefinition Width="*" MinWidth="120" MaxWidth="240" />
|
|
<ColumnDefinition Width="90" />
|
|
<ColumnDefinition Width="80" />
|
|
<ColumnDefinition Width="110" />
|
|
<ColumnDefinition Width="120" />
|
|
<ColumnDefinition Width="Auto" MinWidth="150" SharedSizeGroup="JobActions" />
|
|
</Grid.ColumnDefinitions>
|
|
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" HorizontalAlignment="Left"
|
|
ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}" Command="{Binding ToggleLogCommand}"
|
|
ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleName}" />
|
|
<TextBlock Grid.Column="1" Style="{StaticResource Text.Muted}" Text="{Binding Kind}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding Target}" Margin="10,0,0,0" ToolTip="{Binding Target}" />
|
|
<Grid Grid.Column="3" Margin="10,0,0,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="44" />
|
|
</Grid.ColumnDefinitions>
|
|
<ProgressBar Style="{StaticResource ProgressBar.Job}" Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center"
|
|
AutomationProperties.Name="{Binding AccessibleName}" />
|
|
<TextBlock Grid.Column="1" Style="{StaticResource Text.MutedNumber}" Text="{Binding PercentText}" />
|
|
</Grid>
|
|
<TextBlock Grid.Column="4" Style="{StaticResource Text.MutedEnd}" Text="{Binding SpeedText}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="5" Style="{StaticResource Text.MutedEnd}" Text="{Binding LeftText}" Margin="10,0,0,0" />
|
|
<TextBlock Grid.Column="6" Style="{StaticResource Text.Muted}" Text="{Binding WhereText}" Margin="16,0,0,0" />
|
|
<!-- A new state is announced with its job; progress ticks are not. -->
|
|
<ui:StatusGlyph Grid.Column="7" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
|
|
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0"
|
|
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding StateAnnouncement}" />
|
|
<ItemsControl Grid.Column="8" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False"
|
|
VerticalAlignment="Center" Margin="10,0,0,0">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type j:JobAction}">
|
|
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}"
|
|
AutomationProperties.Name="{Binding AccessibleName}" />
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Grid>
|
|
</Border>
|
|
<!-- The log keeps its left-to-right lines (times, paths, numbers) in every language. -->
|
|
<Border x:Name="Log" Background="{DynamicResource Brush.Bg}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0"
|
|
Padding="52,10,14,12" Visibility="Collapsed">
|
|
<TextBlock Style="{StaticResource Text.Log}" Text="{Binding LogText}" FlowDirection="LeftToRight" />
|
|
</Border>
|
|
</StackPanel>
|
|
<DataTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding IsExpanded}" Value="True">
|
|
<Setter TargetName="Log" Property="Visibility" Value="Visible" />
|
|
<Setter TargetName="Row" Property="Background" Value="{DynamicResource Brush.Card}" />
|
|
<Setter TargetName="Toggle" Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.ChevronDown}" />
|
|
</DataTrigger>
|
|
</DataTemplate.Triggers>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<!-- Footer -->
|
|
<Border Grid.Row="2" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0" Padding="14,8">
|
|
<DockPanel LastChildFill="False" TextElement.FontSize="12">
|
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Link}" Content="{l:Loc Jobs.RenderingSettings}" Command="{Binding RenderingSettingsCommand}"
|
|
ToolTip="{l:Loc Tooltips.Jobs.RenderingSettings}" />
|
|
<TextBlock Text="{Binding HistoryText}" Foreground="{DynamicResource Brush.TextMuted}" ToolTip="{l:Loc Tooltips.Jobs.History}" />
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<ui:EmptyState Grid.Row="1" Message="{l:Loc Jobs.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
|
|
<Button Content="{l:Loc Shell.Nav.Import}" Command="{Binding ImportCommand}" ToolTip="{l:Loc Tooltips.Jobs.Import}" />
|
|
</ui:EmptyState>
|
|
</Grid>
|
|
</UserControl>
|