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 ───────────────────────────────────────── */ /* ─── Instances — Load ───────────────────────────────────────── */
async function instancesLoadRecords() { async function instancesLoadRecords() {
const tbody = document.getElementById("inst-table-body"); 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 { try {
const res = await apiFetch(apiUrl(ROUTES.instances), { const res = await apiFetch(apiUrl(ROUTES.instances), {
headers: apiHeaders(), headers: apiHeaders(),
@@ -566,12 +566,10 @@ function instancesRender() {
const filtered = instancesRecords.filter((r) => { const filtered = instancesRecords.filter((r) => {
if (!search) return true; if (!search) return true;
return ( return (
stripQuotes(r.uuid).toLowerCase().includes(search) || r.uuid?.toLowerCase().includes(search) ||
stripQuotes(r.agent).toLowerCase().includes(search) || r.agent?.toLowerCase().includes(search) ||
stripQuotes(r.domain).toLowerCase().includes(search) || r.email?.toLowerCase().includes(search) ||
stripQuotes(r.server ?? "") (r.server ?? "").toLowerCase().includes(search)
.toLowerCase()
.includes(search)
); );
}); });
@@ -582,7 +580,7 @@ function instancesRender() {
const tbody = document.getElementById("inst-table-body"); const tbody = document.getElementById("inst-table-body");
if (filtered.length === 0) { 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"> <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"/> <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"/> <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 tbody.innerHTML = filtered
.map((r) => { .map((r) => {
const uuid = escHtml(r.uuid); const uuid = escHtml(r.uuid);
const agent = escHtml(stripQuotes(r.agent)); const agent = escHtml(r.agent);
const domain = escHtml(stripQuotes(r.domain)); const product = escHtml(r.product ?? "");
const sshPort = escHtml(stripQuotes(r.ssh_port)); const server = escHtml(r.server ?? "");
const ram = escHtml(stripQuotes(r.ram)); const email = escHtml(r.email ?? "");
const cpu = escHtml(stripQuotes(r.cpu)); const period = escHtml(r.period ?? "");
const server = escHtml(stripQuotes(r.server ?? "")); const sshStatus = r.SSH ? "✓" : "";
const created = escHtml(stripQuotes(r.created ?? "")); 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> return `<tr>
<td><span class="mono">${uuid}</span></td> <td><span class="mono">${uuid}</span></td>
<td>${agent}</td> <td>${agent}</td>
<td><span class="mono">${domain}</span></td> <td>${product}</td>
<td class="mono">${sshPort}</td>
<td>${ram}</td>
<td>${cpu}</td>
<td>${server}</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;"> <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" <button class="btn btn-danger btn-sm"
data-uuid="${uuid}" data-uuid="${uuid}"
data-agent="${agent}" data-agent="${agent}"
+5 -6
View File
@@ -547,18 +547,17 @@
<tr> <tr>
<th>UUID</th> <th>UUID</th>
<th>Agent</th> <th>Agent</th>
<th>Domain</th> <th>Product</th>
<th>SSH Port</th>
<th>RAM</th>
<th>CPU</th>
<th>Server</th> <th>Server</th>
<th>Created</th> <th>Email</th>
<th>Period</th>
<th>Status</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody id="inst-table-body"> <tbody id="inst-table-body">
<tr> <tr>
<td colspan="9"> <td colspan="8">
<div class="empty-state"> <div class="empty-state">
<div class="spinner"></div> <div class="spinner"></div>
<p style="margin-top: 12px"> <p style="margin-top: 12px">