remove mass command from dashboard
This commit is contained in:
@@ -586,46 +586,6 @@ bulkUninstallBtn?.addEventListener("click", async () => {
|
||||
setTimeout(() => loadWithOptions({ force: true }), 1000);
|
||||
});
|
||||
|
||||
const massCmdInput = document.getElementById("mass-cmd-input");
|
||||
const massCmdType = document.getElementById("mass-cmd-type");
|
||||
const massCmdRun = document.getElementById("mass-cmd-run");
|
||||
|
||||
massCmdRun?.addEventListener("click", async () => {
|
||||
const cmd = massCmdInput?.value.trim();
|
||||
if (!cmd) {
|
||||
alert("Enter a command to execute.");
|
||||
return;
|
||||
}
|
||||
const scriptType = massCmdType?.value || "powershell";
|
||||
const count = selectedClients.size;
|
||||
if (count === 0) return;
|
||||
if (!confirm(`Execute on ${count} client(s)?\n\n[${scriptType}] ${cmd}`)) return;
|
||||
|
||||
massCmdRun.disabled = true;
|
||||
massCmdRun.innerHTML = '<i class="fa-solid fa-spinner fa-spin"></i> Running...';
|
||||
let success = 0;
|
||||
for (const clientId of selectedClients) {
|
||||
try {
|
||||
const res = await fetch(`/api/clients/${clientId}/command`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ action: "script_exec", script: cmd, scriptType }),
|
||||
});
|
||||
if (res.ok) success++;
|
||||
} catch {}
|
||||
}
|
||||
massCmdRun.disabled = false;
|
||||
massCmdRun.innerHTML = '<i class="fa-solid fa-terminal"></i> Execute';
|
||||
alert(`Command sent to ${success}/${count} clients`);
|
||||
});
|
||||
|
||||
massCmdInput?.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
massCmdRun?.click();
|
||||
}
|
||||
});
|
||||
|
||||
window.toggleClientSelection = toggleClientSelection;
|
||||
window.isClientSelected = (clientId) => selectedClients.has(clientId);
|
||||
window.syncClientSelection = syncSelectionState;
|
||||
|
||||
@@ -146,28 +146,6 @@
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 w-full mt-2">
|
||||
<select
|
||||
id="mass-cmd-type"
|
||||
class="px-2 py-2 rounded-lg bg-slate-800/80 border border-slate-600 text-slate-200 text-sm"
|
||||
>
|
||||
<option value="powershell">PowerShell</option>
|
||||
<option value="cmd">CMD</option>
|
||||
<option value="bash">Bash</option>
|
||||
</select>
|
||||
<input
|
||||
id="mass-cmd-input"
|
||||
type="text"
|
||||
placeholder="Run command on selected clients..."
|
||||
class="flex-1 px-3 py-2 bg-slate-900/70 border border-slate-600 rounded-lg text-slate-100 placeholder:text-slate-500 text-sm focus:outline-none focus:border-amber-500"
|
||||
/>
|
||||
<button
|
||||
id="mass-cmd-run"
|
||||
class="px-3 py-2 rounded-lg bg-amber-700/70 hover:bg-amber-600 text-amber-100 border border-amber-600 transition-colors text-sm whitespace-nowrap"
|
||||
>
|
||||
<i class="fa-solid fa-terminal"></i> Execute
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="grid" class="flex flex-col gap-3"></div>
|
||||
<div class="flex items-center justify-center gap-3 py-4">
|
||||
|
||||
Reference in New Issue
Block a user