diff --git a/backend/public/index.html b/backend/public/index.html index 0dafcc7..0c5f650 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -6,40 +6,42 @@
| ID | Name | Provider | CPU | @@ -88,7 +125,6 @@ margin-bottom:20px|||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ID | Name | Provider | ||||||||||||||||||||
| ID | Domain | Provider | IP | @@ -158,18 +193,22 @@ const res=await fetch(API+"/resources/active") const data=await res.json() const table=document.getElementById("resources") + table.innerHTML="" data.forEach(r=>{ -const ips=r.ips.map(ip=>ip.ip).join("${r.id} | -${r.name} | +${r.name||""} | ${r.provider||""} | ${r.cpu||""} | ${r.ram||""} | @@ -181,7 +220,7 @@ ${ips}${r.id} | ${r.name} | ${r.provider||""} | ` @@ -236,21 +276,39 @@ table.appendChild(tr) async function createResource(){ -const body={ -name:document.getElementById("r_name").value, -provider:document.getElementById("r_provider").value, -cpu:document.getElementById("r_cpu").value, -ram:document.getElementById("r_ram").value, -disk:document.getElementById("r_disk").value +const body = { + +name: document.getElementById("r_name").value, +produkt: document.getElementById("r_produkt").value, +provider: document.getElementById("r_provider").value, +art: document.getElementById("r_art").value, + +cpu: document.getElementById("r_cpu").value, +ram: document.getElementById("r_ram").value, +disk: document.getElementById("r_disk").value, +os: document.getElementById("r_os").value, + +kosten_monat: document.getElementById("r_kosten_monat").value, +kosten_jahr: document.getElementById("r_kosten_jahr").value, +laufzeit_monate: document.getElementById("r_laufzeit").value, + +bestelldatum: document.getElementById("r_bestellt").value, +kuendbar_ab: document.getElementById("r_kuendbar").value, +kuendigungsdatum: document.getElementById("r_kuendigungsdatum").value, + +bemerkung: document.getElementById("r_bemerkung").value + } -await fetch(API+"/resources",{ +await fetch("/resman/api/resources",{ method:"POST", -headers:{'Content-Type':'application/json'}, +headers:{ +"Content-Type":"application/json" +}, -body:JSON.stringify(body) +body: JSON.stringify(body) }) @@ -279,6 +337,7 @@ loadResources() async function editResource(id){ const name=prompt("Name") + if(!name) return await fetch(API+"/resources/"+id,{ @@ -337,8 +396,6 @@ const tr=document.createElement("tr") tr.innerHTML=` -${d.id} | -${d.domain_name} | ${d.provider||""} |