Commit Graph
1847 Commits
Author SHA1 Message Date
maziggy b6b83a6360 Added a persistent loading toast with spinner for backup exports that include print archives:
Changes to ToastContext.tsx:
  - Added 'loading' toast type with a spinning Loader2 icon
  - Added showPersistentToast(id, message, type) function for toasts that don't auto-dismiss
  - Exposed dismissToast(id) function to allow programmatic dismissal
  - Added green-themed styling for loading toasts

  Changes to SettingsPage.tsx:
  - When exporting a backup that includes archives, shows a persistent "Preparing backup..." toast with spinner
  - The toast is automatically dismissed when the download starts or if an error occurs
  - For non-archive backups (which are fast), no loading toast is shown

  The user will now see clear feedback when creating a backup with print archives - a toast with a spinner appears immediately after clicking export and stays visible
  until the download dialog appears.
2025-12-12 16:12:30 +01:00
maziggy a14dcbc034 Frontend WebSocket Tests Summary
Expanded the useWebSocket.test.ts from minimal coverage to 20 comprehensive tests covering:

  WebSocket Mock Tests (6 tests)

  - Creates WebSocket with correct URL
  - Starts in CONNECTING state
  - Transitions to OPEN state
  - Can receive messages
  - Can close connection
  - Tracks all instances

  Hook Connection Tests (2 tests)

  - Connects to WebSocket on mount
  - Reports connected state when WebSocket opens

  Message Handling Tests (9 tests)

  - Updates printer status in query cache on printer_status message
  - Preserves wifi_signal when new value is null
  - Invalidates archives on print_complete message
  - Invalidates archives on archive_created message
  - Invalidates archives on archive_updated message (new handler for timelapse auto-assignment)
  - Ignores pong messages without error
  - Handles malformed JSON gracefully
  - Handles unknown message types gracefully

  sendMessage Tests (2 tests)

  - Sends JSON message when connected
  - Does not send when disconnected

  Reconnection Tests (2 tests)

  - Reconnects after connection closes
  - Cleans up on unmount

  Key Fixes

  - Fixed MSW (Mock Service Worker) conflict by:
    a. Adding addEventListener/removeEventListener to MockWebSocket class
    b. Updating MSW setup to bypass WebSocket requests
    c. Properly managing WebSocket mock lifecycle in each test

  Test Results:
  - Frontend: 137 tests passed (9 test files)
  - Backend: 346 tests passed
2025-12-12 15:52:35 +01:00
maziggy ee2b674278 Issue 1: Print Start Notification - Estimated Time Unknown
Problem: At print start, the MQTT mc_remaining_time was often 0 or unavailable because the printer hadn't fully processed the gcode yet.

  Solution: Modified the notification system to prioritize the print_time_seconds from the 3MF file parsing (which is always available after archive creation) over the
  MQTT remaining time.

  Files changed:
  - backend/app/services/notification_service.py:
    - Added optional archive_data parameter to on_print_start() method
    - Added priority logic: archive data > MQTT remaining_time > raw_data mc_remaining_time
  - backend/app/main.py:
    - Created _send_print_start_notification() helper function
    - Moved notification sending to AFTER archive creation (when print_time_seconds is available)
    - Added fallback notification sending at early return points (auto_archive disabled, file not found, etc.)

  Issue 2: Timelapse Auto-Assignment

  Problem: Timelapses couldn't be auto-assigned reliably because printer dates could be off in LAN-only mode, making timestamp matching unreliable.

  Solution: Track whether timelapse recording was active during the print via MQTT, and if so, auto-fetch the most recent timelapse file on print completion.

  Files changed:
  - backend/app/services/bambu_mqtt.py:
    - Added _timelapse_during_print instance variable
    - Track when timelapse is active during a print (in both data and xcam parsing)
    - Reset the flag on new print start
    - Include timelapse_was_active in the print complete callback data
  - backend/app/main.py:
    - Added timelapse auto-scan logic in on_print_complete()
    - If timelapse_was_active is True and status is "completed":
        - Wait 5 seconds for timelapse to finalize
      - Scan printer's timelapse directory
      - Find most recent file by mtime
      - Verify it was modified within 30 minutes of print completion
      - Download and attach to archive
      - Send WebSocket update
2025-12-12 15:35:46 +01:00
maziggy 3a0890145b Fix unused variable in test file causing Docker build failure 2025-12-12 14:48:41 +01:00
MartinNYHC 5d8ca6bfa4 Merge pull request #21 from maziggy/0.1.5b
Notifications:

    Separate AMS and AMS-HT notification switches (one per device type)
    Fix notification variables not showing (duration, filament, estimated_time)
    Add fallback values for empty notification variables ("Unknown" instead of blank)

