master #18

Merged
m.lettere merged 12 commits from master into prod 2024-06-14 12:47:54 +02:00
3 changed files with 42 additions and 11 deletions
Showing only changes of commit c95b62b1d4 - Show all commits

View File

@ -2,6 +2,7 @@
<head>
<meta charset="UTF-8" />
<script src="https://cdn.cloud-dev.d4science.org/boot/d4s-boot.js"></script>
<script src="js/methodlistcontroller.js"></script>
<script src="js/methodeditorcontroller.js"></script>
<script src="js/inputwidgeteditorcontroller.js"></script>
@ -16,10 +17,11 @@
<script src="https://cdn.cloud-dev.d4science.org/common/js/bss-min-1.2.6.js"></script>
<script src="../storage/d4s-storage.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ol@v9.2.4/dist/ol.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js"></script>
</head>
<body class="m-4">
<d4s-boot-2 clientid="https://next.dev.d4science.org" context="%2Fgcube%2Fdevsec%2FCCP" gateway="next.dev.d4science.org" redirect-url="http://localhost:8080/ccp/index.html" url="https://accounts.dev.d4science.org/auth"> <script src="https://cdn.dev.d4science.org/boot/d4s-boot.js"></script> </d4s-boot-2>
<d4s-boot-2 clientid="https://next.dev.d4science.org" context="%2Fgcube%2Fdevsec%2FCCP" gateway="next.dev.d4science.org" redirect-url="http://localhost:8080/ccp/index.html" url="https://accounts.dev.d4science.org/auth"></d4s-boot-2>
<div class="row">
<div class="col">
<d4s-ccp-methodlist serviceurl="https://ccp.cloud-dev.d4science.org" allow-edit="true" allow-execute="true" archive="true"></d4s-ccp-methodlist>
@ -32,7 +34,7 @@
<d4s-ccp-executionform serviceurl="https://ccp.cloud-dev.d4science.org"></d4s-ccp-executionform>
</div>
<div class="col">
<d4s-ccp-executionhistory archive="true" serviceurl="https://ccp.cloud-dev.d4science.org"></d4s-ccp-executionhistory>
<d4s-ccp-executionhistory allow-archive="true" serviceurl="https://ccp.cloud-dev.d4science.org"></d4s-ccp-executionhistory>
</div>
</div>

View File

