working resman with all cruds
This commit is contained in:
@@ -92,6 +92,7 @@ border-radius:6px;
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Produkt</th>
|
||||
<th>Provider</th>
|
||||
<th>CPU</th>
|
||||
<th>RAM</th>
|
||||
@@ -269,11 +270,13 @@ if(Array.isArray(r.ips)){
|
||||
|
||||
ips=r.ips.map(ip=>`
|
||||
<span class="ip">
|
||||
${ip.ip}
|
||||
${ip.ip} (${ip.type||""})
|
||||
${ip.comment ? "- "+ip.comment : ""}
|
||||
<button onclick="deleteIP(${ip.id},${r.id})">x</button>
|
||||
</span>
|
||||
`).join("")
|
||||
|
||||
|
||||
}
|
||||
|
||||
const tr=document.createElement("tr")
|
||||
@@ -281,6 +284,7 @@ const tr=document.createElement("tr")
|
||||
tr.innerHTML=`
|
||||
|
||||
<td>${r.name}</td>
|
||||
<th>Produkt</th>
|
||||
<td>${r.provider||""}</td>
|
||||
<td>${r.cpu||""}</td>
|
||||
<td>${r.ram||""}</td>
|
||||
@@ -292,7 +296,9 @@ ${ips}
|
||||
|
||||
<br>
|
||||
|
||||
<input id="ip_${r.id}" placeholder="new ip">
|
||||
<input id="ip_${r.id}" placeholder="IP">
|
||||
<input id="iptype_${r.id}" placeholder="type">
|
||||
<input id="ipcomment_${r.id}" placeholder="comment">
|
||||
|
||||
<button onclick="addIP(${r.id})">Add</button>
|
||||
|
||||
@@ -344,12 +350,14 @@ table.appendChild(tr)
|
||||
async function addIP(resource){
|
||||
|
||||
const ip=document.getElementById("ip_"+resource).value
|
||||
const type=document.getElementById("iptype_"+resource).value
|
||||
const comment=document.getElementById("ipcomment_"+resource).value
|
||||
|
||||
await fetch(API+"/resources/"+resource+"/ips",{
|
||||
|
||||
method:"POST",
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({ip})
|
||||
body:JSON.stringify({ip,type,comment})
|
||||
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user