moved runnability check to infras instead of runtimes
This commit is contained in:
parent
36f307b308
commit
92297a226a
|
@ -159,7 +159,7 @@ class CCPMethodList2 extends HTMLElement{
|
||||||
console.log("Processes parsed to json", data)
|
console.log("Processes parsed to json", data)
|
||||||
this.#data = data
|
this.#data = data
|
||||||
this.updateList()
|
this.updateList()
|
||||||
return Promise.all(this.fetchRuntimes())
|
return this.fetchInfrastructures()
|
||||||
}).then(d => {
|
}).then(d => {
|
||||||
this.updateList()
|
this.updateList()
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
|
@ -168,28 +168,25 @@ class CCPMethodList2 extends HTMLElement{
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchRuntimes(){
|
fetchInfrastructures(){
|
||||||
var promises = []
|
const url = this.#serviceurl + "/infrastructures"
|
||||||
for(var d in this.#data ){
|
this.#boot.secureFetch(url).
|
||||||
const m = this.#data[d]
|
then(resp=>{
|
||||||
if(!m.links || m.links.length === 0) continue;
|
if(resp.status !== 200) throw "Unable to fetch infrastructures " + resp.status;
|
||||||
const rts = m.links
|
else return resp.json()
|
||||||
.filter(l => l.rel === "compatibleWith")
|
}).then(infras=>{
|
||||||
.map( l => l.href.replace("runtimes/",""))
|
for(let m=0; m < this.#data.length; m++){
|
||||||
.join(" ")
|
const method = this.#data[m]
|
||||||
const url = this.#serviceurl + "/infrastructures/runtimes?runtimes=" + rts
|
for(let i=0; i < infras.length; i++){
|
||||||
promises.push(
|
const infra = infras[i]
|
||||||
this.#boot.secureFetch(url).
|
const matches = m.links.filter(l => return l.rel === "compatibleWith" && l.href === "infrastructures/" + infra.id
|
||||||
then(resp=>{
|
m["executable"] = matches.length > 0
|
||||||
m["executable"] = resp.status === 200
|
}
|
||||||
if(resp.status === 404) return null;
|
}
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
alert("Error while checking runtimes for method")
|
alert("Error while checking runtimes for method")
|
||||||
console.error("Error while checking runtimes for method: " + err)
|
console.error("Error while checking runtimes for method: " + err)
|
||||||
})
|
})
|
||||||
)
|
|
||||||
}
|
|
||||||
return promises
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateList(){
|
updateList(){
|
||||||
|
|
Loading…
Reference in New Issue