.. _frontend-pages: ===== Pages ===== This page documents the page components in ``frontend/src/pages/``. Each page corresponds to a route in the application. ---- RunListPage =========== :Location: ``src/pages/RunListPage.tsx`` :Route: ``/`` or ``/runs`` The main dashboard showing all simulation runs. Features -------- - Lists all runs with status indicators - Automatic refresh (polls every 5 seconds) - Filter by status (completed, running, failed) - Click to navigate to run details - "New Run" button to create a simulation Implementation -------------- .. code-block:: text function RunListPage() { const navigate = useNavigate() const { data, isLoading } = useQuery({ queryKey: ['runs'], queryFn: () => runsApi.list(), refetchInterval: 5000, }) return (

Simulation Runs

{isLoading ? ( ) : (
{data?.runs.map((run) => ( navigate(`/runs/${run.id}`)} /> ))}
)}
) } ---- NewRunPage ========== :Location: ``src/pages/NewRunPage.tsx`` :Route: ``/runs/new`` Form for creating a new simulation run. Features -------- - Run ID input (auto-generated if empty) - Optional display name - Template selection dropdown - Configuration editor (Monaco) for customization - Validation before submission Implementation -------------- .. code-block:: text function NewRunPage() { const navigate = useNavigate() const [runId, setRunId] = useState('') const [template, setTemplate] = useState('minimal.ini') const [configContent, setConfigContent] = useState('') const { data: templates } = useQuery({ queryKey: ['templates'], queryFn: configsApi.listTemplates, }) const createMutation = useMutation({ mutationFn: runsApi.create, onSuccess: (run) => navigate(`/runs/${run.id}`), }) const handleSubmit = () => { createMutation.mutate({ run_id: runId || undefined, template, config_content: configContent, }) } return (

New Simulation Run

{selectedNode !== null && ( )}
{topology && ( )}
) } ---- ConfigEditorPage ================ :Location: ``src/pages/ConfigEditorPage.tsx`` :Route: ``/config`` INI configuration file editor. Features -------- - Template selection dropdown - Monaco editor with INI syntax highlighting - Dark/light theme support - Copy to clipboard - Use with new run (navigates to NewRunPage with config) Implementation -------------- .. code-block:: text function ConfigEditorPage() { const [template, setTemplate] = useState(null) const [content, setContent] = useState('') const { theme } = useTheme() const { data: templates } = useQuery({ queryKey: ['templates'], queryFn: configsApi.listTemplates, }) const { data: templateData } = useQuery({ queryKey: ['template', template], queryFn: () => configsApi.getTemplate(template!), enabled: !!template, }) useEffect(() => { if (templateData) { setContent(templateData.content) } }, [templateData]) return (