Skip to content

Commit faac331

Browse files
feat: show worktree/branch artifact counts in clear history confirmation
1 parent 0d68985 commit faac331

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

frontend/src/pages/Schedules.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ export function Schedules() {
6969
const [clearRunsOpen, setClearRunsOpen] = useState(false)
7070
const [runToDelete, setRunToDelete] = useState<number | null>(null)
7171

72+
const clearableRuns = useMemo(() => (runs ?? []).filter((run) => run.status !== 'running'), [runs])
73+
const clearableWorktrees = useMemo(() => clearableRuns.filter((run) => run.worktreePath).length, [clearableRuns])
74+
const clearableBranches = useMemo(() => clearableRuns.filter((run) => run.runBranch).length, [clearableRuns])
75+
7276
useEffect(() => {
7377
if (scheduleTab === 'prompts') {
7478
setScheduleTab('jobs')
@@ -364,7 +368,23 @@ export function Schedules() {
364368
onConfirm={handleClearHistory}
365369
onCancel={() => setClearRunsOpen(false)}
366370
title="Clear run history"
367-
description="This permanently deletes all finished runs for this schedule along with their git run branches and worktrees. A run in progress is kept. This cannot be undone."
371+
description={
372+
<>
373+
<p className="mb-2">This permanently deletes all <strong>{clearableRuns.length}</strong> finished run{clearableRuns.length === 1 ? '' : 's'} for this schedule.</p>
374+
{clearableBranches > 0 && (
375+
<p className="mb-1">Git artifacts that will be pruned:</p>
376+
)}
377+
<ul className="list-disc pl-5 space-y-0.5 text-sm text-muted-foreground">
378+
{clearableWorktrees > 0 && (
379+
<li><strong>{clearableWorktrees}</strong> worktree{clearableWorktrees === 1 ? '' : 's'}</li>
380+
)}
381+
{clearableBranches > 0 && (
382+
<li><strong>{clearableBranches}</strong> run branch{clearableBranches === 1 ? '' : 'es'}</li>
383+
)}
384+
</ul>
385+
<p className="mt-2">A run in progress is kept. This cannot be undone.</p>
386+
</>
387+
}
368388
isDeleting={clearRunsMutation.isPending}
369389
/>
370390

0 commit comments

Comments
 (0)