Skip to content

Commit 5a07293

Browse files
Count failed operations in the operations panel header (#5567)
1 parent 1757d47 commit 5a07293

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/UniGetUI.Avalonia/ViewModels/MainWindowViewModel.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,15 @@ public string OperationsHeaderText
9999
int total = _operationBatch.Count;
100100
if (total == 0)
101101
return CoreTools.Translate("Operations");
102+
// Name the failures, so a collapsed panel does not read as "all good" when some failed.
103+
int failed = _operationBatch.Count(o => o.Status is OperationStatus.Failed);
104+
if (failed > 0)
105+
{
106+
int succeeded = _operationBatch.Count(o => o.Status is OperationStatus.Succeeded);
107+
return CoreTools.Translate("{0} of {1} succeeded, {2} failed", succeeded, total, failed);
108+
}
102109
int completed = _operationBatch.Count(o =>
103-
o.Status is OperationStatus.Succeeded or OperationStatus.Failed or OperationStatus.Canceled);
110+
o.Status is OperationStatus.Succeeded or OperationStatus.Canceled);
104111
return CoreTools.Translate("{0} of {1} operations completed", completed, total);
105112
}
106113
}

0 commit comments

Comments
 (0)