Skip to content

feature/ui-service-execution#27

Merged
wcollins merged 6 commits intotorerodev:mainfrom
wcollins:feature/ui-service-execution
Sep 11, 2025
Merged

feature/ui-service-execution#27
wcollins merged 6 commits intotorerodev:mainfrom
wcollins:feature/ui-service-execution

Conversation

@wcollins
Copy link
Contributor

✨ feature: Add UI service execution (phase 1)

📒 Summary

Implements Phase 1 of the UI service execution features, enabling users to execute services directly from the dashboard with a polished, consistent user experience. This transforms the dashboard from read-only to interactive, allowing one-click execution of ansible playbooks, python scripts, and opentofu operations with real-time feedback.

🔧 Changes

Backend Changes

  • New API Endpoint: Added /api/execute/<service_name>/ in views.py:185-250 for service execution
  • URL Routing: Added execute endpoint to urls.py:15
  • Enhanced Error Handling: Improved CLI client with detailed logging and connectivity checks
  • OpenTofu Support: Added support for both apply and destroy operations via operation parameter
  • Logger Fixes: Added fallback logger initialization to prevent "logger not defined" errors

Frontend Changes

  • Execute Buttons: Added to all service cards with consistent cyan styling (#5cfcfe)
  • OpenTofu Dropdown: Special dropdown interface for Apply/Destroy operations with red destroy button
  • Loading States: Spinner animations and "Executing..." text during operations
  • Visual Feedback: Toast notifications and card border flashing (green for success, red for error)
  • Auto-refresh Integration: Dashboard updates automatically after execution to show new results
  • Simplified Modal: Execution details modal now shows only Console Output (removed extra tabs)

JavaScript Functionality

  • Execute Functions: executeService() for standard services, executeOpenTofu() for terraform operations
  • Dropdown Management: Toggle functionality with click-outside closing
  • Button State Management: Loading states, reset functionality, error handling
  • Dashboard Refresh: Enhanced updateServiceStatus() to maintain buttons after auto-refresh
  • CSRF Protection: Proper token handling for secure API requests

CSS Styling

  • Consistent Button Design: All execute buttons use same theme except red destroy option
  • Dropdown Styling: Professional dropdown with hover effects and smooth transitions
  • Toast Notifications: Positioned toast system with success/error/info variants
  • Execution Feedback: Card border glow effects for visual feedback
  • Loading Animations: Smooth spinner animations with proper keyframes

Files Modified

  • opt/torero-ui/torero_ui/dashboard/views.py - New execution API endpoint
  • opt/torero-ui/torero_ui/dashboard/urls.py - URL routing for execute endpoint
  • opt/torero-ui/torero_ui/dashboard/services.py - Enhanced CLI client with operation support
  • opt/torero-ui/torero_ui/templates/dashboard/index.html - Execute buttons and OpenTofu dropdown
  • opt/torero-ui/torero_ui/templates/dashboard/base.html - CSRF token support
  • opt/torero-ui/torero_ui/static/js/dashboard.js - Complete execution functionality
  • opt/torero-ui/torero_ui/static/css/dashboard.css - Button styling and dropdown design

🧪 Testing

  • Execute Button Functionality: Tested execution for all service types (ansible, python, opentofu)
  • OpenTofu Operations: Verified both Apply and Destroy operations work correctly
  • Loading States: Confirmed spinner animations and button states work properly
  • Error Handling: Tested with invalid services and network errors
  • Visual Feedback: Verified toast notifications and card border effects
  • Dashboard Refresh: Confirmed buttons persist after auto-refresh
  • Browser Compatibility: Tested dropdown and execution functionality

Enhanced Debugging

  • Detailed CLI Logging: Added comprehensive error logging to identify execution failures
  • Connectivity Checks: Pre-execution CLI availability verification
  • Command Logging: Full command and response logging for troubleshooting

Container Deployment

  • Development Environment: Tested with docker compose -f docker-compose.dev.yml up -d --build
  • Code Changes: Verified container rebuild picks up all modifications
  • Functionality: Confirmed all features work in containerized environment

This PR completes Phase 1 of the UI execution features and provides a solid foundation for Phase 2 queue management implementation.

@wcollins wcollins added the enhancement New feature or request label Sep 11, 2025
@wcollins wcollins merged commit e97074b into torerodev:main Sep 11, 2025
3 checks passed
@wcollins wcollins deleted the feature/ui-service-execution branch September 11, 2025 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant