diff --git a/octoprint_klipper/__init__.py b/octoprint_klipper/__init__.py index 7790957..a7ef0da 100644 --- a/octoprint_klipper/__init__.py +++ b/octoprint_klipper/__init__.py @@ -136,6 +136,7 @@ class KlipperPlugin( logpath="/tmp/klippy.log", reload_command="RESTART", restart_onsave=False, + confirm_reload=True, shortStatus_navbar=True, shortStatus_sidebar=True, parse_check=False, @@ -597,7 +598,7 @@ class KlipperPlugin( # Restart klippy to reload config self._printer.commands(reload_command) logger.log_info(self, "Restarting Klipper.") - return NO_CONTENT + return flask.jsonify(command = reload_command) # APIs end diff --git a/octoprint_klipper/static/js/klipper.js b/octoprint_klipper/static/js/klipper.js index cb8dc43..a129ad9 100644 --- a/octoprint_klipper/static/js/klipper.js +++ b/octoprint_klipper/static/js/klipper.js @@ -254,20 +254,43 @@ $(function () { self.requestRestart = function () { if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_KLIPPER_CONFIG)) return; - var request = function () { - OctoPrint.plugins.klipper.restartKlipper().done(function () { - self.consoleMessage("debug", "requestRestart"); + var request = function (index) { + OctoPrint.plugins.klipper.restartKlipper().done(function (response) { + self.consoleMessage("debug", "restartingKlipper"); + self.showPopUp("success", gettext("Reloaded Klipper"), "command: " + response.command); }); + if (index == 1) { + self.settings + .saveData({ + plugins: { + klipper: { + configuration: { + confirm_reload: false + } + } + } + }); + } }; - var html = "