Settings:

    Fix API keys badge count only showing after visiting tab
    Move External Links card to third column above Updates
    Add Release Notes modal for viewing full notes before updating

Statistics:

    Fix filament usage trends not showing (wrong API parameters)
    Move dashboard controls (Hidden, Reset Layout) to header row

Camera:

    Fix ffmpeg processes not killed when closing webcam window
    Add /camera/stop endpoint with POST support for sendBeacon
    Track active streams and proper cleanup on disconnect

Documentation:

    Update README with missing features (camera streaming, AMS/AMS-HT monitoring,
    chamber control, printer control, AI detection, calibration, energy tracking,
    database backup/restore, system info dashboard)
    
Test environment:
    Added frontend and backend tests for newly added features
2025-12-12 11:22:02 +01:00
maziggy f7cde95bbb Tests Added Summary:
Backend Tests (New Files)

  1. backend/tests/integration/test_camera_api.py - 13 tests
    - Camera stop endpoint (GET and POST methods)
    - Active stream termination
    - Printer-specific stream stopping
    - Camera test endpoint
    - Camera snapshot endpoint
    - Camera stream validation
  2. backend/tests/integration/test_system_api.py - 16 tests
    - System info endpoint structure
    - App, database, storage, memory, CPU sections
    - Helper functions (format_bytes, format_uptime)
    - Archive statistics
    - Printer connection info
  3. backend/tests/unit/services/test_telemetry.py - 16 tests
    - Installation ID creation/retrieval
    - Telemetry enabled/disabled checks
    - Telemetry URL configuration
    - Heartbeat sending and rate limiting
    - Exception handling
  4. backend/tests/unit/services/test_notification_service.py (updated) - Added TestNotificationVariableFallbacks class with 9 tests
    - Duration formatting with None values
    - Print complete fallback values
    - Estimated time and remaining time fallbacks
    - Filename fallback to "Unknown"

  Frontend Tests (New Files)

  5. frontend/src/__tests__/pages/SystemInfoPage.test.tsx - 14 tests
    - Loading and error states
    - Application, database, storage, memory, CPU sections
    - Connected printers display
    - Disk usage warning/danger colors
    - Refresh button
  6. frontend/src/__tests__/components/AMSHistoryModal.test.tsx - 21 tests
    - Modal open/close behavior
    - Humidity/temperature mode switching
    - Time range selection
    - Statistics cards (current, avg, min, max)
    - Loading and error states
    - Trend calculation
  7. frontend/src/__tests__/components/NotificationProviderCard.test.tsx (updated) - Added NotificationProviderCard AMS toggles describe block with 11 tests
    - AMS humidity/temperature notification toggles
    - AMS-HT humidity/temperature notification toggles
    - Independence of AMS and AMS-HT toggles
    - Default values

  Total New Tests: ~100 tests covering:
  - Camera API endpoints
  - System info API
  - Anonymous telemetry service
  - Notification variable fallbacks
  - System Info page UI
  - AMS History modal UI
  - AMS/AMS-HT notification toggle settings

  Tests Added - Complete Summary:

  Backend Tests (4 new files, 1 updated)

  | File                                                       | Tests | Description                                                     |
  |------------------------------------------------------------|-------|-----------------------------------------------------------------|
  | tests/integration/test_camera_api.py                       | 13    | Camera stop (GET/POST), snapshot, stream, test endpoints        |
  | tests/integration/test_system_api.py                       | 16    | System info API, helper functions (format_bytes, format_uptime) |
  | tests/unit/services/test_telemetry.py                      | 16    | Installation ID, telemetry toggle, heartbeat sending            |
  | tests/unit/services/test_notification_service.py (updated) | +10   | Variable fallbacks for duration, filename, estimated_time       |

  Frontend Tests (2 new files, 1 updated)

  | File                                                                 | Tests | Description                                           |
  |----------------------------------------------------------------------|-------|-------------------------------------------------------|
  | src/__tests__/pages/SystemInfoPage.test.tsx                          | 14    | System info page UI, sections, loading/error states   |
  | src/__tests__/components/AMSHistoryModal.test.tsx                    | 21    | AMS history modal, mode switching, time ranges, stats |
  | src/__tests__/components/NotificationProviderCard.test.tsx (updated) | +11   | AMS/AMS-HT notification toggle independence           |

  Total: 101 new tests
  - Backend: 335 tests total (all passing)
  - Frontend: 124 tests total (all passing)
