fixed retrieval of id and generation of filename

This commit is contained in:
dcore94 2023-02-09 12:46:14 +01:00
parent c41adbb15d
commit fe30758a93
1 changed files with 4 additions and 4 deletions

View File

@ -295,17 +295,17 @@ class CCPMethodEditorController extends HTMLElement{
}) })
} }
downloadMethod(method){ downloadMethod(){
if(this.#locked) return; if(this.#locked) return;
this.lockRender() this.lockRender()
var filename = this.#current.title + "-" + this.#current.version + ".json" this.#boot.secureFetch(this.#serviceurl + "/methods/" + this.#current.id + "/shareable").then(
this.#boot.secureFetch(this.#serviceurl + "/methods/" + method + "/shareable").then(
(resp)=>{ (resp)=>{
if(resp.status === 200){ if(resp.status === 200){
return resp.json() return resp.json()
}else throw "Error retrieving sharable process: " + resp.status }else throw "Error retrieving sharable process: " + resp.status
} }
).then(data=>{ ).then(data=>{
const filename = data.title + "-" + data.version + ".json"
const objectURL = URL.createObjectURL(data) const objectURL = URL.createObjectURL(data)
var tmplnk = document.createElement("a") var tmplnk = document.createElement("a")
tmplnk.download = filename tmplnk.download = filename
@ -803,7 +803,7 @@ class CCPMethodEditorController extends HTMLElement{
renderDownloadButton(){ renderDownloadButton(){
return ` return `
<button title="Save" name="download" class="btn btn-primary ccp-toolbar-button"> <button title="Export" name="download" class="btn btn-primary ccp-toolbar-button">
${this.#download_icon} ${this.#download_icon}
</button> </button>
` `