frontend: run-now + save-as-scenario + edit form (CRUD complete)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Three small UX wins:

- /scenarios/:id Run now — POSTs /simulate with the scenario's params
  and renders the result in a "Live preview run" card below the
  persisted projection. Removes the recompute-or-wait friction.

- /what-if Save as scenario — appears once a simulation has run.
  Prompts for a name (with a sensible default), POSTs the form values
  to /scenarios as a user scenario, redirects to its detail page.

- /scenarios/:id/edit — PATCH form for user scenarios. Pre-fills from
  current scenario; on save invalidates the scenarios query and
  navigates back to detail. Backend already rejects PATCH on
  cartesian; the UI also hides the Edit button for them.

api.scenarios gained patch(). 7 tests pass, typecheck + build clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-05-09 22:20:21 +00:00
parent 18981459b3
commit cb79118da7
5 changed files with 359 additions and 9 deletions

View file

@ -5,6 +5,7 @@ import { api } from '@/api/client';
import { Compare } from '@/pages/Compare';
import { Dashboard } from '@/pages/Dashboard';
import { ScenarioDetail } from '@/pages/ScenarioDetail';
import { ScenarioEdit } from '@/pages/ScenarioEdit';
import { ScenarioNew } from '@/pages/ScenarioNew';
import { Scenarios } from '@/pages/Scenarios';
import { WhatIf } from '@/pages/WhatIf';
@ -44,6 +45,7 @@ export function App() {
<Route path="/scenarios" element={<Scenarios />} />
<Route path="/scenarios/new" element={<ScenarioNew />} />
<Route path="/scenarios/:id" element={<ScenarioDetail />} />
<Route path="/scenarios/:id/edit" element={<ScenarioEdit />} />
<Route path="/compare" element={<Compare />} />
<Route path="/what-if" element={<WhatIf />} />
</Routes>