✨ feat: setting for hiding confirmation
add setting to hide confirmation before reloading klipper
This commit is contained in:
parent
b8f3e1f069
commit
bf7ebbd261
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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 = "<h4>" + gettext("All ongoing Prints will be stopped!") + "</h4>";
|
||||
var html = "<h4>" +
|
||||
gettext("All ongoing Prints will be stopped!") +
|
||||
"</h4>";
|
||||
|
||||
showConfirmationDialog({
|
||||
title: gettext("Klipper restart?"),
|
||||
html: html,
|
||||
proceed: gettext("Proceed"),
|
||||
onproceed: request,
|
||||
});
|
||||
if (self.settings.settings.plugins.klipper.configuration.confirm_reload() == true) {
|
||||
showConfirmationDialog({
|
||||
title: gettext("Reload Klipper?"),
|
||||
html: html,
|
||||
proceed: [gettext("Reload"), gettext("Reload and don't show again.")],
|
||||
onproceed: function (idx) {
|
||||
if (idx > -1) {
|
||||
request(idx);
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
request(0);
|
||||
}
|
||||
};
|
||||
|
||||
// OctoKlipper settings link
|
||||
|
|
|
@ -78,7 +78,10 @@
|
|||
{{ _('The command that is executed if you want to restart klipper.') }}
|
||||
</span>
|
||||
<label class="checkbox" title="{{ _('Reload klipper on editor save?') }}"><input type="checkbox"
|
||||
data-bind="checked: settings.settings.plugins.klipper.configuration.restart_onsave" /> {{ _('Reload klipper on editor save?') }}
|
||||
data-bind="checked: settings.settings.plugins.klipper.configuration.restart_onsave" /> {{ _('Reload Klipper on editor save?') }}
|
||||
</label>
|
||||
<label class="checkbox" title="{{ _('Show Confirmation before reloading Klipper?') }}"><input type="checkbox"
|
||||
data-bind="checked: settings.settings.plugins.klipper.configuration.confirm_reload" /> {{ _('Confirmation before reloading Klipper?') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue