refactored according to new API

This commit is contained in:
dcore94 2024-06-04 16:53:01 +02:00
parent 0eb335cc17
commit 3e1dd1bf6d
1 changed files with 17 additions and 17 deletions

View File

@ -78,18 +78,18 @@ class CCPExecutionHistory extends HTMLElement {
<span name="status" class="ml-1 badge"></span> <span name="status" class="ml-1 badge"></span>
<div class="d-flex float-right" style="gap: 3px 5px; max-width: 40%; min-width:60px; flex-wrap:wrap;"> <div class="d-flex float-right" style="gap: 3px 5px; max-width: 40%; min-width:60px; flex-wrap:wrap;">
${ this.#archive ? ` ${ this.#archive ? `
<button data-index="0" name="archive" title="Archive to workspace" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small"> <button data-index="0" name="archive" title="Archive whole execution to workspace folder" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 96 960 960"><path d="M140 796h680V516H140v280Zm540.118-90Q701 706 715.5 691.382q14.5-14.617 14.5-35.5Q730 635 715.382 620.5q-14.617-14.5-35.5-14.5Q659 606 644.5 620.618q-14.5 14.617-14.5 35.5Q630 677 644.618 691.5q14.617 14.5 35.5 14.5ZM880 456h-85L695 356H265L165 456H80l142-142q8-8 19.278-13 11.278-5 23.722-5h430q12.444 0 23.722 5T738 314l142 142ZM140 856q-24.75 0-42.375-17.625T80 796V456h800v340q0 24.75-17.625 42.375T820 856H140Z"/></svg> <svg viewBox="0 96 960 960"><path d="M140 796h680V516H140v280Zm540.118-90Q701 706 715.5 691.382q14.5-14.617 14.5-35.5Q730 635 715.382 620.5q-14.617-14.5-35.5-14.5Q659 606 644.5 620.618q-14.5 14.617-14.5 35.5Q630 677 644.618 691.5q14.617 14.5 35.5 14.5ZM880 456h-85L695 356H265L165 456H80l142-142q8-8 19.278-13 11.278-5 23.722-5h430q12.444 0 23.722 5T738 314l142 142ZM140 856q-24.75 0-42.375-17.625T80 796V456h800v340q0 24.75-17.625 42.375T820 856H140Z"/></svg>
</button>` </button>`
: `` : ``
} }
<button data-index="0" name="provo" title="Export to Prov-o document" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small"> <!--button data-index="0" name="provo" title="Export to Prov-o document" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<svg viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M13 3H6v18h4v-6h3c3.31 0 6-2.69 6-6s-2.69-6-6-6zm.2 8H10V7h3.2c1.1 0 2 .9 2 2s-.9 2-2 2z"/></svg> <svg viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M13 3H6v18h4v-6h3c3.31 0 6-2.69 6-6s-2.69-6-6-6zm.2 8H10V7h3.2c1.1 0 2 .9 2 2s-.9 2-2 2z"/></svg>
</button> </button-->
<!-- button data-index="0" name="zip" title="Download as zip archive" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small"> <!-- button data-index="0" name="zip" title="Download as zip archive" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<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> <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-->
<button data-index="0" name="archivefolder" title="Archive outputs to workspace" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small"> <button data-index="0" name="archiveoutputs" title="Archive only outputs to workspace folder" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small">
<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> <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>
<button data-index="0" name="reexecute1" title="Re-submit this execution" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small"> <button data-index="0" name="reexecute1" title="Re-submit this execution" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small">
@ -426,19 +426,19 @@ class CCPExecutionHistory extends HTMLElement {
} }
toArchive(id){ toArchive(id){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/archive`, { method: "POST" }) this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/archive-to-folder`, { method: "POST" })
.then(reply =>{ .then(reply =>{
if (!reply.ok) { if (!reply.ok) {
throw "Unable to archive" throw "Unable to archive execution to folder"
} }
}).catch(err=>{ alert(err)}) }).catch(err=>{ alert(err)})
} }
toArchiveFolder(id){ toOutputsArchive(id){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/archive-to-folder`, { method: "POST" }) this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/outputs/archive-to-folder`, { method: "POST" })
.then(reply =>{ .then(reply =>{
if (!reply.ok) { if (!reply.ok) {
throw "Unable to archive" throw "Unable to archive outputs to folder"
} }
}).catch(err=>{ alert(err)}) }).catch(err=>{ alert(err)})
} }
@ -448,7 +448,7 @@ class CCPExecutionHistory extends HTMLElement {
this.#boot.secureFetch(`${this.#serviceurl}/executions/archive?url=${url}`) this.#boot.secureFetch(`${this.#serviceurl}/executions/archive?url=${url}`)
.then(reply =>{ .then(reply =>{
if (!reply.ok) { if (!reply.ok) {
throw "Unable to fetch from archive" throw "Unable to fetch from archive folder"
} }
return reply.text() return reply.text()
}).then(data=>{ }).then(data=>{
@ -555,17 +555,17 @@ class CCPExecutionHistory extends HTMLElement {
} }
} }
if(ev.target.getAttribute("name") === "archive"){ if(ev.target.getAttribute("name") === "archive"){
if(confirm(" Please confirm archiving of execution to workspace?")){ if(confirm(" Please confirm archiving of execution to workspace folder?")){
const id = ev.currentTarget.getAttribute("data-index")
this.toArchive(id)
}
}
if(ev.target.getAttribute("name") === "archivefolder"){
if(confirm(" Please confirm archiving of execution outputs to workspace?")){
const id = ev.currentTarget.getAttribute("data-index") const id = ev.currentTarget.getAttribute("data-index")
this.toArchiveFolder(id) this.toArchiveFolder(id)
} }
} }
if(ev.target.getAttribute("name") === "archiveoutputs"){
if(confirm(" Please confirm archiving of execution outputs to workspace folder?")){
const id = ev.currentTarget.getAttribute("data-index")
this.toOutputArchiveFolder(id)
}
}
}, },
recurse : [ recurse : [
{ {