diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 87e3a719..1f294917 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -216,15 +216,25 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, )) ) + updated_octoprint_check_config = False + if "octoprint_checkout_folder" in data: self._settings.set(["checks", "octoprint", "checkout_folder"], data["octoprint_checkout_folder"], defaults=defaults, force=True) if update_folder and data["octoprint_checkout_folder"]: self._settings.set(["checks", "octoprint", "update_folder"], None, defaults=defaults, force=True) - self._refresh_configured_checks = True + updated_octoprint_check_config = True if "octoprint_type" in data and data["octoprint_type"] in ("github_release", "git_commit"): self._settings.set(["checks", "octoprint", "type"], data["octoprint_type"], defaults=defaults, force=True) + updated_octoprint_check_config = True + + if updated_octoprint_check_config: self._refresh_configured_checks = True + try: + del self._version_cache["octoprint"] + except KeyError: + pass + self._version_cache_dirty = True def get_settings_version(self): return 4 @@ -406,7 +416,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, dict(type="settings", name=gettext("Software Update")) ] - ##~~ + ##~~ WizardPlugin API def is_wizard_required(self): checks = self._get_configured_checks() diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index 7e434e8e..9188a25a 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -11,8 +11,23 @@ var checkUrl = url + "check"; var updateUrl = url + "update"; + exports.checkEntries = function(entries, force, opts) { + entries = entries || []; + if (typeof entries == "string") { + entries = [entries]; + } + + var data = { + force: !!force + }; + if (entries && entries.length) { + data["check"] = entries.join(",") + } + return OctoPrint.getWithQuery(checkUrl, data, opts); + }; + exports.check = function(force, opts) { - return OctoPrint.get(checkUrl + ((!!force) ? "?force=true" : ""), opts); + return exports.checkEntries([], force, opts); }; exports.update = function(entries, force, opts) { @@ -432,6 +447,11 @@ $(function() { return true; }; + self.onAfterWizardFinish = function() { + // we might have changed our config, so we need to refresh our check data from the server + self.performCheck(); + }; + self.onStartup = function() { self.workingDialog = $("#settings_plugin_softwareupdate_workingdialog"); self.workingOutput = $("#settings_plugin_softwareupdate_workingdialog_output"); diff --git a/src/octoprint/static/js/app/client/base.js b/src/octoprint/static/js/app/client/base.js index f50eef3f..6afa1359 100644 --- a/src/octoprint/static/js/app/client/base.js +++ b/src/octoprint/static/js/app/client/base.js @@ -84,6 +84,10 @@ return OctoPrint.ajax("GET", url, opts); }; + OctoPrint.getWithQuery = function(url, data, opts) { + return OctoPrint.ajaxWithData("GET", url, data, opts); + }; + OctoPrint.post = function(url, data, opts) { return OctoPrint.ajaxWithData("POST", url, data, noCache(opts)); }; diff --git a/src/octoprint/static/js/app/viewmodels/wizard.js b/src/octoprint/static/js/app/viewmodels/wizard.js index de9db3d0..86e0e904 100644 --- a/src/octoprint/static/js/app/viewmodels/wizard.js +++ b/src/octoprint/static/js/app/viewmodels/wizard.js @@ -32,6 +32,8 @@ $(function() { 'margin-left': function() { return -($(this).width() /2); } }); } + + callViewModels(self.allViewModels, "onWizardShow"); }); }; @@ -96,7 +98,8 @@ $(function() { if (current != undefined && next != undefined) { var result = true; callViewModels(allViewModels, "onWizardTabChange", function(method) { - result = result && (method(current, next) !== false); + // we want to continue evaluating even if result becomes false + result = (method(current, next) !== false) && result; }); return result; } @@ -130,6 +133,7 @@ $(function() { if (reload) { self.reloadOverlay.show(); } + callViewModels(allViewModels, "onAfterWizardFinish"); }); } }