cdn-experiments/ccp/js/infrastructurelistcontrolle...

27 lines
616 B
JavaScript
Raw Normal View History

2022-03-29 16:06:46 +02:00
class CCPInfrastructureList extends HTMLElement{
#boot;
#data;
#serviceurl = "https://nubis1.int.d4science.net:8080"
constructor(){
super()
this.#boot = document.querySelector("d4s-boot-2")
this.fetchInfrastructures()
}
fetchInfrastuctures(){
this.#boot.service(this.#serviceurl + "/infrastructures", "GET",
(resp)=>this.updateList(resp),
()=>{ alert("An error occurred while fetching CCP infrastructures.") })
}
updateList(resp){
this.#data = JSON.parse(resp)
}
}
window.customElements.define('d4s-ccp-infrastructurelist', CCPInfrastructureList);