feat: add backend status indicator and restart controls#6
Open
randroid88 wants to merge 1 commit into
Open
Conversation
Add a live backend connection status indicator (green/red/yellow dot) to the toolbar with adaptive health polling (1s retry when offline, 5s when online). Include restart/start controls in both Electron (IPC-based) and browser mode (Vite dev middleware). - New BackendStatusDot component with color-coded status - Extract IS_ELECTRON and startBackend() to shared utils/env.ts - Add BackendStatus type to project types - Backend section in Settings panel with status + restart button - Vite plugin to spawn backend in browser dev mode - Electron IPC handler for backend:restart
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Before
No visibility into whether the backend is running. If the backend crashes or hasn't started, the user gets cryptic fetch errors with no guidance.
After
A status dot in the toolbar provides instant feedback:
The Settings panel shows a dedicated Backend section with the status, backend URL, and a restart/start button that works in both Electron and browser mode.
Implementation details
BackendStatusDot: Color-coded dot component with tooltiputils/env.ts: SharedIS_ELECTRONconstant,startBackend()helper, status labels — replaces scattered!!window.electronAPIcheckseditorStore: NewbackendStatus+setBackendStatusstateSettingsPanel: Backend status section with restart buttonApp.tsx: Health-check pollinguseEffectwith adaptive intervalelectron/main.js:backend:restartIPC handler (stops, waits 600ms for port release, restarts)vite.config.ts:backendLauncherVite plugin —POST /api/start-backendspawns the Python backend in browser dev mode, with 2s crash cooldownFiles changed
frontend/src/types/project.tsBackendStatustypefrontend/src/utils/env.tsIS_ELECTRON,startBackend(),BACKEND_STATUS_LABELfrontend/src/components/BackendStatusDot.tsxfrontend/src/store/editorStore.tsbackendStatus,setBackendStatusfrontend/src/store/aiStore.tsIS_ELECTRONfrom env.tsfrontend/src/components/SettingsPanel.tsxfrontend/src/App.tsxfrontend/src/vite-env.d.tsrestartBackendto ElectronAPIfrontend/vite.config.tsbackendLauncherpluginelectron/main.jsbackend:restartIPC handlerelectron/preload.jsrestartBackendTest plan
npm run dev:frontend), click "Start Backend" — backend spawns via Vite middleware