From 6097222b7bd01e78147e776af916c3a6282df197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 4 Mar 2019 17:29:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20Remove=20onWizardPreventSettingsRef?= =?UTF-8?q?reshDialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes the whole wizard stuff less complex. --- .../corewizard/static/js/corewizard.js | 8 ------ .../plugins/tracking/static/js/usage.js | 4 --- .../static/js/app/viewmodels/wizard.js | 25 +------------------ 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/octoprint/plugins/corewizard/static/js/corewizard.js b/src/octoprint/plugins/corewizard/static/js/corewizard.js index 1c8f41b7d..5f3dfa7d0 100644 --- a/src/octoprint/plugins/corewizard/static/js/corewizard.js +++ b/src/octoprint/plugins/corewizard/static/js/corewizard.js @@ -170,10 +170,6 @@ $(function() { return false; }; - self.onWizardPreventSettingsRefreshDialog = function() { - return self.active; - }; - self.onWizardDetails = function(response) { self.required = response && response.corewizard && response.corewizard.details && response.corewizard.details.onlinecheck && response.corewizard.details.onlinecheck.required; }; @@ -252,10 +248,6 @@ $(function() { return false; }; - self.onWizardPreventSettingsRefreshDialog = function() { - return self.active; - }; - self.onWizardDetails = function(response) { self.required = response && response.corewizard && response.corewizard.details && response.corewizard.details.pluginblacklist && response.corewizard.details.pluginblacklist.required; }; diff --git a/src/octoprint/plugins/tracking/static/js/usage.js b/src/octoprint/plugins/tracking/static/js/usage.js index 1a8517313..b8867d1a8 100644 --- a/src/octoprint/plugins/tracking/static/js/usage.js +++ b/src/octoprint/plugins/tracking/static/js/usage.js @@ -44,10 +44,6 @@ $(function() { return false; }; - self.onWizardPreventSettingsRefreshDialog = function() { - return self.active(); - }; - self.onWizardDetails = function(response) { self.required = response && response.tracking && response.tracking.required; }; diff --git a/src/octoprint/static/js/app/viewmodels/wizard.js b/src/octoprint/static/js/app/viewmodels/wizard.js index 45226d65a..1dbecc2aa 100644 --- a/src/octoprint/static/js/app/viewmodels/wizard.js +++ b/src/octoprint/static/js/app/viewmodels/wizard.js @@ -193,30 +193,7 @@ $(function() { }; self.onSettingsPreventRefresh = function() { - if (!self.finishing && self.isDialogActive() - && hasDataChanged(self.settingsViewModel.getLocalData(), self.settingsViewModel.lastReceivedSettings)) { - var preventSettingsRefreshDialog = false; - callViewModels(self.allViewModels, "onWizardPreventSettingsRefreshDialog", function(method) { - // if any of our methods returns that it wants to prevent the dialog - // we'll need to set preventSettingsRefreshDialog to true - // - // order is important here - the method call needs to happen - // first, or it won't happen after the flag has been - // set once due to the || making further evaluation unnecessary - // then - preventSettingsRefreshDialog = (method() === true) || preventSettingsRefreshDialog; - }); - - // we have local changes, show update dialog - if (preventSettingsRefreshDialog) { - return false; - } else { - self.settingsViewModel.settingsUpdatedDialog.modal("show"); - return true; - } - } - - return false; + return self.isDialogActive(); } }