2025-12-12 11:15:59 +01:00
maziggy 745f192b10 Added visitor counter 2025-12-12 10:53:53 +01:00
maziggy dededf3c5a Added visitor counter 2025-12-12 10:49:04 +01:00
maziggy 83be67539f Added visitor counter 2025-12-12 10:46:24 +01:00
MartinNYHC 3a45155b42 Merge pull request #20 from maziggy/0.1.5b
Notifications:

    Separate AMS and AMS-HT notification switches (one per device type)
    Fix notification variables not showing (duration, filament, estimated_time)
    Add fallback values for empty notification variables ("Unknown" instead of blank)

Settings:

    Fix API keys badge count only showing after visiting tab
    Move External Links card to third column above Updates
    Add Release Notes modal for viewing full notes before updating

Statistics:

    Fix filament usage trends not showing (wrong API parameters)
    Move dashboard controls (Hidden, Reset Layout) to header row

Camera:

    Fix ffmpeg processes not killed when closing webcam window
    Add /camera/stop endpoint with POST support for sendBeacon
    Track active streams and proper cleanup on disconnect

Documentation:

    Update README with missing features (camera streaming, AMS/AMS-HT monitoring,
    chamber control, printer control, AI detection, calibration, energy tracking,
    database backup/restore, system info dashboard)
2025-12-12 10:39:37 +01:00
maziggy 6571643a4c 1. Wiki links updated to http://wiki.bambuddy.cool:
- Header navigation link
    - Installation guide link
    - Documentation section with all 5 doc links
    - Footer documentation link
  2. Screenshots updated with new images:
    - Replaced old maintenance screenshots with maintenance-1.png and maintenance-2.png
    - Replaced old profile screenshots with cloud_profiles-1.png, cloud_profiles-2.png, k_profiles-1.png, k_profiles-2.png
    - Replaced old settings screenshots with settings_general.png, settings_smart_plugs.png, settings_notifications.png, settings_api_keys.png
    - Removed old unused screenshot files from docs/screenshots/
2025-12-12 10:37:36 +01:00
MartinNYHC 8680113d6a Merge pull request #19 from maziggy/0.1.5b
Notifications:
  - Separate AMS and AMS-HT notification switches (one per device type)
  - Fix notification variables not showing (duration, filament, estimated_time)
  - Add fallback values for empty notification variables ("Unknown" instead of blank)

  Settings:
  - Fix API keys badge count only showing after visiting tab
  - Move External Links card to third column above Updates
  - Add Release Notes modal for viewing full notes before updating

  Statistics:
  - Fix filament usage trends not showing (wrong API parameters)
  - Move dashboard controls (Hidden, Reset Layout) to header row

  Camera:
  - Fix ffmpeg processes not killed when closing webcam window
  - Add /camera/stop endpoint with POST support for sendBeacon
  - Track active streams and proper cleanup on disconnect

  Documentation:
  - Update README with missing features (camera streaming, AMS/AMS-HT monitoring,
    chamber control, printer control, AI detection, calibration, energy tracking,
    database backup/restore, system info dashboard)
v0.1.5b6
2025-12-12 09:38:56 +01:00
maziggy 2953d2cc3c Changed version to 0.1.5b6; uodated CHANGELOG 2025-12-12 09:36:17 +01:00
maziggy 722ae5b45b Updated README 2025-12-12 09:32:44 +01:00
maziggy 1a4f146dd0 Notifications:
- Separate AMS and AMS-HT notification switches (one per device type)
  - Fix notification variables not showing (duration, filament, estimated_time)
  - Add fallback values for empty notification variables ("Unknown" instead of blank)

  Settings:
  - Fix API keys badge count only showing after visiting tab
  - Move External Links card to third column above Updates
  - Add Release Notes modal for viewing full notes before updating

  Statistics:
  - Fix filament usage trends not showing (wrong API parameters)
  - Move dashboard controls (Hidden, Reset Layout) to header row
  - Remove duplicate Reset Layout button

  Camera:
  - Fix ffmpeg processes not killed when closing webcam window
  - Add /camera/stop endpoint with POST support for sendBeacon
  - Track active streams and proper cleanup on disconnect
2025-12-12 09:18:59 +01:00
maziggy f4cc71b41a Updated CHANGELOG.md 2025-12-11 14:58:40 +01:00
maziggy b6a7dabbab Disbaled CI temp. 2025-12-11 14:56:04 +01:00
MartinNYHC 424d7ea6f3 Merge pull request #18 from maziggy/0.1.5b
Changelog (v0.1.5b4 → v0.1.5b5)

