fix(ui): Mission Control no longer lists finished operations as running
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c834f17c78
commit
e9c1ff2e70
@@ -158,22 +158,26 @@ public sealed partial class MissionControlViewModel : ViewModelBase, IDisposable
|
||||
{
|
||||
var snapshot = await _worker.GetActiveOperationsAsync();
|
||||
RunningOperations.Clear();
|
||||
foreach (var op in snapshot.OrderBy(o => o.StartedAt))
|
||||
foreach (var op in snapshot.Where(o => !_endedOperationIds.Contains(o.Id)).OrderBy(o => o.StartedAt))
|
||||
RunningOperations.Add(new RunningOperationViewModel(op));
|
||||
NotifyOperationsChanged();
|
||||
}
|
||||
catch (Exception ex) { ErrorReported?.Invoke(Loc.T("missionControl.operationsRefreshFailed", ex.Message)); }
|
||||
}
|
||||
|
||||
/// <summary>Ids already reported ended; guards against a late Started or a stale snapshot re-adding them. Op ids are unique, so it is never pruned (a few bytes per op).</summary>
|
||||
private readonly HashSet<string> _endedOperationIds = new();
|
||||
|
||||
private void AddOperation(RunningOperationDto op)
|
||||
{
|
||||
if (RunningOperations.Any(r => r.Id == op.Id)) return;
|
||||
if (_endedOperationIds.Contains(op.Id) || RunningOperations.Any(r => r.Id == op.Id)) return;
|
||||
RunningOperations.Add(new RunningOperationViewModel(op));
|
||||
NotifyOperationsChanged();
|
||||
}
|
||||
|
||||
private void RemoveOperation(string id)
|
||||
{
|
||||
_endedOperationIds.Add(id);
|
||||
var row = RunningOperations.FirstOrDefault(r => r.Id == id);
|
||||
if (row is null) return;
|
||||
RunningOperations.Remove(row);
|
||||
|
||||
Reference in New Issue
Block a user