From ee618f6d8699b5cbc00b5ca441014964f169ee28 Mon Sep 17 00:00:00 2001 From: ori agranat Date: Sat, 9 Nov 2019 21:26:02 +0200 Subject: [PATCH] added ui save message on settings save --- chameleon-client/src/App.vue | 11 ++++++++++- chameleon-client/src/store.js | 9 ++++++--- chameleon-client/src/views/SettingsViewes/Cameras.vue | 9 ++++++++- chameleon-client/src/views/SettingsViewes/General.vue | 6 ++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/chameleon-client/src/App.vue b/chameleon-client/src/App.vue index 07c7953cb..fb105fc0a 100644 --- a/chameleon-client/src/App.vue +++ b/chameleon-client/src/App.vue @@ -61,7 +61,6 @@ } }, data: () => ({ - saveSnackbar: false, timer: undefined }), created() { @@ -78,6 +77,16 @@ console.error('error: ' + data.data + " , " + error); } } + }, + computed: { + saveSnackbar: { + get() { + return this.$store.state.saveBar; + }, + set(value) { + this.$store.commit("saveBar", value); + } + } } }; diff --git a/chameleon-client/src/store.js b/chameleon-client/src/store.js index b0c9fbd2d..1a7a45987 100644 --- a/chameleon-client/src/store.js +++ b/chameleon-client/src/store.js @@ -48,7 +48,8 @@ export default new Vuex.Store({ currentPipelineIndex: 0, cameraList: [], pipelineList: [], - point: {} + point: {}, + saveBar: false }, mutations: { settings: set('settings'), @@ -66,7 +67,8 @@ export default new Vuex.Store({ Vue.set(state.pipeline, i, obj[i]); } }, - driverMode: set('driverMode') + driverMode: set('driverMode'), + saveBar: set("saveBar") }, actions: { settings: state => state.settings, @@ -79,6 +81,7 @@ export default new Vuex.Store({ cameraList: state => state.cameraList, pipelineList: state => state.pipelineList, point: state => state.point, - driverMode: state => state.driverMode + driverMode: state => state.driverMode, + saveBar: state => state.saveBar } }) diff --git a/chameleon-client/src/views/SettingsViewes/Cameras.vue b/chameleon-client/src/views/SettingsViewes/Cameras.vue index 8440de656..f824660e3 100644 --- a/chameleon-client/src/views/SettingsViewes/Cameras.vue +++ b/chameleon-client/src/views/SettingsViewes/Cameras.vue @@ -24,7 +24,14 @@ }, methods: { sendCameraSettings() { - this.handleInput('cameraSettings', this.cameraSettings); + const self = this; + this.axios.post("http://" + this.$address + "/api/settings/camera", this.cameraSettings).then( + function (response) { + if (response.status === 200){ + self.$store.state.saveBar = true; + } + } + ) }, }, diff --git a/chameleon-client/src/views/SettingsViewes/General.vue b/chameleon-client/src/views/SettingsViewes/General.vue index e862f302a..fe655c19e 100644 --- a/chameleon-client/src/views/SettingsViewes/General.vue +++ b/chameleon-client/src/views/SettingsViewes/General.vue @@ -29,10 +29,12 @@ }, methods: { sendGeneralSettings() { - // this.handleInput('generalSettings', this.settings); + const self = this; this.axios.post("http://" + this.$address + "/api/settings/general", this.settings).then( function (response) { - console.log(response); + if (response.status === 200){ + self.$store.state.saveBar = true; + } } ) }