From e19636a3f8f9302d337e9c412aa9015ddb62ab0c Mon Sep 17 00:00:00 2001 From: ecki Date: Sat, 7 Mar 2026 14:50:28 +0100 Subject: [PATCH] working resman fertig mit kosten dashboard --- backend/public/index.html | 70 +++- backend/public/index.sav | 741 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 809 insertions(+), 2 deletions(-) create mode 100644 backend/public/index.sav diff --git a/backend/public/index.html b/backend/public/index.html index b327fde..368bb75 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -87,6 +87,24 @@ border-radius:6px;
+

Kosten Dashboard

+ +
+ +Server monatlich: 0
+Server jährlich: 0
+Domains jährlich: 0
+ +
+ +Gesamt jährlich: 0 + +
+ +
+ +
+

Active Resources

@@ -102,6 +120,7 @@ border-radius:6px; RAM Disk OS +Domains IPs Actions @@ -290,6 +309,9 @@ async function loadResources(){ const res=await fetch(API+"/resources/active") const data=await res.json() +const mapRes=await fetch(API+"/domainmap") +const mappings=await mapRes.json() + const table=document.getElementById("resources") table.innerHTML="" @@ -306,6 +328,12 @@ ips=r.ips.map(ip=>` } +let domains=mappings +.filter(m=>m.resource_id==r.id) +.map(m=>`
${m.domain_name}
`) +.join("") + + const tr=document.createElement("tr") tr.innerHTML=` @@ -317,7 +345,7 @@ tr.innerHTML=` ${r.ram||""} ${r.disk||""} ${r.os||""} - +${domains} ${ips}
@@ -585,7 +613,13 @@ tr.innerHTML=` ${d.domain_name} ${d.provider||""} ${d.ip_address||""} -${d.resource_name||""} + + +${d.resource_name ? +d.resource_name : +"⚠ no server"} + + ${d.yearly_cost||""} @@ -728,12 +762,44 @@ table.appendChild(tr) } +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() + +let month=0 +let year=0 +let domainYear=0 + +resources.forEach(r=>{ + +month+=Number(r.kosten_monat||0) +year+=Number(r.kosten_jahr||0) + +}) + +domains.forEach(d=>{ +domainYear+=Number(d.yearly_cost||0) +}) + +document.getElementById("costMonth").innerText=month.toFixed(2) +document.getElementById("costYear").innerText=year.toFixed(2) +document.getElementById("costDomain").innerText=domainYear.toFixed(2) + +document.getElementById("costTotal").innerText=(year+domainYear).toFixed(2) + +} + loadResources() loadCancelled() loadDomains() loadMapping() +loadCosts() diff --git a/backend/public/index.sav b/backend/public/index.sav new file mode 100644 index 0000000..b327fde --- /dev/null +++ b/backend/public/index.sav @@ -0,0 +1,741 @@ + + + + + +ResMan + + + + + + + +

Resource Manager

+ +
+ +

Active Resources

+ + + + + + + + + + + + + + + + + + + + + +
NameProduktProviderCPURAMDiskOSIPsActions
+ +
+ +
+ +

Domains

+ + + + + + + + + + + + + + + + + + +
DomainProviderIPServerCost/YActions
+ +
+ +
+ +

Domain → Server Mapping

+ + + + + + + + + + + + + +
DomainIPServer
+ +
+ +
+ +

Cancelled Resources

+ + + + + + + + + + + + + + + + + +
NameProduktProviderCPURAMDiskStatus
+ +
+ + + + + + + + + + +