From a7bb0f9423956a39ea5493d8b688cebb3f3c0ed3 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 23 Feb 2021 15:56:15 +0000 Subject: [PATCH] Reset tour button and URL origin Reset tour button resets the local storage used to mark the tour as done. Overriding the origin can now be done with a query string. This will load the store with the new origin from the start, so might be better for testing some things. I'm not worried about unexpected bugs, as it is quite obvious from the URL what's going on. --- .../aboutComponents/devTools.vue | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/openflexure_microscope/api/static/src/components/tabContentComponents/aboutComponents/devTools.vue b/openflexure_microscope/api/static/src/components/tabContentComponents/aboutComponents/devTools.vue index fecf56de..08f47e9b 100644 --- a/openflexure_microscope/api/static/src/components/tabContentComponents/aboutComponents/devTools.vue +++ b/openflexure_microscope/api/static/src/components/tabContentComponents/aboutComponents/devTools.vue @@ -1,12 +1,26 @@ @@ -19,7 +33,8 @@ export default { data: function() { return { - newOrigin: this.$store.state.origin + newOrigin: this.$store.state.origin, + reloadWhenOverridingOrigin: true }; }, @@ -32,9 +47,21 @@ export default { }, methods: { - overrideAPIHost: function() { - this.$store.commit("changeOrigin", this.newOrigin); + overrideAPIHost: function(event) { + // Save the origin override, so that if we reload the web app, you can easily localStorage.overrideOrigin = this.newOrigin; + + // If we have elected not to reload the interface, just update the origin + // in the store. Otherwise, the form's default action will do the job for us. + // TODO: preserve other query parameters when reloading + if(!this.reloadWhenOverridingOrigin){ + this.$store.commit("changeOrigin", this.newOrigin); + event.preventDefault(); + } + }, + resetTour: function() { + // Make the introduction tour run next time the app loads + this.setLocalStorageObj("completedTour", false); } } };