New Features

    Mobile PWA Support - Progressive Web App support for mobile devices
    AMS Humidity/Temperature History - Clickable indicators open charts with 6h/24h/48h/7d history, min/max/avg statistics, and threshold reference lines
    Webhooks & API Keys - API key authentication with granular permissions for external integrations
    System Info Page - New page showing system information
    Multi-plate Cover Image - Archive cards now show cover image of the printed plate for multi-plate files
    Quick Notification Disable - Button to quickly disable notifications
    Projects / Print Grouping - Group related prints into projects with progress tracking
    Full-Text Search (FTS5) - Efficient search across print names, filenames, tags, notes, designer, and filament type
    Failure Analysis - Dashboard widget showing failure rate with correlations and trends
    Archive Comparison - Compare 2-5 archives side-by-side with highlighted differences
    CSV/Excel Export - Export archives and statistics with current filters

Improvements

    Improved archive card context menu with submenu support
    Improved notification scheduler and templates
    Improved auto power off scheduler
    Improved email notification provider
    Configurable AMS data retention (default 30 days)

Bug Fixes

    Fixed bug where not all AMS spools were synced to Spoolman
    Fixed bug where external links were not respected by hotkeys
    Fixed context menu submenu not showing
    Fixed project card thumbnails using correct API endpoint
    Fixed archive PATCH 500 error (FTS5 index rebuild)
    Fixed clipboard API fallback for HTTP contexts

Infrastructure

    Added comprehensive automated testing (pytest, vitest, playwright)
    GitHub Actions CI/CD workflow for automated testing
    Removed PWA push notifications
v0.1.5b5
2025-12-11 14:53:50 +01:00
maziggy a7c1fe6d4f Changed version to 0.1.5b5 2025-12-11 14:49:07 +01:00
maziggy 7048bafff3 Added anonymous stats 2025-12-11 13:35:59 +01:00
maziggy 77a66ea867 Added system info page 2025-12-11 12:45:38 +01:00
maziggy 2e5c42b383 For multi plates files, archive card now shows cover image of printed plate 2025-12-11 12:32:18 +01:00
maziggy 5efb7ab2c8 Improved archive card context menu 2025-12-11 12:26:37 +01:00
maziggy 5ead2296c4 Improved notification scheduler and templates 2025-12-11 12:11:31 +01:00
maziggy ea6d84031a Removed PWA P´push notification 2025-12-11 11:37:13 +01:00
maziggy 2f1ac92598 Restored some files that were deleted by mistake 2025-12-11 11:15:25 +01:00
maziggy df6b00b312 Improved automated testing infrastructure 2025-12-11 10:33:03 +01:00
maziggy ff53e62ef8 Add comprehensive automated testing infrastructure
Backend:
  - pytest configuration with async support and coverage
  - Unit tests for notification service (23 tests)
  - Unit tests for smart plug manager (12 tests)
  - Unit tests for archive service (16 tests)
  - Integration tests for API endpoints
  - Fix: notifications now send immediately (digest is summary only)

  Frontend:
  - Vitest configuration with jsdom and coverage
  - MSW for API mocking
  - Component tests for Toggle, Button, Card, ConfirmModal (77 tests)
  - Test utilities with custom render wrapper

  CI/CD:
  - GitHub Actions workflow for automated testing
  - Backend lint, unit tests, integration tests
  - Frontend lint, type-check, unit tests, build
2025-12-11 10:03:40 +01:00
maziggy c3026632da Improved auto power off scheduler 2025-12-11 08:02:15 +01:00
maziggy e392597192 Added notification module for AMS humidity and temperature 2025-12-10 20:02:22 +01:00
maziggy 0dc76746b4 Add AMS humidity/temperature history tracking with charts
- Add database model for storing AMS sensor history (humidity, temperature)
  - Record sensor data every 5 minutes via background task
  - Add API endpoint to retrieve history with min/max/avg statistics
  - Create AMSHistoryModal component with Recharts line charts
  - Make humidity/temperature indicators clickable to open history
  - Support time range selection (6h, 24h, 48h, 7d)
  - Show threshold reference lines on charts (Good/Fair levels)
  - Add configurable data retention (default 30 days) in Settings
  - Auto-cleanup old data daily
  - Fix dark theme styling in modal using inline styles
  - Add Escape key to close modal
