fix: execute teardown on active scenario's progress reset

Signed-off-by: Abhinav Sinha <[email protected]>
This commit is contained in:
Abhinav Sinha
2026-06-09 16:50:34 +05:30
parent 30fb302155
commit abcd8592b5
+7 -1
View File
@@ -145,7 +145,10 @@ export default function ScenarioPanel({ scenario, onProgressUpdate, onScenarioSt
className={styles.resetBtn}
title="Reset progress for this scenario"
onClick={async () => {
if (!window.confirm(`Reset progress for "${scenario.title}"?`)) return
const msg = scenario.type === 'task'
? `Reset progress and cluster state for "${scenario.title}"?\n\nThis will run teardown to clean the environment.`
: `Reset progress for "${scenario.title}"?`
if (!window.confirm(msg)) return
await resetProgress('scenario', { scenarioId: scenario.id })
setSelectedOption(null)
setMcqResult(null)
@@ -153,6 +156,9 @@ export default function ScenarioPanel({ scenario, onProgressUpdate, onScenarioSt
setSetupState('idle')
setHintsRevealed([])
onProgressUpdate()
if (scenario.type === 'task') {
await fetch(`/api/scenarios/${scenario.id}/teardown`, { method: 'POST' }).catch(() => {})
}
}}
>
Reset