feat(ui): wire avalonia desktop ui to data and worker
App: build a ServiceProvider in Program.cs (AppSettings, SqliteConnectionFactory, all repositories, GitService, WorkerClient, all view-models), apply schema, then hand control to Avalonia. App.OnFrameworkInitializationCompleted resolves MainWindowViewModel from the container. Ui: - AppSettings POCO loaded from ~/.todo-app/ui.config.json (db path, hub url). - WorkerClient wraps HubConnection with auto-reconnect, exposes IsConnected and ActiveTasks plus C# events for TaskStarted/Finished/Message/Updated and WorktreeUpdated; all inbound events are marshalled to the UI thread. - ViewModels: MainWindow (lists CRUD via ListEditor dialog), TaskList (load by list, add/edit/delete, auto WakeQueue on agent+queued create), TaskItem (RunNow gated on connection + status), TaskDetail (description, result, live ndjson rolling buffer of 500 lines, worktree branch/diff with merge/keep/ discard via GitService), StatusBar, ListEditor, TaskEditor. - Views: 3-pane MainWindow (lists | tasks | detail) with GridSplitters, status bar, dialog windows for the editors. Status badges via StatusColorConverter. - Markdown rendering, folder picker, delete-confirmation, settings dialog and scroll-to-bottom on the live log are intentionally TODO -- functional scaffold only. Tests: also debounce the FIFO queue test (poll instead of Task.Delay(200)) so the assertion isn't racy when the suite runs alongside the slower git tests. 38 tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
93
src/ClaudeDo.Ui/Views/TaskDetailView.axaml
Normal file
93
src/ClaudeDo.Ui/Views/TaskDetailView.axaml
Normal file
@@ -0,0 +1,93 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:ClaudeDo.Ui.ViewModels"
|
||||
xmlns:conv="using:ClaudeDo.Ui.Converters"
|
||||
x:Class="ClaudeDo.Ui.Views.TaskDetailView"
|
||||
x:DataType="vm:TaskDetailViewModel">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="8" Spacing="8"
|
||||
IsVisible="{Binding Title, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
||||
|
||||
<!-- Header -->
|
||||
<TextBlock Text="{Binding Title}" FontWeight="Bold" FontSize="16"/>
|
||||
<Border CornerRadius="3" Padding="6,2" HorizontalAlignment="Left"
|
||||
Background="{Binding StatusText, Converter={x:Static conv:StatusColorConverter.Instance}}">
|
||||
<TextBlock Text="{Binding StatusText}" Foreground="White" FontSize="11"/>
|
||||
</Border>
|
||||
|
||||
<!-- Description -->
|
||||
<TextBlock Text="Description" FontWeight="SemiBold" Margin="0,8,0,2"/>
|
||||
<!-- TODO: Markdown rendering -->
|
||||
<TextBox Text="{Binding Description, Mode=OneWay}" IsReadOnly="True"
|
||||
AcceptsReturn="True" TextWrapping="Wrap" MinHeight="60"
|
||||
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock Text="(no description)" Foreground="Gray" FontStyle="Italic"
|
||||
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
|
||||
|
||||
<!-- Result -->
|
||||
<TextBlock Text="Result" FontWeight="SemiBold" Margin="0,8,0,2"/>
|
||||
<!-- TODO: Markdown rendering -->
|
||||
<TextBox Text="{Binding Result, Mode=OneWay}" IsReadOnly="True"
|
||||
AcceptsReturn="True" TextWrapping="Wrap" MinHeight="80"
|
||||
IsVisible="{Binding Result, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBlock Text="(no result yet)" Foreground="Gray" FontStyle="Italic"
|
||||
IsVisible="{Binding Result, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
|
||||
|
||||
<!-- Log path -->
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"
|
||||
IsVisible="{Binding LogPath, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
|
||||
<TextBlock Text="Log:" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding LogPath}" FontSize="11" Foreground="Gray" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Live stream -->
|
||||
<TextBlock Text="Live Output" FontWeight="SemiBold" Margin="0,8,0,2"/>
|
||||
<Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Padding="4"
|
||||
MaxHeight="200">
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{Binding LiveLines}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" FontFamily="Consolas,Courier New,monospace"
|
||||
FontSize="11" TextWrapping="NoWrap"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<!-- Worktree section -->
|
||||
<Border IsVisible="{Binding HasWorktree}" BorderBrush="CornflowerBlue"
|
||||
BorderThickness="1" CornerRadius="5" Padding="8" Margin="0,8,0,0">
|
||||
<StackPanel Spacing="6">
|
||||
<TextBlock Text="Worktree" FontWeight="Bold" FontSize="14"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<TextBlock Text="Branch:" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding BranchName}" FontFamily="Consolas,Courier New,monospace"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<TextBlock Text="State:" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="{Binding WorktreeState}"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="Diff Stat:" FontWeight="SemiBold"
|
||||
IsVisible="{Binding DiffStat, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<TextBox Text="{Binding DiffStat, Mode=OneWay}" IsReadOnly="True"
|
||||
AcceptsReturn="True" FontFamily="Consolas,Courier New,monospace" FontSize="11"
|
||||
IsVisible="{Binding DiffStat, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
|
||||
<!-- Worktree actions -->
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,4,0,0">
|
||||
<Button Content="Open Worktree" Command="{Binding OpenWorktreeCommand}" Margin="0,0,4,4"/>
|
||||
<Button Content="Show Diff" Command="{Binding ShowDiffCommand}" Margin="0,0,4,4"/>
|
||||
<Button Content="Merge into main" Command="{Binding MergeIntoMainCommand}"
|
||||
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
|
||||
<Button Content="Keep as branch" Command="{Binding KeepAsBranchCommand}"
|
||||
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
|
||||
<Button Content="Discard" Command="{Binding DiscardCommand}"
|
||||
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user