diff --git a/public/index.html b/public/index.html
index 27838a5..9b5fe65 100644
--- a/public/index.html
+++ b/public/index.html
@@ -759,18 +759,23 @@
⚡ Quick Command Execution
-
Execute a command on selected workers instantly
-
+
Execute a command on selected workers instantly
+
+
+
+
+
+
-
+
-
-
-
+
+
+
@@ -803,7 +808,25 @@
+
${escapeHtml(item.command)}
+
${new Date(item.timestamp).toLocaleString()} - ${item.worker}
+
+ `).join('');
+ document.getElementById('historyList').innerHTML = html;
+ }
+
+ document.getElementById('commandHistoryModal').classList.add('show');
+ }
+
+ function useHistoryCommand(index) {
+ const history = JSON.parse(localStorage.getItem('commandHistory') || '[]');
+ document.getElementById('quickCommand').value = history[index].command;
+ closeModal('commandHistoryModal');
+ }
+
+ function addToCommandHistory(command, workerName) {
+ const history = JSON.parse(localStorage.getItem('commandHistory') || '[]');
+
+ // Add to beginning, limit to 50 items
+ history.unshift({
+ command: command,
+ worker: workerName,
+ timestamp: new Date().toISOString()
+ });
+
+ // Keep only last 50 commands
+ if (history.length > 50) {
+ history.splice(50);
+ }
+
+ localStorage.setItem('commandHistory', JSON.stringify(history));
+ }
+
async function deleteWorker(workerId, name) {
if (!confirm(`Delete worker: ${name}?`)) return;
@@ -1248,31 +1347,39 @@
async function executeQuickCommand() {
const workerId = document.getElementById('quickWorkerSelect').value;
const command = document.getElementById('quickCommand').value;
-
+
if (!workerId || !command) {
alert('Please select a worker and enter a command');
return;
}
-
+
+ // Find worker name for history
+ const worker = workers.find(w => w.id === workerId);
+ const workerName = worker ? worker.name : 'Unknown';
+
const resultDiv = document.getElementById('quickCommandResult');
resultDiv.innerHTML = 'Executing command...
';
-
+
try {
const response = await fetch(`/api/workers/${workerId}/command`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ command })
});
-
+
if (response.ok) {
const data = await response.json();
+
+ // Add to command history
+ addToCommandHistory(command, workerName);
+
resultDiv.innerHTML = `
-