feat(ui): mission control detach/redock toggle, clear review panes, reorder helper
This commit is contained in:
@@ -59,8 +59,11 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(ShowRoadblockCard))]
|
||||
[NotifyPropertyChangedFor(nameof(HasRoadblock))]
|
||||
private string? _roadblocks;
|
||||
|
||||
public bool HasRoadblock => !string.IsNullOrWhiteSpace(Roadblocks);
|
||||
|
||||
public bool ShowRoadblockCard =>
|
||||
!string.IsNullOrWhiteSpace(Roadblocks)
|
||||
&& (IsWaitingForReview || IsDone || IsFailed || IsCancelled);
|
||||
@@ -139,6 +142,16 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
|
||||
Roadblocks = null;
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(DetachTooltip))]
|
||||
private bool _isDetached;
|
||||
|
||||
// Localized tooltip for the detach/re-dock toggle button.
|
||||
public string DetachTooltip => Loc.T(IsDetached ? "missionControl.redock" : "missionControl.detach");
|
||||
|
||||
// Set by the detached window so the re-dock action can close it.
|
||||
public Action? CloseWindowRequested { get; set; }
|
||||
|
||||
// Set by the host (e.g. Mission Control) to navigate the main app to this task.
|
||||
public Action<string>? OpenInAppRequested { get; set; }
|
||||
|
||||
@@ -146,7 +159,11 @@ public sealed partial class TaskMonitorViewModel : ViewModelBase, IDisposable
|
||||
public Action<TaskMonitorViewModel>? DetachRequested { get; set; }
|
||||
|
||||
[RelayCommand]
|
||||
private void Detach() => DetachRequested?.Invoke(this);
|
||||
private void Detach()
|
||||
{
|
||||
if (IsDetached) CloseWindowRequested?.Invoke(); // re-dock: close the detached window
|
||||
else DetachRequested?.Invoke(this); // detach: pop out to its own window
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenInApp()
|
||||
|
||||
@@ -77,12 +77,14 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
|
||||
private void Detach(TaskMonitorViewModel monitor)
|
||||
{
|
||||
if (!Monitors.Contains(monitor)) return;
|
||||
monitor.IsDetached = true;
|
||||
Monitors.Remove(monitor); // drop from grid — do NOT dispose; it keeps streaming
|
||||
ShowDetached?.Invoke(monitor, () => ReDock(monitor));
|
||||
}
|
||||
|
||||
private void ReDock(TaskMonitorViewModel monitor)
|
||||
{
|
||||
monitor.IsDetached = false;
|
||||
if (!Monitors.Contains(monitor) && monitor.SubscribedTaskId is not null)
|
||||
Monitors.Add(monitor); // back into the grid
|
||||
}
|
||||
@@ -106,13 +108,22 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
|
||||
[RelayCommand]
|
||||
private void ClearFinished()
|
||||
{
|
||||
foreach (var m in Monitors.Where(m => m.IsDone || m.IsFailed || m.IsCancelled).ToList())
|
||||
foreach (var m in Monitors.Where(m => m.IsDone || m.IsFailed || m.IsCancelled || m.IsWaitingForReview).ToList())
|
||||
{
|
||||
Monitors.Remove(m);
|
||||
m.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveMonitor(TaskMonitorViewModel dragged, TaskMonitorViewModel target)
|
||||
{
|
||||
if (ReferenceEquals(dragged, target)) return;
|
||||
var from = Monitors.IndexOf(dragged);
|
||||
var to = Monitors.IndexOf(target);
|
||||
if (from < 0 || to < 0) return;
|
||||
Monitors.Move(from, to);
|
||||
}
|
||||
|
||||
private void OnMonitorsChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
ColumnCount = Monitors.Count switch
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace ClaudeDo.Ui.Views.MissionControl;
|
||||
@@ -5,4 +6,18 @@ namespace ClaudeDo.Ui.Views.MissionControl;
|
||||
public partial class TaskMonitorWindow : Window
|
||||
{
|
||||
public TaskMonitorWindow() => InitializeComponent();
|
||||
|
||||
protected override void OnOpened(EventArgs e)
|
||||
{
|
||||
base.OnOpened(e);
|
||||
if (DataContext is ClaudeDo.Ui.ViewModels.Islands.TaskMonitorViewModel vm)
|
||||
vm.CloseWindowRequested = Close;
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
if (DataContext is ClaudeDo.Ui.ViewModels.Islands.TaskMonitorViewModel vm)
|
||||
vm.CloseWindowRequested = null;
|
||||
base.OnClosed(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user