Commit fa2ca8e5 authored by jan.koester's avatar jan.koester
Browse files

test

parent 466ad4b6
Loading
Loading
Loading
Loading
+14 −8
Changes for admin/static/app.js: 14 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,15 @@ const ProxyPlusAdmin = (() => {
    return data;
  }

  // Appends a "Löschen" button into a row's last (empty) <td>, used by every
  // refresh*() list rendering to give each entry a delete action.
  function addDeleteButton(tr, onClick) {
    const btn = document.createElement("button");
    btn.textContent = "Löschen";
    btn.onclick = onClick;
    tr.lastElementChild.appendChild(btn);
  }

  async function login() {
    const username = document.getElementById("login-username").value;
    const password = document.getElementById("login-password").value;
@@ -70,10 +79,7 @@ const ProxyPlusAdmin = (() => {
    for (const r of routes) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${r.id}</td><td>${r.path_prefix}</td><td>${r.upstream}</td><td>${r.upstream_pool}</td><td>${r.required_permission}</td><td></td>`;
      const delBtn = document.createElement("button");
      delBtn.textContent = "Löschen";
      delBtn.onclick = () => deleteRoute(r.id);
      tr.lastElementChild.appendChild(delBtn);
      addDeleteButton(tr, () => deleteRoute(r.id));
      body.appendChild(tr);
    }
  }
@@ -95,7 +101,7 @@ const ProxyPlusAdmin = (() => {
    for (const r of relays) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${r.id}</td><td>${r.domain}</td><td>${r.smarthost}</td><td>${r.smarthost_pool}</td><td>${r.owner_group_id}</td><td></td>`;
      addDeleteButton(tr, "Relay", () => deleteRelay(r.id));
      addDeleteButton(tr, () => deleteRelay(r.id));
      body.appendChild(tr);
    }
  }
@@ -120,7 +126,7 @@ const ProxyPlusAdmin = (() => {
        .join(", ");
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${p.id}</td><td>${p.kind}</td><td>${p.algorithm}</td><td>${targets}</td><td></td>`;
      addDeleteButton(tr, "Pool", () => deletePool(p.id));
      addDeleteButton(tr, () => deletePool(p.id));
      body.appendChild(tr);
    }
  }
@@ -142,7 +148,7 @@ const ProxyPlusAdmin = (() => {
    for (const p of profiles) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${p.profile}</td><td>${(p.domains || []).join(", ")}</td><td>${p.acme_enabled ? "ja" : "nein"}</td><td>${p.acme_email}</td><td>${p.ca_plugin}</td><td></td>`;
      addDeleteButton(tr, "TLS-Profil", () => deleteTlsProfile(p.profile));
      addDeleteButton(tr, () => deleteTlsProfile(p.profile));
      body.appendChild(tr);
    }
  }
@@ -164,7 +170,7 @@ const ProxyPlusAdmin = (() => {
    for (const k of keys) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${k.domain}</td><td>${k.selector}</td><td>${k.key_path}</td><td>${k.enabled ? "ja" : "nein"}</td><td></td>`;
      addDeleteButton(tr, "DKIM-Key", () => deleteDkimKey(k.domain));
      addDeleteButton(tr, () => deleteDkimKey(k.domain));
      body.appendChild(tr);
    }
  }