ResMan update
This commit is contained in:
@@ -345,7 +345,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
|
||||
|
||||
<label>IP Adresse</label> <input id="domain_ip">
|
||||
|
||||
<label>Jährliche Kosten</label> <input id="domain_cost" type="number" step="0.01">>
|
||||
<label>Jährliche Kosten</label><input id="domain_cost" type="number" step="0.01">
|
||||
|
||||
<label>Notizen</label>
|
||||
|
||||
@@ -374,7 +374,30 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
|
||||
|
||||
const API="/resman/api"
|
||||
|
||||
async function api(url, options={}){
|
||||
|
||||
const res = await fetch(url, options)
|
||||
|
||||
if(!res.ok){
|
||||
|
||||
let msg="API error"
|
||||
|
||||
try{
|
||||
|
||||
const err=await res.json()
|
||||
msg=err.error || msg
|
||||
|
||||
}catch(e){}
|
||||
|
||||
alert("Fehler: "+msg)
|
||||
|
||||
throw new Error(msg)
|
||||
|
||||
}
|
||||
|
||||
return res.json()
|
||||
|
||||
}
|
||||
|
||||
async function loadResources(){
|
||||
|
||||
@@ -693,8 +716,7 @@ loadInfrastructure()
|
||||
|
||||
async function loadDomains(){
|
||||
|
||||
const res = await fetch(API+"/domains")
|
||||
const data = await res.json()
|
||||
const data = await api(API+"/domains")
|
||||
|
||||
const table = document.getElementById("domains")
|
||||
table.innerHTML=""
|
||||
@@ -770,9 +792,6 @@ if(!server && dnsIP){
|
||||
server = mappings.find(m=>m.ip_address==dnsIP)
|
||||
}
|
||||
|
||||
if(server){
|
||||
document.getElementById("server-"+d.id).innerHTML=server.server_name
|
||||
}
|
||||
|
||||
if(server){
|
||||
document.getElementById("server-"+d.id).innerHTML=server.server_name
|
||||
@@ -937,8 +956,7 @@ async function loadCosts(){
|
||||
const res=await fetch(API+"/resources/active")
|
||||
const resources=await res.json()
|
||||
|
||||
const domRes=await fetch(API+"/domains")
|
||||
const domains=await domRes.json()
|
||||
const domains = await api(API+"/domains")
|
||||
|
||||
let month=0
|
||||
let year=0
|
||||
|
||||
Reference in New Issue
Block a user