Files
Chronos/src/Chronos.App/Sections/JobsView.xaml
T
Alby96andClaude Opus 5.5 a89ec10ebf
CI / Build and test (pull_request) Successful in 11m47s
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 12s
CI / PostgreSQL 16 integration (pull_request) Successful in 10m37s
CI / PostgreSQL 17 integration (pull_request) Successful in 9m56s
CI / Docker image (pull_request) Successful in 1m48s
fix(jobs): show job log times in local time and give the Type column room; 1.1.1
The Windows hands-on test of 1.1.0 found two things in Jobs. The log under a job showed UTC times (12:35) next to rows
in local time (13:35): the stored log keeps UTC, so a server's jobs read right anywhere, and the desktop now dates the
lines backwards from the job's end and shows them in local time. The Type column cut "Analisi approfondita" at a
0.7* share; a 1* share (90-170 px) fits it in a 1440 px window and still gives way at the 1200 px minimum.

Builds without a release tag say 1.1.1; CHANGELOG [1.1.1], STATUS and DECISIONS updated.

Refs #70

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:26:21 +01:00

277 lines
21 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="Chronos.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:Chronos.Ui.Controls;assembly=Chronos.Ui"
xmlns:v="clr-namespace:Chronos.Ui.Visuals;assembly=Chronos.Ui"
xmlns:l="clr-namespace:Chronos.Ui.Localization;assembly=Chronos.Ui"
xmlns:s="clr-namespace:Chronos.App.Sections"
xmlns:infra="clr-namespace:Chronos.App.Infrastructure"
xmlns:j="clr-namespace:Chronos.App.Jobs">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- The schedule editor (Jobs › Scheduled) opens over the whole screen. -->
<ResourceDictionary Source="pack://application:,,,/Chronos;component/Jobs/ScheduleDialogs.xaml" />
</ResourceDictionary.MergedDictionaries>
<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>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid IsEnabled="{Binding IsContentEnabled}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Toolbar: Queue | Scheduled (owner review 2, R10), then the tab's own tools. -->
<DockPanel Margin="20,12">
<v:SegmentedControl DockPanel.Dock="Left" VerticalAlignment="Center" SelectedIndex="{Binding TabIndex}" AutomationProperties.Name="{l:Loc Jobs.Tab.Name}">
<v:SegmentedItem Content="{l:Loc Jobs.Tab.Queue}" ToolTip="{l:Loc Tooltips.Jobs.Tab.Queue}" AutomationProperties.Name="{l:Loc Jobs.Tab.Queue}" />
<v:SegmentedItem Content="{l:Loc Jobs.Tab.Scheduled}" ToolTip="{l:Loc Tooltips.Jobs.Tab.Scheduled}" AutomationProperties.Name="{l:Loc Jobs.Tab.Scheduled}" />
</v:SegmentedControl>
<Border DockPanel.Dock="Left" Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="14,0" VerticalAlignment="Center" />
<Button DockPanel.Dock="Right" Content="{l:Loc Jobs.Schedule.New}" Command="{Binding Schedules.NewCommand}" ToolTip="{Binding Schedules.NewToolTip}"
ToolTipService.ShowOnDisabled="True" VerticalAlignment="Center" Visibility="{Binding IsScheduled, Converter={StaticResource BoolToVisibility}}" />
<!-- Queue 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 Visibility="{Binding IsQueue, Converter={StaticResource BoolToVisibility}}">
<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>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0,0,0" Visibility="{Binding HasEngine, Converter={StaticResource BoolToVisibility}}">
<Border Style="{StaticResource Pill.Auto}" Margin="0,0,10,0" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Jobs.PriorityQueue}"
Visibility="{Binding IsPriorityQueueOn, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{l:Loc Jobs.PriorityQueue}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" VerticalAlignment="Center" />
</Border>
<TextBlock Text="{Binding ParallelismText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Jobs.Parallelism}" />
</StackPanel>
<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>
</DockPanel>
<!-- ===================== Queue ===================== -->
<Grid Grid.Row="1" Visibility="{Binding IsQueue, Converter={StaticResource BoolToVisibility}}">
<Border 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>
<!-- Kind, Where and State share the width with Target and Progress (Target, whose name is in its tooltip, gives way first), so the actions keep
their room at 1200 px beside the 200 px rail in every language; a cut kind, place, state or header shows whole in its tooltip. On wide
windows Kind, Where and State stop growing and Target takes the rest (Jobs.html). -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28" />
<ColumnDefinition Width="*" MinWidth="90" MaxWidth="170" />
<ColumnDefinition Width="1.6*" MinWidth="84" />
<ColumnDefinition Width="*" MinWidth="104" MaxWidth="240" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="0.6*" MinWidth="80" MaxWidth="140" />
<ColumnDefinition Width="0.7*" MinWidth="116" MaxWidth="170" />
<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" ToolTip="{l:Loc Jobs.Column.Kind}" />
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Target}" Margin="10,0,0,0" ToolTip="{l:Loc Jobs.Column.Target}" />
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Progress}" Margin="10,0,0,0" ToolTip="{l:Loc Jobs.Column.Progress}" />
<TextBlock Grid.Column="4" Style="{StaticResource Text.HeaderEnd}" Text="{l:Loc Jobs.Column.Speed}" Margin="10,0,0,0" ToolTip="{l:Loc Jobs.Column.Speed}" />
<TextBlock Grid.Column="5" Style="{StaticResource Text.HeaderEnd}" Text="{l:Loc Jobs.Column.Left}" Margin="10,0,0,0" ToolTip="{l:Loc Jobs.Column.Left}" />
<TextBlock Grid.Column="6" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.Where}" Margin="16,0,0,0" ToolTip="{l:Loc Jobs.Column.Where}" />
<TextBlock Grid.Column="7" Style="{StaticResource Text.Header}" Text="{l:Loc Jobs.Column.State}" Margin="10,0,0,0" ToolTip="{l:Loc Jobs.Column.State}" />
</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="*" MinWidth="90" MaxWidth="170" />
<ColumnDefinition Width="1.6*" MinWidth="84" />
<ColumnDefinition Width="*" MinWidth="104" MaxWidth="240" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="0.6*" MinWidth="80" MaxWidth="140" />
<ColumnDefinition Width="0.7*" MinWidth="116" MaxWidth="170" />
<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" ToolTip="{Binding Kind}" />
<!-- A job a schedule queued carries the "Scheduled" pill after its target, which gives way first. A running job's
status line (what it does now; where a paused one stopped) sits under the target inside the 38 px row, muted, and is
never announced (DECISIONS row 158). -->
<DockPanel Grid.Column="2" Margin="10,0,0,0">
<Border DockPanel.Dock="Right" Style="{StaticResource Pill.Auto}" Height="20" Padding="7,0" Margin="8,0,0,0" VerticalAlignment="Center"
ToolTip="{l:Loc Tooltips.Jobs.Scheduled}" Visibility="{Binding IsScheduled, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{l:Loc Jobs.Scheduled}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" VerticalAlignment="Center" />
</Border>
<StackPanel VerticalAlignment="Center">
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Target}" ToolTip="{Binding Target}" />
<TextBlock x:Name="Status" Style="{StaticResource Text.Cell}" Text="{Binding StatusText}" ToolTip="{Binding StatusToolTip}"
FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.TextMuted}"
Visibility="{Binding HasStatus, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</DockPanel>
<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" ToolTip="{Binding WhereText}" />
<!-- 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 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>
<!-- ===================== Scheduled ===================== -->
<ContentControl Grid.Row="1" Content="{Binding Schedules}" Focusable="False" Visibility="{Binding IsScheduled, Converter={StaticResource BoolToVisibility}}" />
</Grid>
<!-- The schedule editor over a scrim; the keyboard stays inside it. -->
<Grid DataContext="{Binding Schedules}" Visibility="{Binding IsEditorOpen, Converter={StaticResource BoolToVisibility}}" KeyboardNavigation.TabNavigation="Cycle"
KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
<Border Background="{DynamicResource Brush.Scrim}" />
<ContentPresenter x:Name="DialogHost" Content="{Binding Editor}" Margin="20" />
</Grid>
</Grid>
</UserControl>