added button to archive only outputs

This commit is contained in:
dcore94 2023-06-09 17:54:41 +02:00
parent 135c27e3de
commit 91d909b482
2 changed files with 20 additions and 2 deletions

View File

@ -86,7 +86,10 @@ class CCPExecutionHistory extends HTMLElement {
<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>
</button-->
<button data-index="0" name="archivefolder" title="Archive outputs to workspace" 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">
@ -391,6 +394,15 @@ class CCPExecutionHistory extends HTMLElement {
}).catch(err=>{ alert(err)}) }).catch(err=>{ alert(err)})
} }
toArchiveFolder(id){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/archive-folder`, { method: "POST" })
.then(reply =>{
if (!reply.ok) {
throw "Unable to archive"
}
}).catch(err=>{ alert(err)})
}
fromArchive(url){ fromArchive(url){
if(url){ if(url){
this.#boot.secureFetch(`${this.#serviceurl}/executions/archive?url=${url}`) this.#boot.secureFetch(`${this.#serviceurl}/executions/archive?url=${url}`)
@ -508,6 +520,12 @@ class CCPExecutionHistory extends HTMLElement {
this.toArchive(id) 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")
this.toArchiveFolder(id)
}
}
}, },
recurse : [ recurse : [
{ {

View File

@ -201,7 +201,7 @@ class CCPMethodEditorController extends HTMLElement{
} }
this.#boot.secureFetch(url, args).then( this.#boot.secureFetch(url, args).then(
(resp)=>{ (resp)=>{
if(resp.status === 201 || resp.status === 204){ if(resp.ok){
return resp.text() return resp.text()
}else throw "Error saving process: " + resp.status }else throw "Error saving process: " + resp.status
}).then(data=>{ }).then(data=>{