feat(app): server sync table, conflict resolution, sync options and Library sync glyphs

SyncHost runs the sync agent of the signed-in session and gives transfer jobs
their connection; the Server screen lists every sequence of this PC and of the
server with its state and actions (upload, download originals, open with
proxies, keep mine / take server / save both, pause, resume), filter chips,
search, Upload all local and the comparison footer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 22:53:24 +00:00
1 parent c02d1867d0
commit 25653c052b
16 files changed
+1072 -10

No files matched your search

+1 -1
View File
@@ -497,7 +497,7 @@ public sealed class LibraryViewModel : SectionViewModel
{
if (await _db.Sequences.GetAsync(item.Id) is { } fresh) item.Update(fresh);
}
if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit) await RefreshAsync();
if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit or JobKind.Download) await RefreshAsync();
}
catch (DatabaseException ex)
{
+107 -1
View File
@@ -15,9 +15,12 @@
<Setter Property="Margin" Value="8,0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<ItemsPanelTemplate x:Key="Panel.Row">
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</UserControl.Resources>
<!-- Server.html: the connection panel; the render-node panel (right) and the sync table (below) join later. -->
<!-- Server.html: the connection panel, then the sync table; the render-node panel joins the connection panel. -->
<Grid Margin="20,16,20,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -112,9 +115,112 @@
<Border Grid.Row="3" Grid.ColumnSpan="2" Margin="0,14,0,0" Padding="0,10,0,0" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,0">
<WrapPanel>
<CheckBox Content="{l:Loc Server.RenderNode}" IsChecked="{Binding RenderNodeOptIn}" ToolTip="{l:Loc Tooltips.Server.RenderNode}" Margin="0,0,22,0" />
<CheckBox Content="{l:Loc Server.KeepProxies}" IsChecked="{Binding KeepProxiesOffline}" ToolTip="{l:Loc Tooltips.Server.KeepProxies}" Margin="0,0,22,0" />
<CheckBox Content="{l:Loc Server.AutoSync}" IsChecked="{Binding SyncSettingsAutomatically}" ToolTip="{l:Loc Tooltips.Server.AutoSync}" Margin="0,0,22,0" />
</WrapPanel>
</Border>
</Grid>
</Border>
<!-- Sequences of this PC and of the server: chips, search, Upload all local; table; footer. -->
<Border Grid.Row="1" Style="{StaticResource Border.Panel}" Margin="0,14,0,0" DataContext="{Binding Sync}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DockPanel Margin="14,10" LastChildFill="False">
<TextBlock Text="{l:Loc Server.Sync.Title}" FontWeight="SemiBold" VerticalAlignment="Center" Margin="0,0,10,0" />
<Button DockPanel.Dock="Right" Content="{l:Loc Server.Sync.UploadAll}" Command="{Binding UploadAllCommand}" ToolTip="{Binding UploadAllToolTip}"
Height="30" Margin="10,0,0,0" />
<TextBox DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}" ui:Field.Glyph="{StaticResource Icon.Search}"
ui:Field.Placeholder="{l:Loc Server.Sync.Search}" ToolTip="{l:Loc Tooltips.Server.Sync.Search}" AutomationProperties.Name="{l:Loc Server.Sync.Search}" />
<ItemsControl ItemsSource="{Binding Chips}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False" VerticalAlignment="Center">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type srv:SyncFilterChip}">
<Button x:Name="Chip" Style="{StaticResource Button.Chip}" Content="{Binding Text}" Tag="{Binding IsSelected}" Command="{Binding SelectCommand}"
ToolTip="{Binding ToolTip}" Height="28" FontSize="12" Margin="0,0,10,0" Typography.NumeralAlignment="Tabular" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding NeedsAttention}" Value="True">
<Setter TargetName="Chip" Property="BorderBrush" Value="{DynamicResource Brush.Warning}" />
<Setter TargetName="Chip" Property="Foreground" Value="{DynamicResource Brush.Warning}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DockPanel>
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr, here stars with minimums). -->
<Border Grid.Row="1" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,1" Padding="14,8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*" MinWidth="140" />
<ColumnDefinition Width="*" MinWidth="110" />
<ColumnDefinition Width="*" MinWidth="110" />
<ColumnDefinition Width="*" MinWidth="120" />
<ColumnDefinition Width="1.6*" MinWidth="330" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Sequence}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Local}" Margin="10,0,0,0" />
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Server}" Margin="10,0,0,0" />
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.State}" Margin="10,0,0,0" />
</Grid>
</Border>
<!-- Rows (virtualised): this PC, the server, the state and the actions that apply. -->
<ListBox Grid.Row="2" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" AutomationProperties.Name="{l:Loc Server.Sync.Title}"
Visibility="{Binding HasRows, Converter={StaticResource BoolToVisibility}}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type srv:SyncRow}">
<Grid Height="40" Background="Transparent" Margin="14,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*" MinWidth="140" />
<ColumnDefinition Width="*" MinWidth="110" />
<ColumnDefinition Width="*" MinWidth="110" />
<ColumnDefinition Width="*" MinWidth="120" />
<ColumnDefinition Width="1.6*" MinWidth="330" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Title}" ToolTip="{Binding Title}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding LocalText}" Margin="10,0,0,0" />
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding ServerText}" Margin="10,0,0,0" />
<ui:StatusGlyph Grid.Column="3" Kind="{Binding StateKind}" Text="{Binding StateText}" ToolTip="{Binding StateToolTip}"
FontSize="13" VerticalAlignment="Center" Margin="10,0,0,0" />
<ItemsControl Grid.Column="4" ItemsSource="{Binding Actions}" ItemsPanel="{StaticResource Panel.Row}" Focusable="False"
VerticalAlignment="Center" Margin="10,0,0,0">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type srv:SyncRowAction}">
<Button Style="{StaticResource Button.Row}" Content="{Binding Text}" Command="{Binding Command}" ToolTip="{Binding ToolTip}" FontSize="12" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ui:EmptyState Grid.Row="2" Message="{Binding EmptyText}" Visibility="{Binding EmptyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
<!-- Footer: last comparison · server archive · retry state · admin panel. -->
<Border Grid.Row="3" 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 Server.Sync.OpenAdmin}" Command="{Binding OpenAdminCommand}"
ToolTip="{l:Loc Tooltips.Server.Sync.OpenAdmin}" Visibility="{Binding CanOpenAdmin, Converter={StaticResource BoolToVisibility}}" />
<TextBlock Text="{Binding LastSyncText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,0,16,0" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Server.Sync.LastSync}"
Visibility="{Binding LastSyncText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
<TextBlock Text="{Binding ArchiveText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,0,16,0" VerticalAlignment="Center"
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Server.Sync.Archive}"
Visibility="{Binding ArchiveText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
<ui:StatusGlyph Kind="Warning" Text="{Binding ErrorText}" ToolTip="{Binding ErrorToolTip}" FontSize="12" VerticalAlignment="Center"
Visibility="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
</DockPanel>
</Border>
</Grid>
</Border>
</Grid>
</UserControl>
+32 -3
View File
@@ -10,9 +10,9 @@ using Titano.Ui.Mvvm;
namespace Titano.App.Sections;
/// <summary>
/// Server, connection part (BRIEF §12.7, Server.html): address with LAN-discovered servers, connect with
/// trust-on-first-use and login, status (name, version, latency, certificate), account and quota, sign out, and
/// the render-node opt-in. The sync table and render-node panel join this screen later.
/// Server (BRIEF §12.7, Server.html): address with LAN-discovered servers, connect with trust-on-first-use and login,
/// status (name, version, latency, certificate), account and quota, sign out, the options of this PC (render node,
/// proxies kept offline, automatic project sync) and the sync table (<see cref="Sync"/>).
/// </summary>
public sealed class ServerViewModel : SectionViewModel
{
@@ -34,8 +34,12 @@ public sealed class ServerViewModel : SectionViewModel
else if (p is string text) Address = text;
});
CertificateCommand = new RelayCommand(ShowCertificate, () => Fingerprint is not null);
Sync = new SyncTableViewModel(shell);
}
/// <summary>Sequences of this PC and of the server, where they stand and what can be done.</summary>
public SyncTableViewModel Sync { get; }
public ShellViewModel Shell { get; }
private ServerSession Session => _session ?? Shell.Services.Server;
@@ -134,6 +138,20 @@ public sealed class ServerViewModel : SectionViewModel
}
}
/// <summary>Keep the proxies of every server sequence without local originals on this PC.</summary>
public bool KeepProxiesOffline
{
get => Shell.Services.Settings.KeepProxiesOffline;
set => SetSyncOption(value, Shell.Services.Settings.KeepProxiesOffline, v => Shell.Services.Settings.KeepProxiesOffline = v);
}
/// <summary>Send and take project settings changed on one side without asking.</summary>
public bool SyncSettingsAutomatically
{
get => Shell.Services.Settings.SyncSettingsAutomatically;
set => SetSyncOption(value, Shell.Services.Settings.SyncSettingsAutomatically, v => Shell.Services.Settings.SyncSettingsAutomatically = v);
}
/// <summary>Re-reads values another screen changed (Settings › Server).</summary>
public void Refresh() => OnPropertyChanged(nameof(RenderNodeOptIn));
@@ -149,6 +167,7 @@ public sealed class ServerViewModel : SectionViewModel
if (Address.Length == 0 && Session.Discovered.Count > 0) Address = Session.Discovered[0].Address;
};
if (!Shell.Services.Environment.IsCapture) _session.StartDiscovery();
Sync.Attach();
await _session.RestoreAsync();
if (_session.Flow.Error is not ConnectError.None and var error && !_session.IsConnected) ErrorText = ServerSession.ErrorText(error);
}
@@ -156,9 +175,19 @@ public sealed class ServerViewModel : SectionViewModel
public override void Dispose()
{
if (_session is not null) _session.PropertyChanged -= OnSessionChanged;
Sync.Dispose();
base.Dispose();
}
private void SetSyncOption(bool value, bool current, Action<bool> store, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
{
if (value == current) return;
store(value);
Shell.Services.SaveSettings();
Shell.Services.Sync.RequestRefresh();
OnPropertyChanged(name);
}
private async Task ConnectAsync()
{
ErrorText = null;