fix(ui): surface interactive/planning launch errors in footer

This commit is contained in:
Mika Kuns
2026-06-23 08:41:03 +02:00
parent 9301bbc81a
commit 134b9fb598
4 changed files with 33 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
public event EventHandler? TasksChanged;
public event Action? NotesRequested;
public event Action? PrepRequested;
public event Action<string>? ErrorReported;
public void RequestFocusAddTask() => FocusAddTaskRequested?.Invoke(this, EventArgs.Empty);
[RelayCommand]
@@ -770,7 +771,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
if (row.Status != TaskStatus.Idle || row.PlanningPhase != PlanningPhase.None) return;
ForegroundHelper.AllowAny();
try { await _worker!.StartPlanningSessionAsync(row.Id); }
catch { }
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.planningOpenFailed", ex.Message)); }
}
[RelayCommand]
@@ -779,7 +780,7 @@ public sealed partial class TasksIslandViewModel : ViewModelBase, IDisposable
if (row is null || _worker is null) return;
ForegroundHelper.AllowAny();
try { await _worker.OpenInteractiveTerminalAsync(row.Id); }
catch { }
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("vm.tasksIsland.runInteractiveFailed", ex.Message)); }
}
[RelayCommand]

View File

@@ -125,6 +125,17 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
WorkerLogText = null;
}
// Surfaces a UI-originated failure in the footer status strip (same line as the
// worker log), color-coded as an error and auto-cleared by _clearTimer.
public void FlashFooterError(string message)
{
WorkerLogText = $"{DateTime.Now:HH:mm} · {message}";
WorkerLogLevel = WorkerLogLevel.Error;
IsWorkerLogVisible = true;
_clearTimer.Stop();
_clearTimer.Start();
}
private void OnPrimeFired(PrimeFiredEvent evt)
{
var when = evt.FiredAt.LocalDateTime.ToString("HH:mm");
@@ -181,6 +192,7 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
Tasks.SelectionChanged += (_, _) => Details.Bind(Tasks.SelectedTask);
Tasks.NotesRequested += () => Details.ShowNotes();
Tasks.PrepRequested += () => Details.ShowPrep();
Tasks.ErrorReported += FlashFooterError;
Tasks.TasksChanged += (_, _) => _ = Lists.RefreshCountsAsync();
Tasks.OpenListSettingsRequested += (_, _) =>
{