new server

This commit is contained in:
oliver
2026-06-15 13:35:34 -03:00
parent 7be5f2a160
commit 46d8158c67
2 changed files with 27 additions and 45 deletions
+22 -39
View File
@@ -532,7 +532,7 @@ function stripQuotes(s) {
/* ─── Instances — Load ───────────────────────────────────────── */
async function instancesLoadRecords() {
const tbody = document.getElementById("inst-table-body");
tbody.innerHTML = `<tr><td colspan="9"><div class="empty-state"><div class="spinner"></div><p style="margin-top:12px;">Loading…</p></div></td></tr>`;
tbody.innerHTML = `<tr><td colspan="8"><div class="empty-state"><div class="spinner"></div><p style="margin-top:12px;">Loading…</p></div></td></tr>`;
try {
const res = await apiFetch(apiUrl(ROUTES.instances), {
headers: apiHeaders(),
@@ -566,12 +566,10 @@ function instancesRender() {
const filtered = instancesRecords.filter((r) => {
if (!search) return true;
return (
stripQuotes(r.uuid).toLowerCase().includes(search) ||
stripQuotes(r.agent).toLowerCase().includes(search) ||
stripQuotes(r.domain).toLowerCase().includes(search) ||
stripQuotes(r.server ?? "")
.toLowerCase()
.includes(search)
r.uuid?.toLowerCase().includes(search) ||
r.agent?.toLowerCase().includes(search) ||
r.email?.toLowerCase().includes(search) ||
(r.server ?? "").toLowerCase().includes(search)
);
});
@@ -582,7 +580,7 @@ function instancesRender() {
const tbody = document.getElementById("inst-table-body");
if (filtered.length === 0) {
tbody.innerHTML = `<tr><td colspan="9"><div class="empty-state">
tbody.innerHTML = `<tr><td colspan="8"><div class="empty-state">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
<polyline points="3.27 6.96 12 12.01 20.73 6.96"/><line x1="12" y1="22.08" x2="12" y2="12"/>
@@ -595,42 +593,27 @@ function instancesRender() {
tbody.innerHTML = filtered
.map((r) => {
const uuid = escHtml(r.uuid);
const agent = escHtml(stripQuotes(r.agent));
const domain = escHtml(stripQuotes(r.domain));
const sshPort = escHtml(stripQuotes(r.ssh_port));
const ram = escHtml(stripQuotes(r.ram));
const cpu = escHtml(stripQuotes(r.cpu));
const server = escHtml(stripQuotes(r.server ?? ""));
const created = escHtml(stripQuotes(r.created ?? ""));
const agent = escHtml(r.agent);
const product = escHtml(r.product ?? "");
const server = escHtml(r.server ?? "");
const email = escHtml(r.email ?? "");
const period = escHtml(r.period ?? "");
const sshStatus = r.SSH ? "✓" : "";
const backupStatus = r.BACKUP ? "B" : "";
const createdStatus = r.created ? "C" : "";
const statusParts = [sshStatus, backupStatus, createdStatus].filter(
Boolean,
);
const status = statusParts.length ? statusParts.join(" ") : "—";
return `<tr>
<td><span class="mono">${uuid}</span></td>
<td>${agent}</td>
<td><span class="mono">${domain}</span></td>
<td class="mono">${sshPort}</td>
<td>${ram}</td>
<td>${cpu}</td>
<td>${product}</td>
<td>${server}</td>
<td>${created}</td>
<td>${email}</td>
<td>${period}</td>
<td><span class="mono">${status}</span></td>
<td style="white-space:nowrap; display:flex; gap:6px;">
<button class="btn btn-ghost btn-sm"
data-domain="${domain}"
data-port="${sshPort}"
onclick="instancesCopySSH(this)">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy SSH
</button>
<button class="btn btn-ghost btn-sm"
data-uuid="${uuid}"
onclick="instancesOpenEdit(this)">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
Edit
</button>
<button class="btn btn-danger btn-sm"
data-uuid="${uuid}"
data-agent="${agent}"