function execCommand(e,nodeId){e.preventDefault();var cmd=document.getElementById("term-input").value;if(!cmd)return;var csrf=document.querySelector("meta[name=csrf-token]").content;fetch("index.php",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"system_action=post&entity=fleet_command&data[node_id]="+nodeId+"&data[command]="+encodeURIComponent(cmd)+"&_csrf="+csrf}).then(r=>r.json()).then(d=>{var out=document.getElementById("term-output");out.innerHTML+="<div class=\"term-line\">$ "+cmd+"</div>";if(d.success)out.innerHTML+="<div class=\"term-result\">Command queued (ID: "+d.id+")</div>";else out.innerHTML+="<div class=\"term-error\">"+d.error+"</div>";document.getElementById("term-input").value="";out.scrollTop=out.scrollHeight;});}
