mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 11:12:35 +02:00
Operator-flipped out-of-service state per printer for three scenarios: parallel Bambuddy installs (dev + prod where the printer rejects all but one MQTT client), printers under repair, and temporary suspension. The backend Printer.is_active gate has shipped since day one and is already honoured by every consumer — MQTT (printer_manager), queue dispatch (print_scheduler, print_queue), metrics, scheduler, picker, backup, maintenance dashboard. The missing piece was UI exposure. Three entry points to flip is_active: - Three-dot overflow menu (Enter / Exit maintenance mode, wrench icon) - Exit button inside the in-card amber panel - Checkbox in EditPrinterModal Card UI: expanded mode shows an amber panel (Wrench + "In Maintenance" + subtitle + Exit) where the cover/progress container would normally render — same height, no layout shift. Compact mode shows an amber pill in place of the progress bar. Header pill swaps Connected/Offline for "Maintenance" and the diagnostic CTA is suppressed (deliberate state, not involuntary offline). HMS / Queue / Firmware pills fall away naturally via the existing status?.connected gates. Mid-print entry (RUNNING / PAUSE) triggers a confirmation dialog — disconnecting MQTT mid-print stops progress tracking and completion notifications for the in-flight job. Idle / FINISH / FAILED skip the dialog and toggle directly. Scope: no backend change, no new permission, no behaviour change for any other consumer. PrinterCreate.is_active?: boolean added to the TypeScript surface so the field flows through api.updatePrinter.
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])