<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $nodes = Database::fetchAll("SELECT id,node_id,hostname,status_code FROM nodes ORDER BY hostname"); ?> <div id="cmd-create" class="editor-form"> <span class="section-label">New Fleet Command</span> <div class="form-group"><span>Target Node</span> <select id="cmd-node" class="form-group input"><?php foreach ($nodes as $n): ?> <option value="<?= (int)$n['id'] ?> "><?= UI::e($n['hostname']) ?> (<?= UI::e($n['node_id']) ?> )</option><?php endforeach; ?> </select> </div> <div class="form-group"><span>Command</span><input id="cmd-text" class="form-group input" type="text" placeholder="e.g. systemctl status nginx"></div> <div class="form-group"><span>Priority</span> <select id="cmd-priority" class="form-group input"> <option value="8010">Low</option> <option value="8011" selected>Normal</option> <option value="8012">High</option> <option value="8013">Critical</option> </select> </div> <div class="form-actions"> <a id="cmd-submit" class="btn btn-primary" href="javascript:void(0)"><span>Queue Command</span></a> </div> </div> <script nonce="<?= $cspNonce ?? '' ?> "> document.getElementById('cmd-submit').addEventListener('click',function(){ var data={entity:'fleet_command','data[node_id]':document.getElementById('cmd-node').value,'data[command]':document.getElementById('cmd-text').value,'data[priority_code]':document.getElementById('cmd-priority').value}; window.dashFetch('post',data,function(r){if(r.ok){alert('Command queued (ID: '+r.id+')');location.reload();}else{alert(r.error||'Failed');}}); }); </script>