diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2023-11-18 06:18:23 -0500 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2023-11-18 06:18:23 -0500 |
| commit | c560de266caad6db97e58757ca43e8558c103c01 (patch) | |
| tree | 852deb7079d616042a255c906a9196b135ca0bba /dashboard_website/static/js/controls.js | |
| parent | 939f7a093dadfa89ac1bbe43b0c9fded404c1ad5 (diff) | |
csv import, manual visiting
Diffstat (limited to 'dashboard_website/static/js/controls.js')
| -rw-r--r-- | dashboard_website/static/js/controls.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/dashboard_website/static/js/controls.js b/dashboard_website/static/js/controls.js new file mode 100644 index 0000000..3d81032 --- /dev/null +++ b/dashboard_website/static/js/controls.js @@ -0,0 +1,42 @@ +// uses functions in utils.js +var host = window.location.protocol + "//" + window.location.host; + +function downloadCurrent(){ + call("downloadSave"); +} + +// load and append dirty file +function loadDirty(){ + call("loadDirty", "dirty"); +} + +// load save file (clean) +function loadSave(){ + call("loadSave", "clean"); +} + +function call(command, formid=""){ + var formData; + if (formid == "") { + formData = new FormData(); + }else { + formData = new FormData(document.getElementById(formid)); + } + + formData.append("command", command); + console.log(formData); + + fetch(host+'/controls', { + method: "POST", + body: formData + }).then( res => res.blob() ) + .then( blob => { + var file = window.URL.createObjectURL(blob); + window.location.assign(file);}); + //.then((response) => response.json()) + //.then((json) => handleCallResponse(json)); +} + +function handleLatestInfo(json){ + if(json['status'] != "OK")alert("Error."); +}
\ No newline at end of file |
