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

View File

@ -67,15 +67,56 @@ class CCPOutputWidgetEditorController extends HTMLElement {
</select> </select>
</div> </div>
</div> </div>
<div class="col"> <div class="col-3">
<div class="form-field" title="Mime type"> <div class="form-field" title="Mime type">
<input value="${this.#output.schema.contentMediaType}" name="contentMediaType" class="form-control" placeholder="mime"/> <input value="${this.#output.schema.contentMediaType}" name="contentMediaType" class="form-control" placeholder="mime"/>
</div> </div>
</div> </div>
${this.renderMetadata()}
</div> </div>
</div> </div>
</details> </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 ""
} }
} }