ResMan update
This commit is contained in:
@@ -165,6 +165,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
|
||||
<th>Name</th>
|
||||
<th>Produkt</th>
|
||||
<th>Provider</th>
|
||||
<th>Status</th>
|
||||
<th>System</th>
|
||||
<th>Domains</th>
|
||||
<th>IPs</th>
|
||||
@@ -417,6 +418,7 @@ ${r.name}
|
||||
</td>
|
||||
<td>${r.produkt||""}</td>
|
||||
<td><span class="provider">${r.provider || ""}</span></td>
|
||||
<td id="status-${r.id}">...</td>
|
||||
<td>
|
||||
<div class="system">
|
||||
|
||||
@@ -444,7 +446,7 @@ ${ips}
|
||||
`
|
||||
|
||||
table.appendChild(tr)
|
||||
|
||||
checkServerStatus(r)
|
||||
})
|
||||
|
||||
}
|
||||
@@ -541,6 +543,17 @@ const ip=document.getElementById("new_ip").value
|
||||
const type=document.getElementById("new_type").value
|
||||
const comment=document.getElementById("new_comment").value
|
||||
|
||||
const check = await fetch(API+"/ipcheck/"+ip)
|
||||
const result = await check.json()
|
||||
|
||||
if(result.length){
|
||||
|
||||
if(!confirm("IP existiert bereits. Trotzdem speichern?")){
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await fetch(`/resman/api/resources/${resourceId}/ips`,{
|
||||
|
||||
method:"POST",
|
||||
@@ -1064,6 +1077,28 @@ document.getElementById("serverDetailModal").style.display="none"
|
||||
|
||||
}
|
||||
|
||||
async function checkServerStatus(resource){
|
||||
|
||||
if(!Array.isArray(resource.ips)) return
|
||||
|
||||
const ip = resource.ips.find(i=>i.type==="public")
|
||||
|
||||
if(!ip) return
|
||||
|
||||
const res = await fetch(API+"/ping/"+ip.ip)
|
||||
const data = await res.json()
|
||||
|
||||
let icon="🔴"
|
||||
|
||||
if(data.status==="online"){
|
||||
icon="🟢"
|
||||
}
|
||||
|
||||
document.getElementById("status-"+resource.id).innerHTML=icon
|
||||
|
||||
}
|
||||
|
||||
|
||||
loadResources()
|
||||
loadCancelled()
|
||||
loadDomains()
|
||||
|
||||
Reference in New Issue
Block a user