fix(app): the view-name dialog and remote cards follow the reviewed dialog kit

Save view and Rename view use the growing label column and show a failed
save as one sentence in the dialog. The Library reads a remote card's
proxy cache off the UI thread, sets a sequence's folder left to right and
centres the Rating chevron. A sequence back in the index refuses a
restore with SequenceInLibraryException, tested with the one-sentence
causes of a refused delete or restore.

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-06 20:42:36 +00:00
1 parent a4ceb89247
commit 007c5b281d
5 files changed
+46 -7

No files matched your search

+3 -2
View File
@@ -139,7 +139,8 @@ public sealed class LibraryActions(ShellViewModel shell)
NotConnected();
return null;
}
if (remote.Service.OpenRemote(remote.Server, sequence.Id) is not null)
// The proxy cache is read off the UI thread: its manifest holds every frame.
if (await Task.Run(() => remote.Service.OpenRemote(remote.Server, sequence.Id)) is not null)
{
shell.OpenSequence(sequence.Id);
return null;
@@ -223,7 +224,7 @@ public sealed class LibraryActions(ShellViewModel shell)
/// <summary>The project of a remote card: from its proxy cache when it was opened here, else from the server's manifest; and its frame size when cached.</summary>
private static async Task<(ProjectSettings Project, int Width, int Height)> RemoteProjectAsync(RemoteSource remote, Guid id)
{
if (remote.Service.OpenRemote(remote.Server, id) is { } cached)
if (await Task.Run(() => remote.Service.OpenRemote(remote.Server, id)) is { } cached)
{
var frame = cached.Frames.FirstOrDefault(f => f.Width > 0);
var size = frame is null ? (0, 0) : frame.Orientation is >= 5 and <= 8 ? (frame.Height, frame.Width) : (frame.Width, frame.Height);
@@ -1,7 +1,9 @@
using System.Windows.Input;
using Titano.App.Archiving;
using Titano.App.Settings;
using Titano.Core.Diagnostics;
using Titano.Core.Localization;
using Titano.Data;
using Titano.Ui.Mvvm;
namespace Titano.App.Library;
@@ -38,12 +40,18 @@ public sealed class ViewNameDialogViewModel : ArchiveDialogViewModel
private async Task SaveAsync()
{
ClearError();
IsBusy = true;
try
{
await _save(Name.Text.Trim());
Close();
}
catch (DatabaseException ex)
{
Log.Warning("library", "Saving a view failed", ex);
ShowError(ex);
}
finally
{
IsBusy = false;
+7 -5
View File
@@ -91,10 +91,10 @@
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
<Grid Margin="0,14,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
<ColumnDefinition Width="Auto" MinWidth="116" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="{l:Loc Library.Views.Name}" Style="{StaticResource Text.Label}" />
<TextBlock Text="{l:Loc Library.Views.Name}" Style="{StaticResource Text.DialogLabel}" />
<TextBox Grid.Column="1" Text="{Binding Name.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Name}"
ToolTip="{Binding Name.ToolTip}" AutomationProperties.Name="{l:Loc Library.Views.Name}" />
</Grid>
@@ -103,7 +103,7 @@
ToolTip="{Binding SaveToolTip}" IsDefault="True" MinWidth="96" Margin="8,0,0,0" />
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
MinWidth="96" />
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
<ui:StatusGlyph Style="{StaticResource Status.DialogError}" Margin="0,0,12,0" />
</DockPanel>
</StackPanel>
</Border>
@@ -370,7 +370,9 @@
<TextBlock Grid.Row="5" Style="{StaticResource Text.Label}" Text="{l:Loc Library.Column.Size}" />
<TextBlock Grid.Row="5" Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding SizeText}" />
<TextBlock Grid.Row="6" Style="{StaticResource Text.Label}" Text="{l:Loc Library.Column.Folder}" VerticalAlignment="Top" Margin="0,4,14,0" />
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sequence.Folder}" TextWrapping="Wrap" Margin="0,4,0,0" />
<!-- A folder path reads left to right in every language. -->
<TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding Sequence.Folder}" TextWrapping="Wrap" Margin="0,4,0,0" FlowDirection="LeftToRight"
HorizontalAlignment="Left" />
<TextBlock Grid.Row="7" Style="{StaticResource Text.Label}" Text="{l:Loc Library.Column.Tags}" VerticalAlignment="Top" Margin="0,8,14,0" />
<TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding TagsText}" TextWrapping="Wrap" Margin="0,8,0,0" />
</Grid>
@@ -411,7 +413,7 @@
<Button Style="{StaticResource Button.Bar}" Click="OnOpenMenu" IsEnabled="{Binding CanRate}" ToolTip="{Binding RateToolTip}" AutomationProperties.Name="{l:Loc Library.Action.Rate}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{l:Loc Library.Action.Rate}" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" VerticalAlignment="Center" />
</StackPanel>
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding RatingChoices}" ItemContainerStyle="{StaticResource MenuItem.Rating}" />
@@ -1,6 +1,8 @@
using System.Globalization;
using System.IO;
using Titano.App.Archiving;
using Titano.App.Infrastructure;
using Titano.Core.Archiving;
using Titano.Core.Localization;
using Titano.Core.Model;
using Titano.Data.Archiving;
@@ -77,4 +79,14 @@ public sealed class DeletePlansTests
Assert.Equal(Loc.Plural("Archive.Delete.More", 6), lines[^1]);
Assert.False(request.IsDetailMonospaced, "names read in the UI font, not the fingerprint font");
}
[Test]
public void ARefusedDeleteOrRestoreSaysWhyInOneSentence()
{
Assert.Equal(Loc.L("Archive.Error.StalePlan"), ArchiveFailures.Cause(new StaleDeletePlanException(Guid.NewGuid())));
Assert.Equal(Loc.L("Archive.Error.InLibrary", "Harbour sunset"), ArchiveFailures.Cause(new SequenceInLibraryException(Guid.NewGuid(), "Harbour sunset")));
Assert.Equal(Loc.L("Archive.Error.NewerFormat", "sequence.json", 9), ArchiveFailures.Cause(new NewerFormatException("/a/2026/x/.titano/sequence.json", 9)));
Assert.Equal(Loc.L("Archive.Failed.Files"), ArchiveFailures.Cause(new DirectoryNotFoundException("/a/.titano/trash/0123 is not in the trash")),
"the engine's own words stay in the log");
}
}
@@ -174,6 +174,22 @@ public abstract class SequenceTrashTests(TestContext context) : DatabaseTest(con
Assert.Equal(entry.Name, again.Name);
}
[Test]
public async Task ASequenceBackInTheIndexIsNotRestoredOverIt()
{
var fx = await FixtureAsync();
var sequences = await PopulateAsync(fx);
var victim = sequences[1];
var entry = (await fx.Service.DeleteAsync(await fx.Service.PlanDeleteAsync([victim.Id], null, fx.Ct), null, null, fx.Ct)).Single();
await fx.Db.Sequences.UpsertAsync(victim);
var refused = await Assert.ThrowsAsync<SequenceInLibraryException>(() => fx.Service.RestoreAsync(fx.Archive.Id, entry.Name, fx.Ct));
Assert.Equal(victim.Id, refused.SequenceId);
Assert.False(Directory.Exists(fx.Paths.Sequence(victim.Folder).Folder), "nothing moved");
Assert.Equal(entry.Name, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Single().Name);
}
[Test]
public async Task ARestoreIntoATakenFolderUsesAFreeOneAndKeepsRendersReachable()
{