First-Time Wizard: reload the webpage after a succesful save

After saving the configuration, show a message & restart the webapp.

The restarting is done after 2 seconds, to give the Manager some time to
restart after receiving the new config.
This commit is contained in:
Sybren A. Stüvel 2022-07-14 18:01:57 +02:00
parent 38b8220476
commit 73f98f93a0

View File

@ -87,6 +87,8 @@
"<code>{{ selectedBlender.path }}</code>" "<code>{{ selectedBlender.path }}</code>"
</dd> </dd>
</dl> </dl>
<p v-if="isConfirmed" class="check-ok">Configuration has been saved, Flamenco will restart.</p>
<button @click="confirmWizard" :disabled="isConfirming">Confirm</button> <button @click="confirmWizard" :disabled="isConfirming">Confirm</button>
</section> </section>
</div> </div>
@ -130,6 +132,7 @@ export default {
input_path: "You pointed Flamenco to this executable.", input_path: "You pointed Flamenco to this executable.",
}, },
isConfirming: false, isConfirming: false,
isConfirmed: false,
}), }),
computed: { computed: {
cleanSharedStoragePath() { cleanSharedStoragePath() {
@ -233,14 +236,17 @@ export default {
); );
console.log("saving configuration:", wizardConfig); console.log("saving configuration:", wizardConfig);
this.isConfirming = true; this.isConfirming = true;
this.isConfirmed = false;
this.metaAPI.saveWizardConfig({ wizardConfig: wizardConfig }) this.metaAPI.saveWizardConfig({ wizardConfig: wizardConfig })
.then((result) => { .then((result) => {
console.log("Wizard config saved, reload the page"); console.log("Wizard config saved, reload the page");
this.isConfirmed = true;
// Give the Manager some time to restart.
window.setTimeout(() => { window.location.reload() }, 2000);
}) })
.catch((error) => { .catch((error) => {
console.log("Error saving wizard config:", error); console.log("Error saving wizard config:", error);
}) // Only clear this flag on an error.
.finally(() => {
this.isConfirming = false; this.isConfirming = false;
}) })
}, },