From 907096ac2d1381e6ddaa5e8eedf9c6384597b96d Mon Sep 17 00:00:00 2001 From: dcore94 Date: Thu, 9 Feb 2023 16:29:12 +0100 Subject: [PATCH] moved export/import of methods to list --- ccp/js/methodeditorcontroller.js | 43 --------- ccp/js/methodlistcontroller2.js | 157 +++++++++++++++++++++---------- 2 files changed, 106 insertions(+), 94 deletions(-) diff --git a/ccp/js/methodeditorcontroller.js b/ccp/js/methodeditorcontroller.js index c01cf7f..d589e7a 100644 --- a/ccp/js/methodeditorcontroller.js +++ b/ccp/js/methodeditorcontroller.js @@ -155,9 +155,6 @@ class CCPMethodEditorController extends HTMLElement{ ` - #download_icon = ` - - ` constructor(){ super(); @@ -295,31 +292,6 @@ class CCPMethodEditorController extends HTMLElement{ }) } - downloadMethod(){ - if(this.#locked) return; - this.lockRender() - this.#boot.secureFetch(this.#serviceurl + "/methods/" + this.#current.id + "/shareable").then( - (resp)=>{ - if(resp.status === 200){ - return resp.json() - }else throw "Error retrieving sharable process: " + resp.status - } - ).then(data=>{ - const filename = data.title + "-" + data.version + ".json" - const datastr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(data)); - var tmplnk = document.createElement("a") - tmplnk.download = filename - tmplnk.href = datastr - document.body.appendChild(tmplnk) - tmplnk.click() - document.body.removeChild(tmplnk) - this.unlockRender() - }).catch(err=>{ - alert(err) - this.unlockRender() - }) - } - editMethod(method){ if(this.#locked) return; this.lockRender() @@ -407,7 +379,6 @@ class CCPMethodEditorController extends HTMLElement{
${this.renderSaveButton()} ${this.renderResetButton()} - ${this.renderDownloadButton()} ${ this.#isupdate ? this.renderDeleteButton() : "" }
@@ -562,12 +533,6 @@ class CCPMethodEditorController extends HTMLElement{ this.saveMethod() }) - this.#rootdoc.querySelector("button[name=download]").addEventListener("click", ev=>{ - ev.preventDefault() - ev.stopPropagation() - this.downloadMethod() - }) - if(this.#isupdate){ this.#rootdoc.querySelector("button[name=delete]").addEventListener("click", ev=>{ ev.preventDefault() @@ -801,14 +766,6 @@ class CCPMethodEditorController extends HTMLElement{ ` } - renderDownloadButton(){ - return ` - - ` - } - renderDeleteButton(){ return `