From edde4a02fa93e627f3cf22ebbcb49adf83099b01 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Tue, 13 Sep 2022 15:12:26 +0200 Subject: [PATCH] improved output support --- ccp/js/methodeditorcontroller.js | 21 +++++++++++++ ccp/js/outputwidgeteditorcontroller.js | 43 +++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/ccp/js/methodeditorcontroller.js b/ccp/js/methodeditorcontroller.js index d9b01d4..aacdad6 100644 --- a/ccp/js/methodeditorcontroller.js +++ b/ccp/js/methodeditorcontroller.js @@ -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" diff --git a/ccp/js/outputwidgeteditorcontroller.js b/ccp/js/outputwidgeteditorcontroller.js index 11c384c..3620624 100644 --- a/ccp/js/outputwidgeteditorcontroller.js +++ b/ccp/js/outputwidgeteditorcontroller.js @@ -67,15 +67,56 @@ class CCPOutputWidgetEditorController extends HTMLElement { -
+
+ ${this.renderMetadata()}
` + + 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 ` +
+
+ +
+
+ ` + }else return "" + } }