Skip to content

Comments

Add multi-printer dual-pane dashboard support#365

Open
pumpCurry wants to merge 4 commits intomainfrom
claude/thirsty-noyce
Open

Add multi-printer dual-pane dashboard support#365
pumpCurry wants to merge 4 commits intomainfrom
claude/thirsty-noyce

Conversation

@pumpCurry
Copy link
Owner

Summary

  • 1ペイン↔2ペイン切り替え: グローバルメニューバー(48px固定)から「ダッシュボード選択...」でプリセット切り替え。#dashboard-rootlayout-preset1 / layout-preset2 クラスを付け外し
  • 2台プリンタのリアルタイム同時監視: chartStateMap(キャンバス要素キー)、cameraStateMap(ホストキー)でグラフ・カメラをマルチインスタンス化。各ペインに p1- / p2- ID接頭辞を付与し getPaneEl(id, paneIndex) で解決
  • 接続設定UI: 新規 ConnSettingsModal<dialog> ベース)でプリンタ名・色・IP・WSポート・CAMポート・自動接続を CRUD 管理。connections[]appSettings に永続化
  • プリンタカラー変数: .printer-pane--printer-color / --printer-color-faint CSS 変数を適用し、カードタイトルバーとカード背景をペイン別に色分け
  • 自動接続復元: 起動時に connections[]autoConnect: true エントリへ 200ms 間隔で順次 connectWs() を呼び出し

変更ファイル (11ファイル、+3216/-607行)

ファイル 種別 主要変更
dashboard_data.js 変更 connections[], activeLayout, paneAssignment 追加
3dp_monitor.html 変更 グローバルメニューバー、2ペイン構造、p1-/p2- ID接頭辞
3dp_monitor.css 変更 960px対応レスポンシブ、2ペインflex、プリンタカラー変数
3dp_dashboard_init.js 変更 getPaneEl() export、全getElementByIdをpaneIndex対応に置換
dashboard_chart.js 変更 chartStateMap(Map)でcanvas別マルチインスタンス化
dashboard_camera_ctrl.js 変更 cameraStateMap でホスト別マルチインスタンス化
dashboard_stage_preview.js 変更 全関数に paneIndex 引数追加
dashboard_connection.js 変更 updateConnectionUI / updatePrinterListUI ペイン対応
dashboard_conn_settings.js 新規 ConnSettingsModal クラス
dashboard_layout_manager.js 新規 setLayout / restoreLayout / assignPrinterToPane / showLayoutSelectDialog
3dp_dashboard_main.js 変更 GMBイベント登録、ペイン2初期化、connections[]自動接続

Test plan

  • start.bathttp://localhost:8000/3dp_monitor.html で既存1ペイン機能(接続・温度グラフ・カメラ・ログ)が正常動作すること
  • ≡ Menu クリックでドロップダウンが開閉すること(外クリックで閉じる)
  • 「接続設定...」でモーダルが開き、プリンタ追加・色設定・自動接続チェック・保存が動作すること
  • 「ダッシュボード選択...」→ Preset 2 で左右2列に分割されること
  • 各ペインのプリンタ選択ドロップダウンで表示プリンタを切り替えられること
  • ブラウザ幅960pxで各ペイン内が縦積みレイアウトになること
  • 色設定後にカードタイトルバーの色が変わること
  • 2台接続時に両ペインがリアルタイムで独立更新されること
  • ページリロード後にレイアウト設定・接続設定・自動接続が復元されること

🤖 Generated with Claude Code

pumpCurry and others added 4 commits February 19, 2026 10:00
Implements 1-pane ↔ 2-pane switchable layout for simultaneous monitoring
of up to 2 printers on a 1920×1080 display, with per-printer color
coding, connection settings modal, and auto-connect restoration.

Key changes:
- dashboard_data.js: add connections[], activeLayout, paneAssignment to appSettings
- 3dp_monitor.html: global menu bar (48px fixed), dual-pane structure, p1-/p2- ID prefixes
- 3dp_monitor.css: 960px-responsive layout, 2-pane flex, --printer-color CSS vars
- 3dp_dashboard_init.js: export getPaneEl(id, paneIndex), full paneIndex support
- dashboard_chart.js: chartStateMap (Map keyed by canvas element) for multi-instance graphs
- dashboard_camera_ctrl.js: cameraStateMap per host, paneIndex-aware stream start/stop
- dashboard_stage_preview.js: paneIndex param on all preview functions
- dashboard_connection.js: updateConnectionUI/updatePrinterListUI pane-aware (p${n}- prefix)
- dashboard_conn_settings.js: new ConnSettingsModal class (<dialog>-based CRUD UI)
- dashboard_layout_manager.js: new setLayout/restoreLayout/assignPrinterToPane/showLayoutSelectDialog
- 3dp_dashboard_main.js: global menu bar events, pane-2 init, connections[] auto-connect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…domProps ID prefix

- 3dp_dashboard_main.js: fix outside-click handler using menuBtn.contains() instead of
  e.target !== menuBtn, preventing dropdown from closing immediately after open
- dashboard_stage_preview.js:79: fix querySelector using single-quotes instead of
  backticks, causing literal '#p${paneIndex}-' string instead of template expansion
- dashboard_printmanager.js: add paneIndex param to initHistoryTabs(), use p${n}- prefix
  for tab/panel IDs; guard against null elements with early return
- 3dp_dashboard_init.js: pass paneIndex to printManager.initHistoryTabs(paneIndex)
- dashboard_ui.js: domProps getElementById falls back through p1-/p2- prefixed IDs
  before bare ID, fixing 'element not found' warnings for bedTempSlider etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Module-top-level getElementById calls (tab-received, log, notification-history, etc.)
ran before DOM was ready and used bare IDs that no longer exist (now p1-/p2- prefixed).

- Add _getEl(id) helper: tries p1-/p2- prefix then falls back to bare id
- Convert module-level const refs to let, resolved lazily via _resolveLogEls()
- Call _resolveLogEls() at start of initUIEventHandlers()
- Fix adjustPrintCurrentCardPosition() to use _getEl() for graph-current-wrapper,
  print-current-card, print-history-card

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…itle-bar UI

Problem: title-bar contained destination-input, auto-connect-toggle, camera-toggle-title
which drove the old connection flow. These conflicted with the new connections[] system.

Changes:
- dashboard_conn_settings.js: add autoCamera checkbox to each connection entry
  (saved as conn.autoCamera flag in connections[]); add autoCamera:false to new entries
- dashboard_connection.js: handleSocketOpen now checks connections[].autoCamera for the
  connecting host instead of global appSettings.cameraToggle (falls back to cameraToggle
  for backwards compat)
- 3dp_dashboard_init.js: remove event bindings for destination-input, connect-button,
  auto-connect-toggle, camera-toggle-title; remove wsDest-based auto-connect on load
  (now handled by _autoConnectAll() in 3dp_dashboard_main.js)
- 3dp_monitor.html (pane-1 & pane-2): remove destination-input, auto-connect-toggle,
  camera-toggle-title; keep destination-display, connection-status, connect/disconnect
  buttons (used by updateConnectionUI)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant