From abcd8592b5c6e38554a1a54e9824ec09ad3b6bdb Mon Sep 17 00:00:00 2001 From: Abhinav Sinha Date: Tue, 9 Jun 2026 16:50:34 +0530 Subject: [PATCH] fix: execute teardown on active scenario's progress reset Signed-off-by: Abhinav Sinha --- frontend/src/components/ScenarioPanel.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/ScenarioPanel.jsx b/frontend/src/components/ScenarioPanel.jsx index c416b26..bfd4d5e 100644 --- a/frontend/src/components/ScenarioPanel.jsx +++ b/frontend/src/components/ScenarioPanel.jsx @@ -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