From d94d3b97ae905ed5985b77577c7d8cd948f93565 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 28 Mar 2023 11:27:45 +0200 Subject: [PATCH] simplified infrastructures widget --- ccp/js/infrastructurelistcontroller.js | 56 +++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ccp/js/infrastructurelistcontroller.js b/ccp/js/infrastructurelistcontroller.js index f26e65b..18298c0 100644 --- a/ccp/js/infrastructurelistcontroller.js +++ b/ccp/js/infrastructurelistcontroller.js @@ -71,7 +71,7 @@ class CCPInfrastructureList extends HTMLElement{ } fetchInfrastructures(){ - const prom1 = this.#boot.secureFetch(this.#serviceurl + "/infrastructures/cache"). + const prom1 = this.#boot.secureFetch(this.#serviceurl + "/infrastructures"). then(resp=>{ if(resp.status !== 200) throw "Unable to fetch infrastructure cache"; return resp.json() @@ -98,7 +98,7 @@ class CCPInfrastructureList extends HTMLElement{ } refreshInfrastructures(){ - this.#boot.secureFetch(this.#serviceurl + "/infrastructures/cache", { method : "HEAD"}) + this.#boot.secureFetch(this.#serviceurl + "/infrastructures", { method : "HEAD"}) } showList(){ @@ -108,11 +108,26 @@ class CCPInfrastructureList extends HTMLElement{ } this.#rootdoc.innerHTML = `
- ${this.#style} - ${this.toolbar()} - + +
+
+
+
+ Infrastructures +
+
+ +
+
+
+
+
    + ${this.showInfrastructures()} +
+
+
` this.#rootdoc.querySelector(".ccp_infrastructure_toolbar").addEventListener("click", ev=>{ @@ -124,7 +139,7 @@ class CCPInfrastructureList extends HTMLElement{ } }) - const forms = Array.prototype.slice.call(this.#rootdoc.querySelectorAll(".ccp_runtime_builder")) + /*const forms = Array.prototype.slice.call(this.#rootdoc.querySelectorAll(".ccp_runtime_builder")) forms.forEach(f=>{ f.addEventListener("submit", ev=>{ ev.stopPropagation() @@ -134,15 +149,7 @@ class CCPInfrastructureList extends HTMLElement{ this.#boot.secureFetch(url, { method : ev.target.method}) return false }) - }) - } - - toolbar(){ - return ` -
- -
- ` + })*/ } showInfrastructures(){ @@ -155,17 +162,13 @@ class CCPInfrastructureList extends HTMLElement{ ${this.showAge(i)} ${this.showType(i)} - ${this.showDeployableRuntimes(i)} - ` }).join("\n") } - showDeployableRuntimes(infra){ + /* showDeployableRuntimes(infra){ const alreadydeployed = infra.runtimes.map(r=>r["descriptor-id"]) infra.available_runtimes = infra.available_runtimes ? infra.available_runtimes : [] const options = infra.available_runtimes.filter(r=>{ @@ -191,9 +194,6 @@ class CCPInfrastructureList extends HTMLElement{
  • ${r.name} -
      - ${this.showInstances(r)} -
  • ` @@ -206,7 +206,7 @@ class CCPInfrastructureList extends HTMLElement{
  • ${i.name}
  • ` }).join("\n") - } + }*/ showAge(infra){ const age = Math.floor(((new Date()) - (new Date(infra.date))) / 3600000) @@ -242,7 +242,7 @@ class CCPInfrastructureList extends HTMLElement{ }, 30000) } - getCompatibleRuntimes(rts){ + /*getCompatibleRuntimes(rts){ const available = Object.keys(this.#infrastructures).reduce((acc, i) => { const compatiblerts = this.#infrastructures[i].runtimes. filter(r=>rts.indexOf(r["descriptor-id"]) >= 0). @@ -250,7 +250,7 @@ class CCPInfrastructureList extends HTMLElement{ return acc.concat(compatiblerts) }, []) return available - } + }*/ } window.customElements.define('d4s-ccp-infrastructurelist', CCPInfrastructureList);