This commit is contained in:
dcore94 2023-06-23 11:56:43 +02:00
commit fe97c162cc
4 changed files with 27 additions and 8 deletions

View File

@ -24,7 +24,8 @@ class CCPExecutionForm extends HTMLElement{
}
attributeChangedCallback(name, oldValue, newValue) {
if((oldValue != newValue) && (name === "method")){
//if((oldValue != newValue) && (name === "method")){
if(name === "method"){
this.#method = newValue
this.loadMethod()
}

View File

@ -77,9 +77,6 @@ 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; max-width: 40%; min-width:60px; flex-wrap:wrap;">
<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>
${ this.#archive ? `
<button data-index="0" name="archive" title="Archive to workspace" 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>
@ -89,6 +86,12 @@ 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">
<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 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>
</button>
<button data-index="0" name="reexecute1" title="Re-submit this execution" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small">
Re-submit
</button>
@ -390,6 +393,15 @@ class CCPExecutionHistory extends HTMLElement {
}
}).catch(err=>{ alert(err)})
}
toArchiveFolder(id){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/archive-to-folder`, { method: "POST" })
.then(reply =>{
if (!reply.ok) {
throw "Unable to archive"
}
}).catch(err=>{ alert(err)})
}
fromArchive(url){
if(url){
@ -503,11 +515,17 @@ class CCPExecutionHistory extends HTMLElement {
}
}
if(ev.target.getAttribute("name") === "archive"){
if(confirm(" Please confirm aarchiving of execution to workspace?")){
if(confirm(" Please confirm archiving of execution to workspace?")){
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")
this.toArchiveFolder(id)
}
}
},
recurse : [
{

View File

@ -169,13 +169,13 @@ class FileInputRenderer extends Renderer{
const ename = tgt.getAttribute("name")
if(ename === this.name){
const file = ev.target.files[0]
if(file.type !== this.schema.contentMediaType){
/*if(file.type !== this.schema.contentMediaType){
alert("Unsupported media type. Must be " + this.schema.contentMediaType)
ev.stopPropagation()
ev.preventDefault()
tgt.value = null
return false
}
}*/
if(file.size > 100*1024){
alert("This input allows only small files (100K). Use references instead ")
ev.stopPropagation()

View File

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