Merge pull request 'master' (#10) from master into prod

Reviewed-on: #10
This commit is contained in:
Marco Lettere 2024-02-15 18:31:39 +01:00
commit 8649ef8d3d
2 changed files with 27 additions and 3 deletions

View File

@ -77,6 +77,17 @@ class CCPExecutionForm extends HTMLElement{
</div> </div>
</div> </div>
</div> </div>
<div class="card">
<div class="card-header">
<h5>Options</h5>
</div>
<div class="card-body">
<div class="col form-check">
<input class="form-check-input" type="checkbox" name="auto-archive-outputs" alt="Automatically archive outputs to workspace" title="Automatically archive outputs to workspace" checked="checked">
<label class="form-check-label">Automatically archive outputs to workspace</label>
</div>
</div>
</div>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h5>Outputs</h5> <h5>Outputs</h5>
@ -237,6 +248,13 @@ class CCPExecutionForm extends HTMLElement{
if(o.enabled) request.outputs[o.name] = { transmissionMode : "value" }; if(o.enabled) request.outputs[o.name] = { transmissionMode : "value" };
}) })
const autoarchiveoption = this.#rootdoc.querySelector("input[name='auto-archive-outputs']")
if (autoarchiveoption.checked){
request.subscribers = [
{ successUri : "http://registry:8080/executions/archive-to-folder" }
]
}
return request return request
} }
@ -248,7 +266,7 @@ class CCPExecutionForm extends HTMLElement{
return Array.prototype.slice.call(this.#rootdoc.querySelectorAll("d4s-ccp-output")) return Array.prototype.slice.call(this.#rootdoc.querySelectorAll("d4s-ccp-output"))
} }
initValues(inputs){ initInputValues(inputs){
Object.keys(inputs).forEach(k=>{ Object.keys(inputs).forEach(k=>{
const w = this.#rootdoc.querySelector(`d4s-ccp-input[name=${k}]`) const w = this.#rootdoc.querySelector(`d4s-ccp-input[name=${k}]`)
if(w){ if(w){
@ -257,6 +275,11 @@ class CCPExecutionForm extends HTMLElement{
}) })
} }
initOptionValues(request){
const autoarchiveoption = this.#rootdoc.querySelector("input[name='auto-archive-outputs']")
autoarchiveoption.checked = request.subscribers && request.subscribers.filter(s=>s.successUri === "http://registry:8080/executions/archive-to-folder").length === 1
}
prepareFromExecution(exec){ prepareFromExecution(exec){
let f1 = let f1 =
this.#boot.secureFetch(this.#serviceurl + `/executions/${exec.id}/metadata/method.json`) this.#boot.secureFetch(this.#serviceurl + `/executions/${exec.id}/metadata/method.json`)
@ -288,7 +311,8 @@ class CCPExecutionForm extends HTMLElement{
this.#data.executable = resp.status === 200 this.#data.executable = resp.status === 200
}).then(()=>{ }).then(()=>{
this.showMethod() this.showMethod()
this.initValues(requestdata.inputs) this.initInputValues(requestdata.inputs)
this.initOptionValues(requestdata)
}).catch(err=>alert(err)) }).catch(err=>alert(err))
} }

View File

@ -22,7 +22,7 @@ class CCPOutputWidgetController extends HTMLElement {
render(){ render(){
return ` return `
<div class="col form-check"> <div class="col form-check">
<input class="form-check-input" type="checkbox" name="this.#output.id" alt="${this.#output.description}" title="${this.#output.description}" checked="checked"/> <input class="form-check-input" type="checkbox" name="${this.#output.id}" alt="${this.#output.description}" title="${this.#output.description}" checked="checked"/>
<label class="form-check-label">${this.#output.title}</label> <label class="form-check-label">${this.#output.title}</label>
</div> </div>
` `