From 649ca74b96d7ef4e7139527a3ff81ef35fda89ec Mon Sep 17 00:00:00 2001 From: Nath Date: Tue, 7 Jan 2025 16:36:04 +0000 Subject: [PATCH] fix: prevent user from navigating away from setup plugins page while installing --- dt-core/admin/components/setup-wizard-plugins.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dt-core/admin/components/setup-wizard-plugins.js b/dt-core/admin/components/setup-wizard-plugins.js index abd5f286a..d503d4a06 100644 --- a/dt-core/admin/components/setup-wizard-plugins.js +++ b/dt-core/admin/components/setup-wizard-plugins.js @@ -37,15 +37,16 @@ export class SetupWizardPlugins extends OpenLitElement { } back() { - this.dispatchEvent(new CustomEvent('back')); + if (this.canNavigate()) { + this.dispatchEvent(new CustomEvent('back')); + } } skip() { this.dispatchEvent(new CustomEvent('next')); } async next() { const plugins_to_install = this.getPluginsToInstall(); - console.log(this.finished, plugins_to_install); - if (this.finished || plugins_to_install.length === 0) { + if (this.canNavigate()) { this.dispatchEvent(new CustomEvent('next')); return; } @@ -86,12 +87,14 @@ export class SetupWizardPlugins extends OpenLitElement { this.requestUpdate(); } nextLabel() { - const plugins_to_install = this.getPluginsToInstall(); - if (this.finished || plugins_to_install.length === 0) { + if (this.canNavigate()) { return 'Next'; } return 'Confirm'; } + canNavigate() { + return this.finished || this.getPluginsToInstall().length === 0; + } setToastMessage(message) { this.toastMessage = message; }