From 7fae7701860f836e2b9efeeaac59a80d7e7dcb05 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Fri, 11 Oct 2024 13:12:30 +0200 Subject: [PATCH 1/2] scripts are always visible. fix missing cancel on geo widget. inputs show default preview when closed. Method description is now text area. Method list and execution form have limit on description length display --- ccp/js/executionformcontroller.js | 388 ++++++++++++++------------ ccp/js/inputwidgetcontroller.js | 5 + ccp/js/inputwidgeteditorcontroller.js | 16 +- ccp/js/methodeditorcontroller.js | 82 +++--- ccp/js/methodlistcontroller.js | 24 +- extapp/index.html | 2 +- 6 files changed, 284 insertions(+), 233 deletions(-) diff --git a/ccp/js/executionformcontroller.js b/ccp/js/executionformcontroller.js index 159cac7..800f942 100644 --- a/ccp/js/executionformcontroller.js +++ b/ccp/js/executionformcontroller.js @@ -1,55 +1,55 @@ -class CCPExecutionForm extends HTMLElement{ - +class CCPExecutionForm extends HTMLElement { + #boot; #rootdoc; #data; #method; - #serviceurl; + #serviceurl; #messages = { - "en" : { - "confirm_form_overwrite" : "Please confirm the overwrite of the previous execution form.", - "Inputs" : "Inputs", - "Options" : "Options", - "Outputs" : "Outputs", - "Execute" : "Execute", - "execute_help" : "Submit an execution request", - "generate_code" : "Generate code for", - "generate_code_help" : "Generate example code for a selectable programming language or runtime", - "direct_link" : "Direct link", - "direct_link_help" : "Navigate to the link for directly reopening this method in the execution form", - "automatic_archive_option" : "Select what you like to archive automatically when the execution is completed", - "automatic_archive_provenance" : "Automatically archive whole execution provenance", - "automatic_archive_provenance_help" : "Automatically archive the whole execution provenance to the workspace", - "automatic_archive_outputs" : "Automatically archive uncompressed outputs only", - "automatic_archive_outputs_help" : "Automatically archive only the outputs to the workspace", - "automatic_archive_none" : "Do not archive anything automatically", - "automatic_archive_none_help" : "Do not archive anything automatically", - "execution_accepted" : "Execution request accepted with id: ", - "drop_method_invitation" : "Drop a method here to request an execution", - "err_execution_not_accepted" : "Error. Execution has not been accepted by server", - "err_code_generation" : "Error while generating code", - "err_load_method" : "Error while loading method", - "err_no_runtimes" : "This method has no compatible runtimes available", - "err_execute" : "Error while sending execution request", + "en": { + "confirm_form_overwrite": "Please confirm the overwrite of the previous execution form.", + "Inputs": "Inputs", + "Options": "Options", + "Outputs": "Outputs", + "Execute": "Execute", + "execute_help": "Submit an execution request", + "generate_code": "Generate code for", + "generate_code_help": "Generate example code for a selectable programming language or runtime", + "direct_link": "Direct link", + "direct_link_help": "Navigate to the link for directly reopening this method in the execution form", + "automatic_archive_option": "Select what you like to archive automatically when the execution is completed", + "automatic_archive_provenance": "Automatically archive whole execution provenance", + "automatic_archive_provenance_help": "Automatically archive the whole execution provenance to the workspace", + "automatic_archive_outputs": "Automatically archive uncompressed outputs only", + "automatic_archive_outputs_help": "Automatically archive only the outputs to the workspace", + "automatic_archive_none": "Do not archive anything automatically", + "automatic_archive_none_help": "Do not archive anything automatically", + "execution_accepted": "Execution request accepted with id: ", + "drop_method_invitation": "Drop a method here to request an execution", + "err_execution_not_accepted": "Error. Execution has not been accepted by server", + "err_code_generation": "Error while generating code", + "err_load_method": "Error while loading method", + "err_no_runtimes": "This method has no compatible runtimes available", + "err_execute": "Error while sending execution request", } } - constructor(){ + constructor() { super() this.#boot = document.querySelector("d4s-boot-2") - this.#rootdoc = this.attachShadow({ "mode" : "open"}) + this.#rootdoc = this.attachShadow({ "mode": "open" }) } - - connectedCallback(){ + + connectedCallback() { this.#serviceurl = this.getAttribute("serviceurl") this.connectNewExecutionRequest() this.render() const params = new URLSearchParams(window.location.search) - if(params.get('execution')){ - const execution = { id : params.get('execution') } - this.prepareFromExecution(execution) - } else if(params.get('method')){ + if (params.get('execution')) { + const execution = { id: params.get('execution') } + this.prepareFromExecution(execution) + } else if (params.get('method')) { this.#method = params.get('method') this.loadMethod() } else { @@ -57,11 +57,11 @@ class CCPExecutionForm extends HTMLElement{ } } - static get observedAttributes() { + static get observedAttributes() { return ["method"]; } - - getLabel(key, localehint){ + + getLabel(key, localehint) { const locale = localehint ? localehint : navigator.language const actlocale = this.#messages[locale] ? locale : "en" const msg = this.#messages[actlocale][key] @@ -70,27 +70,27 @@ class CCPExecutionForm extends HTMLElement{ attributeChangedCallback(name, oldValue, newValue) { //if((oldValue != newValue) && (name === "method")){ - if(name === "method"){ + if (name === "method") { this.#method = newValue this.loadMethod() } } - - connectNewExecutionRequest(){ - document.addEventListener("newexecutionrequest", ev=>{ - if(this.#data){ - if(window.confirm(this.getLabel("confirm_form_overwrite"))){ + + connectNewExecutionRequest() { + document.addEventListener("newexecutionrequest", ev => { + if (this.#data) { + if (window.confirm(this.getLabel("confirm_form_overwrite"))) { this.setAttribute("method", ev.detail) - this.parentElement.scrollIntoViewIfNeeded() + this.parentElement.scrollIntoViewIfNeeded() } - }else{ + } else { this.setAttribute("method", ev.detail) this.parentElement.scrollIntoViewIfNeeded() } }) } - - render(){ + + render() { this.#rootdoc.innerHTML = `
@@ -105,7 +105,7 @@ class CCPExecutionForm extends HTMLElement{