From b64a99ab193873b5bb40b0786f3b1dadd7fd779a Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Mon, 13 Nov 2023 23:25:34 +0100 Subject: [PATCH] Add option to upload the configuration to the server --- .../source/src/views/ProjectSettings.vue | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/www/client/source/src/views/ProjectSettings.vue b/lib/www/client/source/src/views/ProjectSettings.vue index ff43dc6..a161447 100644 --- a/lib/www/client/source/src/views/ProjectSettings.vue +++ b/lib/www/client/source/src/views/ProjectSettings.vue @@ -139,6 +139,19 @@ + + + + + mdi-cloud-upload + Upload + @@ -577,8 +590,23 @@ export default { } }, - upload () { - console.log("UPLOAD"); + async upload () { + const url = `/project/${this.$route.params.project}/configuration`; + const init = { + method: "PUT", + headers: { + //"If-Match": "" // Ensure we're not overwriting someone else's changes + "Content-Type": "application/json" + }, + body: {...this.configuration, archived: true} + }; + const res = await this.api([url, init]); + if (res && res.id == this.configuration.id) { + // In case the server decided to apply any changes + this.showSnack(["Configuration uploaded to server", "success"]); + this.$nextTick( () => this.configuration = res ); + } + }, async loadFromFile () { if (!this.fileInputErrors.length) {