Subdomain edit funktion eingebaut
This commit is contained in:
@@ -19,6 +19,7 @@ const sublist = subs
|
||||
↳ ${s.subdomain}.${s.domain_name}
|
||||
<span id="subdns-${s.id}">...</span>
|
||||
<span id="subserver-${s.id}" class="serverlink"></span>
|
||||
<button onclick='openSubEdit(${JSON.stringify(s)})'>Edit</button>
|
||||
<button onclick="deleteSub(${s.id})">Delete</button>
|
||||
|
||||
</div>
|
||||
@@ -215,3 +216,51 @@ async function loadMapping(){
|
||||
|
||||
}
|
||||
|
||||
window.saveSubdomain = async function(){
|
||||
|
||||
const id = document.getElementById("sub_id").value
|
||||
const domain_id = document.getElementById("sub_domain_id").value
|
||||
const subdomain = document.getElementById("sub_name").value
|
||||
const ip_address = document.getElementById("sub_ip").value
|
||||
|
||||
const data = {
|
||||
domain_id,
|
||||
subdomain,
|
||||
ip_address
|
||||
}
|
||||
|
||||
if(id){
|
||||
|
||||
await api(API+"/subdomains/"+id,{
|
||||
method:"PUT",
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify(data)
|
||||
})
|
||||
|
||||
}else{
|
||||
|
||||
await api(API+"/subdomains",{
|
||||
method:"POST",
|
||||
headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify(data)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
closeSubModal()
|
||||
|
||||
loadDomains()
|
||||
|
||||
}
|
||||
|
||||
window.deleteSub = async function(id){
|
||||
|
||||
if(!confirm("Subdomain löschen?")) return
|
||||
|
||||
await api(API + "/subdomains/" + id, {
|
||||
method: "DELETE"
|
||||
})
|
||||
|
||||
loadDomains()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user