2025-12-10 19:45:38 +01:00
maziggy ca2eb5d052 Added quick button to disable notification 2025-12-10 19:13:47 +01:00
maziggy dbcbde0b16 Improved email notification provider 2025-12-10 19:12:49 +01:00
maziggy 9cdce0d603 Updated README; Added new screenshots 2025-12-10 17:41:37 +00:00
maziggy 596956c5c6 Updated README; Added new screenshots 2025-12-10 17:33:35 +00:00
maziggy 09bdb183b9 Updated README; Added new screenshots 2025-12-10 17:27:10 +00:00
maziggy d1518083fc ## New Features
### Projects / Print Grouping
  - Create projects to group related prints (e.g., "Voron Build" with 50 parts)
  - Track progress with target count and completion percentage
  - Assign archives to projects via edit modal or context menu
  - Project cards show archive thumbnails with clickable links
  - Color-coded project badges on archive cards
  - Filter and manage projects by status (active/completed/archived)

  ### Full-Text Search (FTS5)
  - SQLite FTS5 virtual table for efficient searching
  - Search across print_name, filename, tags, notes, designer, filament_type
  - Automatic index sync with triggers for INSERT/UPDATE/DELETE

  ### Webhooks & API Keys
  - API key authentication with granular permissions
  - Permissions: can_read_status, can_manage_queue, can_control_printer
  - Secure key generation with prefix display only after creation
  - Settings page API Keys tab for key management
  - Webhook endpoints for external integrations

  ### Failure Analysis
  - Dashboard widget showing failure rate with color coding
  - Correlate failures with conditions (filament type, printer, time)
  - Top failure reasons breakdown
  - Weekly trend visualization

  ### Archive Comparison
  - Select 2-5 archives to compare side-by-side
  - Highlight differences in print settings (yellow)
  - Success/failure correlation insights
  - Modal with close via button, X, Escape, or backdrop

  ### CSV/Excel Export
  - Export archives and statistics with current filters
  - Support for both CSV and Excel (.xlsx) formats
  - openpyxl dependency added

  ## Bug Fixes
  - Fixed context menu submenu not showing (removed overflow-hidden)
  - Fixed project card thumbnails using correct API endpoint
  - Fixed EditArchiveModal to invalidate projects query on save
  - Fixed clipboard API fallback for HTTP contexts
  - Fixed archive PATCH 500 error (FTS5 index rebuild)
  - Fixed FastAPI trailing slash routing for projects endpoint

  ## UI Improvements
  - Context menu submenu with hover/click support
  - Project badge on archive cards with project color
  - "Go to Project" context menu item for assigned archives
  - Clickable project card thumbnails linking to archives
  - Reset Layout button moved to Stats page header
2025-12-10 17:06:43 +00:00
maziggy 60ec159c97 Added CHANGELOG.md 2025-12-10 12:53:44 +00:00
maziggy 711140ddf9 Added mobile PWA support 2025-12-10 11:21:25 +00:00
maziggy 107d94e938 Added playwright tests 2025-12-10 10:23:17 +00:00
maziggy 83fc278b75 Fixed bug where not all AMS spools were synced to Spoolman 2025-12-10 10:02:11 +00:00
maziggy 53fcc2846f Fixed bug where external links were not respected by hotkeys 2025-12-10 09:46:06 +00:00
maziggy f317ead3c6 Fixed bug where external links were not respected by hotkeys 2025-12-10 09:44:47 +00:00
MartinNYHC e1aa557862 Merge pull request #17 from maziggy/0.1.5b
0.1.5b4

- Removed debug logs for backup/restore module
- Fixed a bug in notification module where newly added notification types were not respected
- External links can now be embedded into sidebar navigation
- Added embedded external links to backup/restore module
- Add comprehensive mobile support with responsive navigation
- Fixed layout for external link icons
- Improved external link module
- Add comprehensive documentation
- Moved documentation to it's own repository
- Added issue/pull request templates
- Added Docker support
- Added filament spool fill levels to printer card
- Changed version to 0.1.5b4
v0.1.5b4
2025-12-10 09:57:55 +01:00
MartinNYHC 39810e9f36 Merge branch 'main' into 0.1.5b 2025-12-10 09:57:35 +01:00
maziggy 8bd404951e Changed version to 0.1.5b4 2025-12-10 08:51:21 +00:00
maziggy ef927985e4 Added filament spool fill levels to printer card 2025-12-10 08:47:12 +00:00
maziggy 0194a0498e Added Docker support 2025-12-09 17:25:17 +00:00
maziggy 8ce64ff38b Added Docker support 2025-12-09 17:10:31 +00:00
maziggy 8618159baa Added Docker support 2025-12-09 17:09:09 +00:00