-
Notifications
You must be signed in to change notification settings - Fork 26
Macro System Enhancements and Service Tracking #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Q1WP
wants to merge
27
commits into
buildbotics:master
Choose a base branch
from
Q1WP:feature/macros-and-service-tracking
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Macro System Enhancements and Service Tracking #355
Q1WP
wants to merge
27
commits into
buildbotics:master
from
Q1WP:feature/macros-and-service-tracking
Conversation
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
Macro Enhancements: - Add dedicated Macros page with top-level menu item - Implement tab system for organizing macros into groups - Add visibility toggle to show/hide macros on control page - Add confirmation dialog option before running macros - Display macro tabs as clickable tab bar on control page - Settings tab appears in tab bar linking to Macros page Service Tracking: - Add dedicated Service page with dashboard, items, and notes views - Track power-on, spindle, and motion hours automatically - Support configurable maintenance intervals per hour type - Display service warning banner on control page when items are due - Add service completion history and manual hour entry - Include export functionality for service data Control Page: - Macro tab bar now always visible with Settings tab on right - Service warning banner shows count of due maintenance items
Service Page Navbar: - Add Login button for unauthenticated users (far right) - Add Save button that appears when changes are pending - Add "Saved" status indicator when no pending changes - Use spacer to push action buttons to far right Dirty Form Tracking: - Track modified state for item and note editors - Show confirmation dialog when navigating away with unsaved changes - Add Cancel button confirmation to prevent accidental data loss - Implement markModified(), clearModified(), checkUnsavedChanges() helpers Service Items Layout: - Move status badge (duration) next to label instead of far right - Relocate action buttons to vertical column on right side of card - Add visual separator between content and actions - Complete button now always visible (not just when due) Dashboard Upcoming List: - Display duration inline with label using pill-style badge - Keep interval info on right as secondary information - Improve visual grouping of related information Form Fixes: - Fix input overflow in Add Item editor using flexbox rows - Remove non-functional .small class from button elements - Apply button sizing via container CSS instead
Macro List Layout: - Restructure as two-row records for better readability - Row 1: drag grip, index, visibility, confirm, tab, color, delete - Row 2: name and file inputs (indented to align with content) - Move drag handle to far left of each row - Simplify index display (remove "#", lighter weight) - Align header text with column centers Delete Confirmations: - Add confirmation dialog before deleting macros - Add confirmation dialog before deleting tabs - Tab deletion shows count of macros that will be moved Styling: - Consistent column widths between header and rows - Uppercase labels for Name/File fields - Improved visual hierarchy with row grouping
Navbar Styling: - Switch both Service and Macros pages to dark navbar (buildbotics#333 background) - Consistent styling with light text and hover effects Service Items: - Move action buttons to single row below item content - Add text labels to all buttons (Mark Complete, Edit, Delete) - Change color bar from vertical left to horizontal top Service Item Editor: - Label field on full-width row - Track By, Interval, and Color on second row - Normalize input heights to 38px Macros Layout: - Add spacer column to push Color and Trash to far right - Widen color picker area for better hex input display - Move trash icon to far right column Macros Navbar: - Add button changes contextually (Add Macro vs Add Tab) - Remove redundant Add Tab button from Tabs content area
Service Page: - Move Add Item and Add Note buttons to navbar (context-sensitive) - Notes card layout matches Items (buttons on bottom row) - Add text labels to note Edit/Delete buttons - Remove Add buttons from content areas Macros Page: - Column order: Grip, Index, Visible, Confirm, Tab, Color, [spacer], Trash - Color picker positioned after Tab dropdown (not pushed far right) - Trash icon pushed to far right via spacer - Grip icon enlarged (16px, darker color) - Hex input height/padding/font matches file input exactly Consistency: - Both pages use navbar for context-sensitive Add buttons - Both pages have dark navbar with summary/metrics bar below - Action button rows have consistent styling across Items and Notes
System Alerts: - Add alerts section below header for upgrade and service notifications - Upgrade alert: Shows when new firmware available with link to settings - Service alert: Shows count of due items with link to service page - Both alerts are dismissible (X button) - Dismissals stored in sessionStorage (reset on browser close) - Dismissal resets when upgrade version changes or new items become due Camera Visibility: - Add camera_available to state from Python backend - Hide camera menu item when camera not available - Hide camera video preview in header when not available - Works on all screen sizes (not just mobile) Files Changed: - src/pug/index.pug - Add alerts section, conditional camera visibility - src/js/app.js - Add alert computed properties and dismiss methods - src/stylus/style.styl - Add alert styling (warning/info colors) - src/py/bbctrl/State.py - Add camera_available to state snapshot
Macros View Changes: - Reverted to single row layout (cleaner, less busy) - All columns on one row: Grip, #, Visible, Confirm, Tab, Color, Name, File, Actions - Better column spacing and alignment - Headers centered over column content - Tab select and Color picker have more spacing between them - Name and File fields back on same row as other columns - Folder and Trash icons together in actions column on right - Hex input styled consistently (28px height, 0.85em font) Service Tracking - Remove Spindle Hours: - Removed spindle_hours from Service.py (not all users have machine-controlled spindles) - Removed spindle tracking from State.py (no more spindle_started/spindle_stopped) - Updated service-template.json (removed spindle_hours from hours section) - Updated view-service.pug (removed Spindle from hours bar) - Updated view-service.js (removed spindleHours computed, hourTypes, labels) - Service items can now only track: Power-On Hours or Motion Hours Files Changed: - src/pug/templates/view-macros.pug - Single row layout - src/stylus/view-macros.styl - Updated column styles - src/pug/templates/view-service.pug - Removed spindle hours display - src/js/view-service.js - Removed spindle computed/methods - src/py/bbctrl/Service.py - Removed spindle tracking - src/py/bbctrl/State.py - Removed spindle state tracking - src/resources/service-template.json - Removed spindle_hours
Macros View Changes: - Reverted to single row layout (cleaner, less busy) - All columns on one row: Grip, #, Visible, Confirm, Tab, Color, Name, File, Actions - Better column spacing and alignment - Headers centered over column content - Tab select and Color picker have more spacing between them - Name and File fields back on same row as other columns - Folder and Trash icons together in actions column on right - Hex input styled consistently (28px height, 0.85em font) Service Tracking - Remove Spindle Hours: - Removed spindle_hours from Service.py (not all users have machine-controlled spindles) - Removed spindle tracking from State.py (no more spindle state tracking) - Updated service-template.json (removed spindle_hours from hours section) - Updated view-service.pug (removed Spindle from hours bar) - Updated view-service.js (removed spindleHours computed, hourTypes, labels) - Service items can now only track: Power-On Hours or Motion Hours Files Changed: - src/pug/templates/view-macros.pug - Single row layout - src/stylus/view-macros.styl - Updated column styles - src/pug/templates/view-service.pug - Removed spindle hours display - src/js/view-service.js - Removed spindle computed/methods - src/py/bbctrl/Service.py - Removed all spindle tracking - src/py/bbctrl/State.py - Removed spindle state tracking - src/resources/service-template.json - Removed spindle_hours
Macros View: - Single row layout with tighter column spacing - Columns: grip, #, eye, warn, tab, color, name, file, actions - Proper gaps between tab/color (16px), color/name/file (10px) - File margin-right 12px prevents folder icon overlap - Tab dropdown 100px wide to prevent text cutoff - All inputs use default font size Service Tracking: - Removed spindle_hours (not all users have machine-controlled spindles) - Service items track only: Power-On Hours or Motion Hours - Updated Service.py, State.py, view-service.js, service-template.json
Motion Timer: - State.py update() now tracks 'xx' state transitions - Calls program_started() when entering RUNNING state - Calls program_stopped() when leaving RUNNING state - Fixes motion hours not being recorded Macros Table Spacing: - Hex input: normal height (28px), no font-size override - col-color: width 100px, gap 0.35em between swatch and input - col-name: margin-left 16px (was 10px) - col-file: margin-left 16px, input has margin-right 8px - Prevents folder icon overlap with filename input - Consistent 16px gaps between color/name/file columns
- Hex color input: added font-size inherit for normal text size - Increased margin-left on col-file from 16px to 20px for name/file separation - Updated header to match
- Hex input: font-size 14px (explicit, matches other inputs) - col-name: margin-left 24px (was 16px) - col-file: margin-left 24px (was 20px) - Consistent gaps between hex→name and name→file columns - Updated both header and row sections to match
Adjusted column margins and removed explicit font-size overrides to achieve consistent visual spacing between input fields.
- Restored font-size declaration for hex color input - Fine-tuned col-name margin-left for better visual balance
Vue 1.x requires reactive properties to be defined at initialization. The service_due_count was being sent from backend but Vue couldn't detect changes because the property wasn't in the initial state object. - Add service_due_count: 0 to initial state in app.js line 50
Fix service alert not appearing in header - Add service_due_count: 0 to initial state in app.js (Vue reactivity) - Push service_due_count via websocket in State.py update_service() The service_due_count was only in snapshot() for API calls, but never pushed to websocket clients via set().
Alert fixes: - Add gap, margin, and rounded corners to system alerts - Remove duplicate service-warning-banner from control page - Header alert now handles service notifications site-wide Dashboard removal: - Remove Dashboard tab from service navigation - Make Items the default service view - Remove dashboard section from view-service.pug - Remove dashboard-only styling (due-items-section, no-due-items, stats-section, upcoming-list) - Remove unused serviceDueCount computed and warning banner styling Service now matches Macros pattern: direct content, no landing page.
Service item colors were adding complexity without clear benefit. The due/overdue state is the meaningful visual indicator, and user-selected colors could conflict with the red "due" indicator. Changes: * Removed 'color' field from service-template.json schema * Removed color picker from service item editor in view-service.pug * Removed item-color-bar element, replaced with simple top border * Removed color-related code from view-service.js * Simplified view-service.styl - items now use gray top border (default) that turns red when due * Removed 'color' parameter from Service.py add_item() and update_item() * Removed 'color' from _get_item_defaults() in Service.py UI Behavior: * All service items now have a consistent gray top border * When an item is due, the entire border turns red for clear visibility * This creates better contrast and clearer visual hierarchy Files Modified: * src/resources/service-template.json: Removed color field from items template * src/pug/templates/view-service.pug: Removed color picker and color bar * src/js/view-service.js: Removed color-related code * src/stylus/view-service.styl: Simplified item styling * src/py/bbctrl/Service.py: Removed color handling
Add a dedicated settings page for macro safety options, consolidating safety-critical settings separate from cosmetic macro configuration. The page provides a clear table view of all macros with their safety settings: - Confirm: whether to show confirmation dialog before running - Skip Reference Check: whether macro can run without position reference Navigation updated: Settings → Macros now shows dropdown menu with "Configuration" (existing page) and "Safety" (new page) options. This is the UI counterpart to the skip_reference_check backend logic in bugfixes-complete. Together they allow homing macros to bypass the position reference safety check while keeping other macros protected. - Add settings-macros-safety.pug template - Add settings-macros-safety.js Vue component - Update view-settings.pug navigation to dropdown - Register component in view-settings.js - Add skip_reference_check to config template - Add safety page styles to macros.styl
- Add Safety tab to Macros page navbar (Macros | Tabs | Safety) - Remove Macros dropdown from Settings menu entirely - Safety tab shows checkboxes first (Confirm, Skip Reference Check) to match Macros tab layout pattern - Delete obsolete settings-macros and settings-macros-safety components Safety settings now accessible at #macros:safety instead of #settings:macros-safety
- Remove Macros dropdown from Settings navbar entirely Macros now managed exclusively from standalone Macros page - Delete obsolete settings-macros and settings-macros-safety components - Increase checkbox size to 1.3em on Macros tab (visible/confirm columns) - Increase checkbox size to 1.3em on Safety tab (confirm/bypass columns) - Update column widths from 24px to 32px for larger checkboxes Files to DELETE: - src/pug/templates/settings-macros.pug - src/pug/templates/settings-macros-safety.pug - src/js/settings-macros.js - src/js/settings-macros-safety.js
Vue prop type warning when macro has no name - the fallback (macro.originalIndex + 1) returns Number but component expects String. Wrap in String() to satisfy prop type check.
Macro button text prop expects String. When macro.name is empty, the fallback (macro.originalIndex + 1) returns Number. Use '' + concatenation instead of String() - Vue 1.x templates run in component scope without access to global constructors.
The confirm checkbox was moved to the Safety tab but not removed from the main Macros tab. This commit removes the duplicate column. Changes: - Remove .col-confirm from macro-header in view-macros.pug - Remove .col-confirm checkbox from macro-row in view-macros.pug - Remove .col-confirm styling from macro-header in view-macros.styl - Remove .col-confirm styling from macro-row in view-macros.styl - Update help text to reference Safety tab for confirmation settings - Update intro text to remove "confirmation options" mention
- Planner.py: Add hasattr check for get_modal_state() - Backwards compatible with old camotics.so - Silently skips if method doesn't exist - Config.py: Fix undefined 'macro_id' variable (was i + 1) - FileSystem.py: Remove noisy warning for missing macro sources - Expected behavior for existing configs
7 tasks
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.
Source Branch:
feature/macros-and-service-trackingBase Version: 2.0.7
Summary
Two major feature additions: enhanced macro management system with tabbed organization and a comprehensive machine service/maintenance tracking system.
GitHub Issues Addressed
Macro System Enhancements
Tabbed Organization
Macros can be organized into custom tabs for logical grouping:
Configuration:
{ "macro_tabs": [ {"id": "setup", "name": "Setup"}, {"id": "tools", "name": "Tools"} ], "macros": [ {"name": "Home All", "path": "home.ngc", "tab": "setup"}, {"name": "Tool 1", "path": "tool1.ngc", "tab": "tools"} ] }Visibility Control
Individual macros can be hidden from the control page without deletion:
{"name": "Debug", "path": "debug.ngc", "visible": false}Hidden macros remain configured and can be re-enabled at any time.
Confirmation Dialogs
Macros show confirmation before execution (default: enabled):
{"name": "Probe", "path": "probe.ngc", "confirm": true}Disable for frequently-used safe macros:
{"name": "Spindle On", "path": "spindle.ngc", "confirm": false}Skip Reference Check
Homing macros need to run without position reference (since they establish it):
{"name": "Home All", "path": "home.ngc", "skip_reference_check": true}Color Coding
Custom button colors for visual organization:
{"name": "E-Stop Reset", "path": "reset.ngc", "color": "#ff6666"}Drag-and-Drop Reordering
Macros can be reordered by dragging in the configuration interface.
Dedicated Configuration Page
New
#macrosroute with three sub-views:Service Tracking System
Professional CNC machines require scheduled maintenance: spindle bearing lubrication, way oil changes, belt inspections. This system tracks machine hours and reminds operators when service is due.
Automatic Hour Tracking
Backend increments counters automatically while the controller runs.
Service Items
Each service item tracks:
Alert Integration:
Completion Logging
When service is performed:
Machine Notes
Free-form notes storage for:
Files Added
src/py/bbctrl/Service.pysrc/py/bbctrl/ServiceHandler.pysrc/resources/service-template.jsonsrc/js/view-macros.jssrc/js/view-service.jssrc/pug/templates/view-macros.pugsrc/pug/templates/view-service.pugsrc/stylus/view-macros.stylsrc/stylus/view-service.stylFiles Modified
src/py/bbctrl/Config.pysrc/py/bbctrl/State.pysrc/py/bbctrl/Ctrl.pysrc/py/bbctrl/Web.pysrc/js/view-control.jssrc/pug/templates/view-control.pugsrc/pug/index.pugsrc/stylus/macros.stylsrc/stylus/style.stylsrc/resources/config-template.json