/** * qBit Manage Web UI - Command Panel Component * Handles command execution and monitoring */ import { API } from '../api.js'; import { showToast } from '../utils/toast.js'; import { CLOSE_ICON_SVG } from '../utils/icons.js'; class CommandPanel { constructor(options = {}) { this.container = options.container; this.drawerContainer = options.drawerContainer; this.onCommandExecute = options.onCommandExecute || (() => {}); this.api = new API(); this.isVisible = false; this.runCommandsModal = null; // To store the reference to the run commands modal this.init(); } init() { this.render(); this.bindEvents(); this.setupDrawer(); } setupDrawer() { // Create the drawer container if it doesn't exist if (!this.drawerContainer) { this.drawerContainer = document.createElement('div'); this.drawerContainer.className = 'command-panel-drawer hidden'; document.body.appendChild(this.drawerContainer); } // Move the command panel content to the drawer this.renderDrawer(); this.bindDrawerEvents(); } render() { if (!this.container) return; // Render the toggle button in the footer this.container.innerHTML = `