From 6bcbf318c73062672b1cfe370fb3e1b5d3fdf319 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 29 Mar 2022 16:06:46 +0200 Subject: [PATCH] added infrastructure query --- ccp/executionformfragment.html | 2 +- ccp/js/infrastructurelistcontroller.js | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ccp/js/infrastructurelistcontroller.js diff --git a/ccp/executionformfragment.html b/ccp/executionformfragment.html index a6a4708..e64b4da 100644 --- a/ccp/executionformfragment.html +++ b/ccp/executionformfragment.html @@ -21,7 +21,7 @@
diff --git a/ccp/js/infrastructurelistcontroller.js b/ccp/js/infrastructurelistcontroller.js new file mode 100644 index 0000000..69b78dd --- /dev/null +++ b/ccp/js/infrastructurelistcontroller.js @@ -0,0 +1,26 @@ +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);