working resman fertig vou UI optimierung Server

This commit is contained in:
ecki
2026-03-07 16:27:51 +01:00
parent e19636a3f8
commit 7e3c587c80
2 changed files with 81 additions and 752 deletions
+81 -11
View File
@@ -83,7 +83,7 @@ border-radius:6px;
<body>
<h1>Resource Manager</h1>
<h1>Resourcen Verwaltung</h1>
<section>
@@ -103,9 +103,10 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
</section>
<section>
<h2>Active Resources</h2>
<h2>Active Resourcen</h2>
<button onclick="openCreate()">Neue Resource</button>
@@ -122,7 +123,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<th>OS</th>
<th>Domains</th>
<th>IPs</th>
<th>Actions</th>
<th>Aktionen</th>
</tr>
</thead>
@@ -132,6 +133,15 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
</section>
<section>
<h2>Infrastruktur Übersicht</h2>
<div id="infraView"></div>
</section>
<section>
<h2>Domains</h2>
@@ -146,8 +156,8 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<th>Provider</th>
<th>IP</th>
<th>Server</th>
<th>Cost/Y</th>
<th>Actions</th>
<th>Kosten/Jahr</th>
<th>Aktionen</th>
</tr>
</thead>
@@ -159,7 +169,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<section>
<h2>Domain → Server Mapping</h2>
<h2>Domain → Server Zuordnung</h2>
<table>
@@ -179,7 +189,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<section>
<h2>Cancelled Resources</h2>
<h2>Gekündigte Resources</h2>
<table>
@@ -255,7 +265,7 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<div id="ipModal" class="modal">
<h3>IP Manager</h3>
<h3>IP Verwaltung</h3>
<input type="hidden" id="ip_resource_id">
@@ -287,9 +297,9 @@ Domains jährlich: <span id="costDomain">0</span> €<br>
<label>IP Adresse</label> <input id="domain_ip">
<label>Yearly Cost</label> <input id="domain_cost">
<label>Jährliche Kosten</label> <input id="domain_cost">
<label>Notes</label>
<label>Notizen</label>
<textarea id="domain_notes"></textarea>
@@ -349,7 +359,7 @@ tr.innerHTML=`
<td>
${ips}
<br>
<button onclick="openIPManager(${r.id})">Manage</button>
<button onclick="openIPManager(${r.id})">IPs Verwalten</button>
</td>
<td>
@@ -794,12 +804,72 @@ document.getElementById("costTotal").innerText=(year+domainYear).toFixed(2)
}
async function loadInfrastructure(){
const res=await fetch(API+"/resources/active")
const resources=await res.json()
const mapRes=await fetch(API+"/domainmap")
const mappings=await mapRes.json()
let html=""
resources.forEach(r=>{
html+=`<div style="margin-bottom:20px;border:1px solid #ddd;padding:10px;border-radius:6px">
<b>${r.name}</b><br>
Produkt: ${r.produkt||""}<br>
CPU: ${r.cpu||""} | RAM: ${r.ram||""} | Disk: ${r.disk||""}<br>
OS: ${r.os||""}
<br><br>
`
if(Array.isArray(r.ips)){
r.ips.forEach(ip=>{
html+=`<div style="margin-left:20px">
<b>IP:</b> ${ip.ip} (${ip.type||""})
`
const domains=mappings.filter(m=>m.ip_address==ip.ip)
domains.forEach(d=>{
html+=`<div style="margin-left:20px;color:#444">
🌐 ${d.domain_name}
</div>`
})
html+=`</div>`
})
}
html+=`</div>`
})
document.getElementById("infraView").innerHTML=html
}
loadResources()
loadCancelled()
loadDomains()
loadMapping()
loadCosts()
loadInfrastructure()
</script>