@ -30,6 +30,7 @@ class CCPExecutionHistory extends HTMLElement {
"archive_execution_help" : "Archive whole execution to workspace folder",
"archive_outputs_help" : "Archive only outputs to workspace folder",
"re-submit_help" : "Re submit this exact execution",
"re-submit" : "Re-submit",
"delete_help" : "Delete this execution",
"generate_code" : "Generate code for",
"generate_code_help" : "Generate code that replicates this exact execution on a chosen programming language or runtime",
@ -41,12 +42,17 @@ class CCPExecutionHistory extends HTMLElement {
"confirm_import_file" : "Please confirm importing of execution from file",
"confirm_delete_execution" : "Please confirm deletion of this execution",
"confirm_delete_archived_execution" : "Please confirm deletion of this archived execution from your workspace.",
"confirm_archive_execution" : "Confirm archiving of this execution to workspace.",
"confirm_archive_outputs" : "Confirm archiving of outputs to workspace.",
"confirm_reexecution" : "Confirm resubmission of this execution",
"live_executions" : "Live executions",
"archived_executions" : "Archived executions",
"restore_execution_help" : "Restore this archived execution back to CCP",
"infrastructure_help" : "The infrastructure where this execution has been scheduled on",
"runtime_help" : "The runtime where this execution has been scheduled on",
"loading_archived_help" : "Loading archived executions from workspace. This can take a while."
"loading_archived_help" : "Loading archived executions from workspace. This can take a while.",
"err_reexecute" : "Unable to re-submit the execution. Please check console for further info",
"err_generate_code_for" : "Unable to generate code for "
}
}
@ -142,7 +148,7 @@ class CCPExecutionHistory extends HTMLElement {
<svg viewBox="0 0 48 48"><path d="M7 40q-1.15 0-2.075-.925Q4 38.15 4 37V11q0-1.15.925-2.075Q5.85 8 7 8h14l3 3h17q1.15 0 2.075.925Q44 12.85 44 14v23q0 1.15-.925 2.075Q42.15 40 41 40Zm25-3h9V14h-9v4.6h4.6v4.6H32v4.6h4.6v4.6H32ZM7 37h20.4v-4.6H32v-4.6h-4.6v-4.6H32v-4.6h-4.6V14h-4.65l-3-3H7v26Zm0-23v-3 26-23Z"/></svg>
</button>
<button data-index="0" name="reexecute1" title="${this.getLabel("re-submit_help")}" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small">
Re-submit
${this.getLabel("re-submit")}
</button>
<button data-index="0" name="delete" title="${this.getLabel("delete_help")}" class="btn btn-danger ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 0 24 24">
@ -210,6 +216,9 @@ class CCPExecutionHistory extends HTMLElement {
<span name="version" class="badge badge-primary"></span>
<span name="status" class="ml-1 badge"></span>
<div class="d-flex float-right" style="gap: 3px 5px;flex-wrap:wrap;">
<button data-index="0" name="reexecute2" title="${this.getLabel("re-submit_help")}" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small">
${this.getLabel("re-submit")}
</button>
<button name="restore" title="${this.getLabel("restore_execution_help")}" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 -960 960 960" width="24px" fill="#5f6368">
<path d="M480-250q78 0 134-56t56-134q0-78-56-134t-134-56q-38 0-71 14t-59 38v-62h-60v170h170v-60h-72q17-18 41-29t51-11q54 0 92 38t38 92q0 54-38 92t-92 38q-44 0-77-25.5T356-400h-62q14 65 65.5 107.5T480-250ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm0-80h480v-446L526-800H240v640Zm0 0v-640 640Z"/>
@ -521,11 +530,27 @@ class CCPExecutionHistory extends HTMLElement {
}).catch(err=>{ alert(err)})
}
reexecuteArchived(data, level){
this.#boot.secureFetch(`${this.#serviceurl}/executions/level/${level}`, {
method: "POST",
headers: {"Content-Type" : "application/json"},
body: JSON.stringify({ "request" : data.fullrequest, "method" : data.fullmethod, "infrastructure" : data.fullinfrastructure})
})
.then(reply =>{
if (!reply.ok) {
throw this.getLabel("err_reexecute")
}
return reply.json()
}).then(data=>{
this.refreshExecution(data.jobID)
}).catch(err=>{ alert(err)})
}
reexecute(id,level){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/level/${level}`, { method: "POST" })
.then(reply =>{
if (!reply.ok) {
throw "Unable to re-execute. Check console."
throw this.getLabel("err_reexecute")
}
return reply.json()
}).then(data=>{
@ -556,7 +581,7 @@ class CCPExecutionHistory extends HTMLElement {
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/code`,
{ method: "GET", headers : { "Accept" : mime} }).then(reply =>{
if (!reply.ok) {
throw "Unable to generate code for " + mime
throw this.getLabel("err_generate_code_for") + mime
}
return reply.blob()
}).then(blob => {
@ -793,19 +818,19 @@ class CCPExecutionHistory extends HTMLElement {
this.export(id, "application/prov-o+xml", id + ".xml")
}
if(ev.target.getAttribute("name") === "reexecute1"){
if(window.confirm("Please confirm re-execution?")){
if(window.confirm(this.getLabel("confirm_reexecution"))){
const id = ev.currentTarget.getAttribute("data-index")
this.reexecute(id, 1)
}
}
if(ev.target.getAttribute("name") === "archive"){
if(confirm(" Please confirm archiving of execution to workspace folder?")){
if(confirm(this.getLabel("confirm_archive_execution"))){
const id = ev.currentTarget.getAttribute("data-index")
this.toArchiveFolder(id)
}
}
if(ev.target.getAttribute("name") === "archiveoutputs"){
if(confirm(" Please confirm archiving of execution outputs to workspace folder?")){
if(confirm(this.getLabel("confirm_archive_outputs"))){
const id = ev.currentTarget.getAttribute("data-index")
this.toOutputsArchiveFolder(id)
}
@ -1006,6 +1031,10 @@ class CCPExecutionHistory extends HTMLElement {
const wsid = ev.currentTarget.getAttribute("data-wsid")
this.deleteArchiveFolder(wsid)
}
}else if(ev.target.getAttribute("name") === "reexecute2"){
if(window.confirm(this.getLabel("confirm_reexecution"))){
this.reexecuteArchived(ev.currentTarget.bss_input.data, 1)
}
}
},

View File

@ -836,7 +836,7 @@ class D4SWorkspace {
if (uri) {
url += uri.startsWith('/') ? uri : '/' + uri;
}
console.log("Invoking WS API with: " + url);
//console.log("Invoking WS API with: " + url);
return this.#d4sboot.secureFetch(url, req)
.then(resp => {
if (resp.ok) {
@ -1021,7 +1021,7 @@ class D4SWorkspace {
tmplnk.click();
document.body.removeChild(tmplnk);
} else {
console.log("Skipping local download");
//console.log("Skipping local download");
}
return data;
}).catch(err => {