window.loadInfrastructure = async function(){ const resources = window.resources || [] const mappings = await api(API + "/domainmap") const subs = await api(API + "/subdomains") const container = document.getElementById("infraView") container.innerHTML = "" resources.forEach(r => { let html = `
${r.name}
` if(Array.isArray(r.ips)){ r.ips.forEach(ip => { html += `
└ ${ip.ip}
` const domains = mappings.filter(m => m.resource_id == r.id && m.ip_address == ip.ip ) domains.forEach(d => { html += `
 └ 🌐 ${d.domain_name}
` const sublist = subs.filter(s => s.domain_id == d.domain_id || s.domain_name == d.domain_name ) sublist.forEach(s => { if(s.ip_address == ip.ip){ html += `
   └ ${s.subdomain}.${s.domain_name}
` } }) }) }) } container.innerHTML += html }) }