✨ 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",
|
logpath="/tmp/klippy.log",
|
||||||
reload_command="RESTART",
|
reload_command="RESTART",
|
||||||
restart_onsave=False,
|
restart_onsave=False,
|
||||||
|
confirm_reload=True,
|
||||||
shortStatus_navbar=True,
|
shortStatus_navbar=True,
|
||||||
shortStatus_sidebar=True,
|
shortStatus_sidebar=True,
|
||||||
parse_check=False,
|
parse_check=False,
|
||||||
|
@ -597,7 +598,7 @@ class KlipperPlugin(
|
||||||
# Restart klippy to reload config
|
# Restart klippy to reload config
|
||||||
self._printer.commands(reload_command)
|
self._printer.commands(reload_command)
|
||||||
logger.log_info(self, "Restarting Klipper.")
|
logger.log_info(self, "Restarting Klipper.")
|
||||||
return NO_CONTENT
|
return flask.jsonify(command = reload_command)
|
||||||
# APIs end
|
# APIs end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -254,20 +254,43 @@ $(function () {
|
||||||
self.requestRestart = function () {
|
self.requestRestart = function () {
|
||||||
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_KLIPPER_CONFIG)) return;
|
if (!self.loginState.hasPermission(self.access.permissions.PLUGIN_KLIPPER_CONFIG)) return;
|
||||||
|
|
||||||
var request = function () {
|
var request = function (index) {
|
||||||
OctoPrint.plugins.klipper.restartKlipper().done(function () {
|
OctoPrint.plugins.klipper.restartKlipper().done(function (response) {
|
||||||
self.consoleMessage("debug", "requestRestart");
|
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>";
|
||||||
|
|
||||||
|
if (self.settings.settings.plugins.klipper.configuration.confirm_reload() == true) {
|
||||||
showConfirmationDialog({
|
showConfirmationDialog({
|
||||||
title: gettext("Klipper restart?"),
|
title: gettext("Reload Klipper?"),
|
||||||
html: html,
|
html: html,
|
||||||
proceed: gettext("Proceed"),
|
proceed: [gettext("Reload"), gettext("Reload and don't show again.")],
|
||||||
onproceed: request,
|
onproceed: function (idx) {
|
||||||
|
if (idx > -1) {
|
||||||
|
request(idx);
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
request(0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// OctoKlipper settings link
|
// OctoKlipper settings link
|
||||||
|
|
|
@ -78,7 +78,10 @@
|
||||||
{{ _('The command that is executed if you want to restart klipper.') }}
|
{{ _('The command that is executed if you want to restart klipper.') }}
|
||||||
</span>
|
</span>
|
||||||
<label class="checkbox" title="{{ _('Reload klipper on editor save?') }}"><input type="checkbox"
|
<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>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue