added check to discourage execution requests with empty ccpimage when container based infra
This commit is contained in:
parent
74c2819de8
commit
224206adf7
|
@ -31,6 +31,7 @@ class CCPExecutionForm extends HTMLElement {
|
|||
"err_load_method": "Error while loading method",
|
||||
"err_no_runtimes": "This method has no compatible runtimes available",
|
||||
"err_execute": "Error while sending execution request",
|
||||
"container_based_warning_confirm" : "The compatible architectures appear to be container based but no ccpimage input has been specified. This could cause errors that can be unpredictable on some infrastructures. Do you want to proceed anyway?"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,6 +245,19 @@ class CCPExecutionForm extends HTMLElement {
|
|||
this.lockRender()
|
||||
const url = this.#serviceurl + "/processes/" + this.#method + "/execution"
|
||||
const req = this.buildRequest()
|
||||
|
||||
// Perform preliminary check on the possibility of infra being container based and ccpimage missing
|
||||
if(!req.inputs["ccpimage"]){
|
||||
const reg = /docker|lxd/i
|
||||
const containerbased =
|
||||
this.#data.links.filter(l=>l.rel === "compatibleWith").
|
||||
reduce((acc, l)=>{ return acc && (l.title.match(reg) || l.href.match(reg) ? true : false)}, true)
|
||||
if(containerbased && !window.confirm(this.getLabel("container_based_warning_confirm"))){
|
||||
this.unlockRender()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.#boot.secureFetch(
|
||||
url, { method: "POST", body: JSON.stringify(req), headers: { "Content-Type": "application/json" } }
|
||||
).then(reply => {
|
||||
|
|
Loading…
Reference in New Issue