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 ){
|
|
||||||
const m = this.#data[d]
|
|
||||||
if(!m.links || m.links.length === 0) continue;
|
|
||||||
const rts = m.links
|
|
||||||
.filter(l => l.rel === "compatibleWith")
|
|
||||||
.map( l => l.href.replace("runtimes/",""))
|
|
||||||
.join(" ")
|
|
||||||
const url = this.#serviceurl + "/infrastructures/runtimes?runtimes=" + rts
|
|
||||||
promises.push(
|
|
||||||
this.#boot.secureFetch(url).
|
this.#boot.secureFetch(url).
|
||||||
then(resp=>{
|
then(resp=>{
|
||||||
m["executable"] = resp.status === 200
|
if(resp.status !== 200) throw "Unable to fetch infrastructures " + resp.status;
|
||||||
if(resp.status === 404) return null;
|
else return resp.json()
|
||||||
|
}).then(infras=>{
|
||||||
|
for(let m=0; m < this.#data.length; m++){
|
||||||
|
const method = this.#data[m]
|
||||||
|
for(let i=0; i < infras.length; i++){
|
||||||
|
const infra = infras[i]
|
||||||
|
const matches = m.links.filter(l => return l.rel === "compatibleWith" && l.href === "infrastructures/" + infra.id
|
||||||
|
m["executable"] = matches.length > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}).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