improved output support

This commit is contained in:
dcore94 2022-09-13 15:12:26 +02:00
parent e479d75ff1
commit edde4a02fa
2 changed files with 63 additions and 1 deletions

View File

@ -620,6 +620,13 @@ class CCPMethodEditorController extends HTMLElement{
description : "A new output field",
minOccurs : 1,
maxOccurs : 1,
metadata : [
{
"role" : "file",
"title" : "newoutput.txt",
"href" : "newoutput.txt"
}
],
schema : {
type : "string",
contentMediaType : "text/plain"
@ -639,6 +646,13 @@ class CCPMethodEditorController extends HTMLElement{
description : "Standard output channel",
minOccurs : 1,
maxOccurs : 1,
metadata : [
{
"role" : "file",
"title" : "stdout",
"href" : "stdout"
}
],
schema : {
type : "string",
contentMediaType : "text/plain"
@ -658,6 +672,13 @@ class CCPMethodEditorController extends HTMLElement{
description : "Standard error channel",
minOccurs : 1,
maxOccurs : 1,
metadata : [
{
"role" : "file",
"title" : "stderr",
"href" : "stderr"
}
],
schema : {
type : "string",
contentMediaType : "text/plain"

View File

@ -67,15 +67,56 @@ class CCPOutputWidgetEditorController extends HTMLElement {
</select>
</div>
</div>
<div class="col">
<div class="col-3">
<div class="form-field" title="Mime type">
<input value="${this.#output.schema.contentMediaType}" name="contentMediaType" class="form-control" placeholder="mime"/>
</div>
</div>
${this.renderMetadata()}
</div>
</div>
</details>
`
this.addEventListener("input", ev=>{
const val = ev.target.value
const ename = ev.target.getAttribute("name")
if(ename === "id"){
this.#output.id = val
}
else if(ename === "title"){
this.#output.title = val
}
else if(ename === "description"){
this.#output.description = val
}
else if(ename === "minOccurs"){
this.#output.minOccurs = val
}
else if(ename === "maxOccurs"){
this.#output.maxOccurs = val
}
else if(ename === "contentMediaType"){
this.#output.schema.contentMediaType = val
}
else if(ename === "href"){
this.#output.metadata[0].href = val
this.#output.metadata[0].title = val
}
})
}
renderMetadata(output){
if(this.#output.metadata && this.#output.metadata.length > 0){
return `
<div class="col">
<div class="form-field" title="File path">
<input value="${this.#output.metadata[0].href}" name="href" class="form-control" placeholder="mime"/>
</div>
</div>
`
}else return ""
}
}