upgrade UI for process manager + logs.

This commit is contained in:
KingKDot
2026-07-14 00:14:41 -05:00
parent 4042d4f768
commit a9bf923e7a
4 changed files with 237 additions and 250 deletions
+56 -23
View File
@@ -8,26 +8,28 @@ const refreshBtn = document.getElementById("refresh-btn");
const prevPageBtn = document.getElementById("prev-page"); const prevPageBtn = document.getElementById("prev-page");
const nextPageBtn = document.getElementById("next-page"); const nextPageBtn = document.getElementById("next-page");
const pageInfo = document.getElementById("page-info"); const pageInfo = document.getElementById("page-info");
const logsCount = document.getElementById("logs-count");
const clearFiltersBtn = document.getElementById("clear-filters-btn");
const actionLabels = { const actionLabels = {
client_first_connect: { client_first_connect: {
label: "First Connect", label: "First Connect",
className: "bg-emerald-900/40 text-emerald-200 border border-emerald-800", className: "bg-emerald-500/10 text-emerald-300 border-emerald-500/30",
icon: "fa-plug-circle-bolt", icon: "fa-plug-circle-bolt",
}, },
client_reconnect: { client_reconnect: {
label: "Reconnect", label: "Reconnect",
className: "bg-blue-900/40 text-blue-200 border border-blue-800", className: "bg-blue-500/10 text-blue-300 border-blue-500/30",
icon: "fa-rotate", icon: "fa-rotate",
}, },
client_disconnect: { client_disconnect: {
label: "Disconnect", label: "Disconnect",
className: "bg-orange-900/40 text-orange-200 border border-orange-800", className: "bg-orange-500/10 text-orange-300 border-orange-500/30",
icon: "fa-plug-circle-xmark", icon: "fa-plug-circle-xmark",
}, },
uninstall: { uninstall: {
label: "Uninstall", label: "Uninstall",
className: "bg-rose-900/40 text-rose-200 border border-rose-800", className: "bg-rose-500/10 text-rose-300 border-rose-500/30",
icon: "fa-trash", icon: "fa-trash",
}, },
}; };
@@ -98,15 +100,21 @@ function renderLogs(logs) {
logsContainer.innerHTML = ""; logsContainer.innerHTML = "";
if (!logs || logs.length === 0) { if (!logs || logs.length === 0) {
logsEmpty.classList.remove("hidden"); logsEmpty.classList.remove("hidden");
if (logsCount) logsCount.textContent = "0 matching events";
return; return;
} }
logsEmpty.classList.add("hidden"); logsEmpty.classList.add("hidden");
if (logsCount) {
const first = (page - 1) * pageSize + 1;
const last = Math.min(first + logs.length - 1, total);
logsCount.textContent = `${total.toLocaleString()} events · showing ${first}–${last}`;
}
logsContainer.innerHTML = logs logsContainer.innerHTML = logs
.map((log) => { .map((log) => {
const meta = actionLabels[log.action] || { const meta = actionLabels[log.action] || {
label: log.action, label: log.action,
className: "bg-slate-800/60 text-slate-200 border border-slate-700", className: "bg-slate-800 text-slate-300 border-slate-700",
icon: "fa-circle-info", icon: "fa-circle-info",
}; };
const clientId = log.targetClientId || "-"; const clientId = log.targetClientId || "-";
@@ -114,25 +122,26 @@ function renderLogs(logs) {
const detailText = parseDetails(log.details); const detailText = parseDetails(log.details);
return ` return `
<div class="bg-slate-950/60 border border-slate-800 rounded-lg p-4 flex flex-col gap-2"> <article class="px-4 sm:px-5 py-4 flex gap-3 sm:gap-4 hover:bg-slate-800/20 transition-colors">
<div class="flex items-center justify-between gap-3 flex-wrap"> <div class="inline-flex items-center justify-center w-9 h-9 shrink-0 rounded-lg border ${meta.className}">
<div class="flex items-center gap-3"> <i class="fa-solid ${meta.icon}"></i>
<span class="inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs ${meta.className}"> </div>
<i class="fa-solid ${meta.icon}"></i> <div class="flex-1 min-w-0">
${meta.label} <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1 sm:gap-3">
</span> <div class="flex items-center gap-2 min-w-0">
<span class="text-sm text-slate-300" title="${escapeHtml(clientId)}"> <span class="text-sm font-semibold text-slate-200">${escapeHtml(meta.label || "Event")}</span>
Client: <span class="font-mono">${escapeHtml(shortId)}</span> <span class="text-xs text-slate-500">Client</span>
</span> <span class="font-mono text-xs text-sky-300 truncate" title="${escapeHtml(clientId)}">${escapeHtml(shortId)}</span>
</div>
<time class="text-xs text-slate-500 shrink-0">${formatTimestamp(log.timestamp)}</time>
</div> </div>
<div class="text-xs text-slate-400">${formatTimestamp(log.timestamp)}</div> <div class="mt-1.5 text-xs text-slate-500 flex flex-wrap gap-x-4 gap-y-1">
<span><i class="fa-solid fa-globe mr-1 text-slate-600"></i>${escapeHtml(log.ip || "-")}</span>
<span><i class="fa-solid fa-user mr-1 text-slate-600"></i>${escapeHtml(log.username || "-")}</span>
</div>
${detailText ? `<div class="mt-2 rounded-md bg-slate-950/60 border border-slate-800 px-2.5 py-2 text-xs font-mono text-slate-400 break-all">${detailText}</div>` : ""}
</div> </div>
<div class="text-xs text-slate-500 flex flex-wrap gap-3"> </article>
<span>IP: ${escapeHtml(log.ip || "-")}</span>
<span>User: ${escapeHtml(log.username || "-")}</span>
</div>
${detailText ? `<div class="text-xs text-slate-400">Details: ${detailText}</div>` : ""}
</div>
`; `;
}) })
.join(""); .join("");
@@ -140,6 +149,18 @@ function renderLogs(logs) {
async function loadLogs() { async function loadLogs() {
try { try {
if (refreshBtn) refreshBtn.disabled = true;
if (logsCount) logsCount.textContent = "Loading events…";
if (getSelectedActions().length === 0) {
total = 0;
page = 1;
renderLogs([]);
pageInfo.textContent = "Page 1 of 1";
prevPageBtn.disabled = true;
nextPageBtn.disabled = true;
lastUpdate.textContent = new Date().toLocaleTimeString();
return;
}
const params = buildQuery(); const params = buildQuery();
const res = await fetch(`/api/audit-logs?${params.toString()}`); const res = await fetch(`/api/audit-logs?${params.toString()}`);
if (!res.ok) { if (!res.ok) {
@@ -160,9 +181,12 @@ async function loadLogs() {
console.error("Failed to load logs", err); console.error("Failed to load logs", err);
if (logsContainer) { if (logsContainer) {
logsContainer.innerHTML = ` logsContainer.innerHTML = `
<div class="text-rose-300 text-sm">Failed to load logs. Please try again.</div> <div class="px-5 py-12 text-center text-rose-300 text-sm"><i class="fa-solid fa-circle-exclamation mr-2"></i>Failed to load logs. Please try again.</div>
`; `;
} }
if (logsCount) logsCount.textContent = "Unable to load events";
} finally {
if (refreshBtn) refreshBtn.disabled = false;
} }
} }
@@ -181,6 +205,15 @@ clientFilter?.addEventListener("input", debounceLoad);
startDateInput?.addEventListener("change", resetAndLoad); startDateInput?.addEventListener("change", resetAndLoad);
endDateInput?.addEventListener("change", resetAndLoad); endDateInput?.addEventListener("change", resetAndLoad);
refreshBtn?.addEventListener("click", resetAndLoad); refreshBtn?.addEventListener("click", resetAndLoad);
clearFiltersBtn?.addEventListener("click", () => {
if (clientFilter) clientFilter.value = "";
if (startDateInput) startDateInput.value = "";
if (endDateInput) endDateInput.value = "";
document.querySelectorAll(".action-checkbox").forEach((checkbox) => {
checkbox.checked = true;
});
resetAndLoad();
});
Array.from(document.querySelectorAll(".action-checkbox")).forEach((cb) => { Array.from(document.querySelectorAll(".action-checkbox")).forEach((cb) => {
cb.addEventListener("change", resetAndLoad); cb.addEventListener("change", resetAndLoad);
+14 -11
View File
@@ -28,7 +28,7 @@ const searchInput = document.getElementById("search-input");
const clientIdHeader = document.getElementById("client-id-header"); const clientIdHeader = document.getElementById("client-id-header");
if (clientIdHeader) { if (clientIdHeader) {
clientIdHeader.textContent = `${clientId} - Process Manager`; clientIdHeader.innerHTML = `<i class="fa-solid fa-microchip mr-1.5 text-sky-400"></i>${escapeHtml(clientId)}`;
} }
function connect() { function connect() {
@@ -76,10 +76,13 @@ function updateStatus(state, text) {
}; };
statusEl.innerHTML = `${icons[state] || icons.disconnected} ${text}`; statusEl.innerHTML = `${icons[state] || icons.disconnected} ${text}`;
statusEl.className = const stateClasses = {
state === "connected" connected: "bg-emerald-500/10 text-emerald-300 border-emerald-500/30",
? "inline-flex items-center gap-2 px-3 py-2 rounded-full bg-green-900/40 text-green-100 border border-green-700/60" error: "bg-red-500/10 text-red-300 border-red-500/30",
: "inline-flex items-center gap-2 px-3 py-2 rounded-full bg-slate-800 text-slate-300"; disconnected: "bg-slate-800 text-slate-300 border-slate-700",
connecting: "bg-sky-500/10 text-sky-300 border-sky-500/30",
};
statusEl.className = `inline-flex self-start sm:self-auto items-center gap-2 px-3 py-1.5 rounded-full border text-xs font-medium ${stateClasses[state] || stateClasses.disconnected}`;
} }
function enableControls(enabled) { function enableControls(enabled) {
@@ -280,7 +283,7 @@ function renderProcesses() {
function rowClassName(proc) { function rowClassName(proc) {
let cls = let cls =
"process-row grid grid-cols-12 gap-3 px-4 py-3 border border-transparent cursor-pointer transition-colors"; "process-row grid grid-cols-12 gap-3 px-4 py-3 border-l-2 border-transparent cursor-pointer transition-colors";
if (selectedPid === proc.pid) cls += " selected"; if (selectedPid === proc.pid) cls += " selected";
if (proc.self) cls += " self-process"; if (proc.self) cls += " self-process";
return cls; return cls;
@@ -356,14 +359,14 @@ function rowInnerHtml(proc, depth) {
: ""; : "";
return ` return `
<div class="col-span-1 text-sm font-mono text-slate-400">${proc.pid}</div> <div class="process-cell process-pid col-span-1 text-sm font-mono text-slate-400" data-label="PID">${proc.pid}</div>
<div class="col-span-4 flex items-center gap-1 truncate"> <div class="process-cell process-name col-span-4 flex items-center gap-1 truncate">
${indent}${treeIcon}${procIcon} ${indent}${treeIcon}${procIcon}
<span class="truncate ${nameColor}">${escapeHtml(proc.name)}</span>${selfBadge} <span class="truncate ${nameColor}">${escapeHtml(proc.name)}</span>${selfBadge}
</div> </div>
<div class="col-span-2 text-sm ${cpuColor} font-semibold">${displayCpu.toFixed(1)}%</div> <div class="process-cell process-cpu col-span-2 text-sm ${cpuColor} font-semibold" data-label="CPU">${displayCpu.toFixed(1)}%</div>
<div class="col-span-2 text-sm ${memColor}">${memoryStr}</div> <div class="process-cell process-memory col-span-2 text-sm ${memColor}" data-label="Memory">${memoryStr}</div>
<div class="col-span-3 text-sm text-slate-500 truncate">${escapeHtml(proc.username || "-")}</div> <div class="process-cell process-user col-span-3 text-sm text-slate-500 truncate" data-label="User">${escapeHtml(proc.username || "-")}</div>
`; `;
} }
+92 -89
View File
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="/vendor/inter/400.css" /> <link rel="stylesheet" href="/vendor/inter/400.css" />
<link rel="stylesheet" href="/vendor/inter/600.css" /> <link rel="stylesheet" href="/vendor/inter/600.css" />
<link rel="stylesheet" href="/vendor/inter/700.css" /> <link rel="stylesheet" href="/vendor/inter/700.css" />
<link rel="stylesheet" href="/assets/tailwind.css" /> <link rel="stylesheet" href="/assets/tailwind.css" />
<link rel="stylesheet" href="/vendor/fontawesome/css/all.min.css" /> <link rel="stylesheet" href="/vendor/fontawesome/css/all.min.css" />
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" /> <link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<link rel="stylesheet" href="/assets/main.css" /> <link rel="stylesheet" href="/assets/main.css" />
@@ -20,109 +20,112 @@
<body class="min-h-screen bg-slate-950 text-slate-100"> <body class="min-h-screen bg-slate-950 text-slate-100">
<header id="top-nav"></header> <header id="top-nav"></header>
<main class="px-5 py-6"> <main class="max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="max-w-7xl mx-auto flex flex-col gap-6"> <div class="mb-6 flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3">
<div class="flex items-center justify-between gap-3 flex-wrap"> <div>
<div> <h1 class="text-2xl font-bold text-slate-100">Client Connection Logs</h1>
<h1 class="text-2xl font-semibold">Client Connection Logs</h1> <p class="text-slate-400 text-sm mt-1">Review connection lifecycle activity across enrolled clients.</p>
<p class="text-slate-400"> </div>
Track first connects, reconnects, uninstalls, and disconnects. <div class="inline-flex self-start sm:self-auto items-center gap-2 px-3 py-1.5 rounded-full border border-slate-700 bg-slate-900/60 text-xs text-slate-400">
</p> <i class="fa-solid fa-clock-rotate-left text-indigo-400"></i>
Updated <span id="last-update" class="text-slate-200">Never</span>
</div>
</div>
<section class="bg-slate-900/60 border border-slate-800 rounded-xl p-4 sm:p-5 mb-6 space-y-4">
<div class="flex items-center gap-3">
<div class="flex items-center justify-center w-9 h-9 rounded-lg bg-indigo-500/10 border border-indigo-500/30">
<i class="fa-solid fa-filter text-indigo-400"></i>
</div> </div>
<div class="text-sm text-slate-400"> <div>
Updated: <span id="last-update">Never</span> <h2 class="text-base font-semibold">Filter activity</h2>
<p class="text-xs text-slate-400">Narrow results by client, time range, or event type.</p>
</div> </div>
</div> </div>
<section class="bg-slate-900/70 border border-slate-800 rounded-lg p-4"> <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-3">
<div class="grid grid-cols-1 md:grid-cols-4 gap-4"> <div class="xl:col-span-2">
<div class="flex flex-col gap-2"> <label class="block text-xs font-medium text-slate-400 mb-1.5" for="client-filter">Client ID</label>
<label class="text-xs text-slate-400" for="client-filter"> <div class="relative">
Client ID <i class="fa-solid fa-magnifying-glass absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"></i>
</label> <input id="client-filter" type="search" placeholder="Search by client ID"
<input class="w-full pl-10 pr-3 py-2.5 rounded-lg bg-slate-950/70 border border-slate-700 text-slate-100 placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/60 focus:border-indigo-500" />
id="client-filter"
type="text"
placeholder="Search client id"
class="w-full px-3 py-2 rounded-lg bg-slate-950 border border-slate-800 text-slate-100"
/>
</div>
<div class="flex flex-col gap-2">
<label class="text-xs text-slate-400" for="start-date">
Start
</label>
<input
id="start-date"
type="datetime-local"
class="w-full px-3 py-2 rounded-lg bg-slate-950 border border-slate-800 text-slate-100"
/>
</div>
<div class="flex flex-col gap-2">
<label class="text-xs text-slate-400" for="end-date">
End
</label>
<input
id="end-date"
type="datetime-local"
class="w-full px-3 py-2 rounded-lg bg-slate-950 border border-slate-800 text-slate-100"
/>
</div>
<div class="flex items-end gap-2">
<button
id="refresh-btn"
class="px-4 py-2 rounded-lg bg-indigo-600/70 hover:bg-indigo-600 border border-indigo-500 text-indigo-100"
>
<i class="fa-solid fa-rotate"></i> Refresh
</button>
</div> </div>
</div> </div>
<div>
<label class="block text-xs font-medium text-slate-400 mb-1.5" for="start-date">From</label>
<input id="start-date" type="datetime-local"
class="w-full px-3 py-2.5 rounded-lg bg-slate-950/70 border border-slate-700 text-slate-100 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/60 focus:border-indigo-500" />
</div>
<div>
<label class="block text-xs font-medium text-slate-400 mb-1.5" for="end-date">To</label>
<input id="end-date" type="datetime-local"
class="w-full px-3 py-2.5 rounded-lg bg-slate-950/70 border border-slate-700 text-slate-100 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/60 focus:border-indigo-500" />
</div>
</div>
<div class="mt-4 flex flex-wrap gap-2" id="action-filters"> <div class="pt-4 border-t border-slate-800 flex flex-col lg:flex-row lg:items-center lg:justify-between gap-3">
<label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-950/70 border border-slate-800 text-sm"> <div id="action-filters" class="flex flex-wrap gap-2">
<input type="checkbox" class="action-checkbox" value="client_first_connect" checked /> <label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-emerald-500/5 border border-emerald-500/20 text-sm cursor-pointer hover:bg-emerald-500/10">
<span class="text-emerald-300">First Connect</span> <input type="checkbox" class="action-checkbox accent-emerald-500" value="client_first_connect" checked />
<i class="fa-solid fa-plug-circle-bolt text-emerald-400"></i><span class="text-emerald-200">First connect</span>
</label> </label>
<label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-950/70 border border-slate-800 text-sm"> <label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-500/5 border border-blue-500/20 text-sm cursor-pointer hover:bg-blue-500/10">
<input type="checkbox" class="action-checkbox" value="client_reconnect" checked /> <input type="checkbox" class="action-checkbox accent-blue-500" value="client_reconnect" checked />
<span class="text-blue-300">Reconnect</span> <i class="fa-solid fa-rotate text-blue-400"></i><span class="text-blue-200">Reconnect</span>
</label> </label>
<label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-950/70 border border-slate-800 text-sm"> <label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-orange-500/5 border border-orange-500/20 text-sm cursor-pointer hover:bg-orange-500/10">
<input type="checkbox" class="action-checkbox" value="client_disconnect" checked /> <input type="checkbox" class="action-checkbox accent-orange-500" value="client_disconnect" checked />
<span class="text-orange-300">Disconnect</span> <i class="fa-solid fa-plug-circle-xmark text-orange-400"></i><span class="text-orange-200">Disconnect</span>
</label> </label>
<label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-950/70 border border-slate-800 text-sm"> <label class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-rose-500/5 border border-rose-500/20 text-sm cursor-pointer hover:bg-rose-500/10">
<input type="checkbox" class="action-checkbox" value="uninstall" checked /> <input type="checkbox" class="action-checkbox accent-rose-500" value="uninstall" checked />
<span class="text-rose-300">Uninstall</span> <i class="fa-solid fa-trash text-rose-400"></i><span class="text-rose-200">Uninstall</span>
</label> </label>
</div> </div>
</section> <div class="flex gap-2">
<button id="clear-filters-btn" class="flex-1 lg:flex-none inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg border border-slate-700 bg-slate-800 hover:bg-slate-700 text-slate-300 text-sm">
<section class="bg-slate-900/70 border border-slate-800 rounded-lg p-4"> <i class="fa-solid fa-filter-circle-xmark"></i> Reset
<div id="logs-container" class="space-y-3"></div>
<div
id="logs-empty"
class="hidden text-center text-slate-500 py-10"
>
<i class="fa-solid fa-inbox text-4xl mb-3"></i>
<p>No log entries found.</p>
</div>
<div class="mt-4 flex items-center justify-between text-sm">
<button
id="prev-page"
class="px-3 py-2 rounded-lg bg-slate-800/70 border border-slate-700 text-slate-200 disabled:opacity-40"
>
<i class="fa-solid fa-arrow-left"></i> Previous
</button> </button>
<div id="page-info" class="text-slate-400">Page 1</div> <button id="refresh-btn" class="flex-1 lg:flex-none inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-indigo-600 hover:bg-indigo-500 border border-indigo-500 text-white font-medium text-sm">
<button <i class="fa-solid fa-rotate"></i> Refresh
id="next-page"
class="px-3 py-2 rounded-lg bg-slate-800/70 border border-slate-700 text-slate-200 disabled:opacity-40"
>
Next <i class="fa-solid fa-arrow-right"></i>
</button> </button>
</div> </div>
</section> </div>
</div> </section>
<section class="bg-slate-900/60 border border-slate-800 rounded-xl overflow-hidden">
<div class="px-4 sm:px-5 py-4 border-b border-slate-800 flex items-center justify-between gap-3">
<div class="flex items-center gap-3">
<div class="flex items-center justify-center w-9 h-9 rounded-lg bg-sky-500/10 border border-sky-500/30">
<i class="fa-solid fa-timeline text-sky-400"></i>
</div>
<div>
<h2 class="text-base font-semibold">Activity timeline</h2>
<p id="logs-count" class="text-xs text-slate-400">Loading events…</p>
</div>
</div>
</div>
<div id="logs-container" class="divide-y divide-slate-800/80"></div>
<div id="logs-empty" class="hidden text-center px-4 py-16">
<div class="mx-auto mb-3 flex items-center justify-center w-11 h-11 rounded-full bg-slate-800/70 text-slate-500">
<i class="fa-solid fa-inbox text-xl"></i>
</div>
<p class="text-sm font-medium text-slate-300">No matching activity</p>
<p class="text-xs text-slate-500 mt-1">Try widening the date range or resetting filters.</p>
</div>
<div class="px-4 sm:px-5 py-3 border-t border-slate-800 bg-slate-950/30 flex items-center justify-between gap-3 text-sm">
<button id="prev-page" class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 disabled:opacity-40 disabled:cursor-not-allowed">
<i class="fa-solid fa-arrow-left"></i><span class="hidden sm:inline">Previous</span>
</button>
<div id="page-info" class="text-xs text-slate-400">Page 1</div>
<button id="next-page" class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 disabled:opacity-40 disabled:cursor-not-allowed">
<span class="hidden sm:inline">Next</span><i class="fa-solid fa-arrow-right"></i>
</button>
</div>
</section>
</main> </main>
<script type="module" src="/assets/nav.js"></script> <script type="module" src="/assets/nav.js"></script>
+75 -127
View File
@@ -9,22 +9,19 @@
<link rel="stylesheet" href="/vendor/inter/400.css" /> <link rel="stylesheet" href="/vendor/inter/400.css" />
<link rel="stylesheet" href="/vendor/inter/600.css" /> <link rel="stylesheet" href="/vendor/inter/600.css" />
<link rel="stylesheet" href="/vendor/inter/700.css" /> <link rel="stylesheet" href="/vendor/inter/700.css" />
<link rel="stylesheet" href="/assets/tailwind.css" /> <link rel="stylesheet" href="/assets/tailwind.css" />
<link rel="stylesheet" href="/assets/main.css" /> <link rel="stylesheet" href="/assets/main.css" />
<link rel="stylesheet" href="/vendor/fontawesome/css/all.min.css" /> <link rel="stylesheet" href="/vendor/fontawesome/css/all.min.css" />
<link rel="icon" type="image/x-icon" href="/assets/favicon.ico" /> <link rel="icon" type="image/x-icon" href="/assets/favicon.ico" />
<link rel="stylesheet" href="/assets/custom.css" /> <link rel="stylesheet" href="/assets/custom.css" />
<script defer src="/vendor/msgpackr/msgpackr.js"></script> <script defer src="/vendor/msgpackr/msgpackr.js"></script>
<style> <style>
body {
font-family: "Inter", sans-serif;
}
.process-row:hover { .process-row:hover {
background-color: rgba(51, 65, 85, 0.5); background-color: rgba(30, 41, 59, 0.62);
} }
.process-row.selected { .process-row.selected {
background-color: rgba(59, 130, 246, 0.3); background-color: rgba(14, 165, 233, 0.12);
border-color: rgba(59, 130, 246, 0.6); box-shadow: inset 3px 0 0 rgb(56 189 248);
} }
.process-row.self-process { .process-row.self-process {
background-color: rgba(234, 179, 8, 0.12); background-color: rgba(234, 179, 8, 0.12);
@@ -36,15 +33,15 @@
} }
/* Dark scrollbar styling */ /* Dark scrollbar styling */
#process-list::-webkit-scrollbar { #process-list::-webkit-scrollbar {
width: 12px; width: 8px;
} }
#process-list::-webkit-scrollbar-track { #process-list::-webkit-scrollbar-track {
background: #1e293b; background: #1e293b;
border-radius: 0 0 0.5rem 0; border-radius: 999px;
} }
#process-list::-webkit-scrollbar-thumb { #process-list::-webkit-scrollbar-thumb {
background: #475569; background: #475569;
border-radius: 6px; border-radius: 999px;
border: 2px solid #1e293b; border: 2px solid #1e293b;
} }
#process-list::-webkit-scrollbar-thumb:hover { #process-list::-webkit-scrollbar-thumb:hover {
@@ -99,146 +96,97 @@
display: none; display: none;
} }
/* Mobile responsive styles */
@media (max-width: 768px) { @media (max-width: 768px) {
header {
padding: 0.75rem;
}
header .flex {
flex-wrap: nowrap;
gap: 0.5rem;
}
header span,
header a {
font-size: 0.875rem;
}
#client-id-header {
display: none;
}
main {
padding: 1rem 0.5rem;
}
.process-header { .process-header {
display: none !important; display: none !important;
} }
#process-list { #process-list {
max-height: calc(100vh - 300px) !important; max-height: none !important;
} }
#process-list .process-row { #process-list .process-row {
display: flex; display: grid;
flex-direction: column; grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 0.5rem; gap: 0.75rem 1rem;
padding: 0.75rem !important; padding: 0.75rem !important;
font-size: 0.875rem; font-size: 0.875rem;
} }
#process-list .process-row > div { #process-list .process-name {
width: 100% !important; grid-column: 1 / -1;
display: flex; order: -1;
justify-content: space-between; min-width: 0;
}
#process-list .process-cell:not(.process-name)::before {
content: attr(data-label);
display: block;
margin-bottom: 0.125rem;
color: rgb(100 116 139);
font-size: 0.625rem;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
} }
.process-row .tree-indent { .process-row .tree-indent {
width: 10px; width: 10px;
} }
.color-legend {
flex-wrap: wrap;
font-size: 0.65rem;
gap: 0.5rem !important;
}
} }
</style> </style>
</head> </head>
<body class="min-h-screen bg-slate-950 text-slate-100"> <body class="min-h-screen bg-slate-950 text-slate-100">
<header id="top-nav"></header> <header id="top-nav"></header>
<main class="px-5 py-6"> <main class="max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="max-w-7xl mx-auto flex flex-col gap-5"> <div class="mb-6 flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3">
<!-- Status Bar --> <div>
<div class="flex items-center justify-between gap-3 flex-wrap"> <h1 class="text-2xl font-bold text-slate-100">Process Manager</h1>
<div class="flex items-center gap-2 flex-wrap"> <p id="client-id-header" class="text-slate-400 text-sm mt-1 font-mono">Loading client...</p>
<span </div>
id="status-indicator" <span id="status-indicator" class="inline-flex self-start sm:self-auto items-center gap-2 px-3 py-1.5 rounded-full bg-slate-800 text-slate-300 border border-slate-700 text-xs font-medium">
class="inline-flex items-center gap-2 px-3 py-2 rounded-full bg-slate-800 text-slate-300" <i class="fa-solid fa-circle-notch fa-spin"></i> Connecting...
> </span>
<i class="fa-solid fa-circle-notch fa-spin"></i> Connecting... </div>
</span>
<span <section class="bg-slate-900/60 border border-slate-800 rounded-xl overflow-hidden">
id="client-id-header" <div class="p-4 sm:p-5 border-b border-slate-800 space-y-4">
class="inline-flex items-center gap-2 px-3 py-2 rounded-full bg-slate-900/60 text-slate-200 border border-slate-800" <div class="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4">
> <div class="flex items-center gap-3">
<i class="fa-solid fa-microchip"></i> <div class="flex items-center justify-center w-9 h-9 rounded-lg bg-sky-500/10 border border-sky-500/30">
<span>Loading client...</span> <i class="fa-solid fa-list-check text-sky-400"></i>
</span> </div>
<span <div>
id="process-count" <h2 class="text-base font-semibold">Running processes</h2>
class="inline-flex items-center gap-2 px-3 py-2 rounded-full bg-slate-800 text-slate-400" <p id="process-count" class="text-xs text-slate-400"><i class="fa-solid fa-list mr-1"></i>0 processes</p>
> </div>
<i class="fa-solid fa-list"></i> 0 processes </div>
</span> <div class="flex gap-2">
<button id="refresh-btn" class="flex-1 lg:flex-none inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-700 text-slate-200 text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed" disabled>
<i class="fa-solid fa-rotate"></i> Refresh
</button>
<button id="kill-btn" class="flex-1 lg:flex-none inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-red-600/90 hover:bg-red-500 border border-red-500 text-white text-sm font-semibold disabled:opacity-40 disabled:cursor-not-allowed" disabled>
<i class="fa-solid fa-skull-crossbones"></i> Kill selected
</button>
</div>
</div> </div>
<div class="flex items-center gap-2">
<button <div class="flex flex-col xl:flex-row xl:items-center gap-3">
id="refresh-btn" <div class="relative flex-1 min-w-0">
class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white" <i class="fa-solid fa-magnifying-glass absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"></i>
disabled <input id="search-input" type="search" placeholder="Search by process name, PID, or user..."
> class="w-full pl-10 pr-4 py-2.5 rounded-lg border border-slate-700 bg-slate-950/70 text-slate-100 placeholder-slate-500 text-sm focus:outline-none focus:ring-2 focus:ring-sky-500/60 focus:border-sky-500" />
<i class="fa-solid fa-refresh"></i> Refresh </div>
</button> <div class="color-legend flex items-center gap-x-3 gap-y-2 flex-wrap text-xs text-slate-400">
<button <span class="text-slate-500 font-semibold">Types</span>
id="kill-btn" <span class="inline-flex items-center gap-1.5"><i class="fa-solid fa-circle text-[7px] text-purple-400"></i>System</span>
class="inline-flex items-center gap-2 px-3 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white" <span class="inline-flex items-center gap-1.5"><i class="fa-solid fa-circle text-[7px] text-cyan-400"></i>Service</span>
disabled <span class="inline-flex items-center gap-1.5"><i class="fa-solid fa-circle text-[7px] text-green-300"></i>Own</span>
> <span class="inline-flex items-center gap-1.5"><i class="fa-solid fa-circle text-[7px] text-slate-200"></i>Other</span>
<i class="fa-solid fa-skull-crossbones"></i> Kill Process <span class="inline-flex items-center gap-1.5"><i class="fa-solid fa-crosshairs text-yellow-400"></i>Agent</span>
</button> </div>
</div> </div>
</div> </div>
<!-- Search Bar --> <div class="overflow-hidden">
<div
class="flex items-center gap-2 px-4 py-3 bg-slate-900/70 border border-slate-800 rounded-lg"
>
<i class="fa-solid fa-magnifying-glass text-slate-500"></i>
<input
id="search-input"
type="text"
placeholder="Search by process name or PID..."
class="bg-transparent outline-none w-full text-slate-100 placeholder:text-slate-500"
/>
</div>
<!-- Color Legend -->
<div
class="color-legend flex items-center gap-4 px-4 py-2 bg-slate-900/50 border border-slate-800 rounded-lg text-xs"
>
<span class="text-slate-500 font-semibold">Process Types:</span>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-circle text-purple-400"></i>
<span class="text-slate-400">System</span>
</div>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-circle text-cyan-400"></i>
<span class="text-slate-400">Service</span>
</div>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-circle text-green-300"></i>
<span class="text-slate-400">Own</span>
</div>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-circle text-slate-200"></i>
<span class="text-slate-400">Other</span>
</div>
<div class="flex items-center gap-1.5">
<i class="fa-solid fa-crosshairs text-yellow-400"></i>
<span class="text-slate-400">Overlord Agent</span>
</div>
</div>
<!-- Process List -->
<div
class="bg-slate-900/70 border border-slate-800 rounded-lg overflow-hidden"
>
<div <div
class="process-header grid grid-cols-12 gap-3 px-4 py-3 bg-slate-800 border-b border-slate-700 text-xs font-semibold uppercase text-slate-400" class="process-header grid grid-cols-12 gap-3 px-4 py-3 bg-slate-950/60 border-b border-slate-800 text-[11px] font-semibold uppercase tracking-wider text-slate-500"
> >
<div <div
class="col-span-1 cursor-pointer hover:text-slate-200" class="col-span-1 cursor-pointer hover:text-slate-200"
@@ -268,12 +216,12 @@
</div> </div>
<div <div
id="process-list" id="process-list"
class="divide-y divide-slate-800 max-h-[calc(100vh-400px)] overflow-y-auto" class="divide-y divide-slate-800/80 min-h-80 max-h-[calc(100vh-22rem)] overflow-y-auto"
> >
<!-- Processes will be inserted here --> <!-- Processes will be inserted here -->
</div> </div>
</div> </div>
</div> </section>
</main> </main>
<script type="module" src="/assets/nav.js"></script> <script type="module" src="/assets/nav.js"></script>