Merge pull request #2466 from ntoff/improve/disconnectWarning
Add a confirmation if disconnecting while printing
This commit is contained in:
1 file changed
+18
-2
@@ -125,8 +125,24 @@ $(function() {
|
||||
self.settings.printerProfiles.requestData();
|
||||
});
|
||||
} else {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
if (!self.isPrinting() && !self.isPaused()) {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
} else {
|
||||
showConfirmationDialog({
|
||||
title: gettext("Are you sure?"),
|
||||
message: gettext("<p><strong>You are about to disconnect from the printer while a print is in progress.</strong></p> \
|
||||
<p>Disconnecting while a print is in progress will prevent OctoPrint from completing the print. If you're printing from an SD card attached directly to the printer, any attempt to restart OctoPrint or reconnect to the printer could interrupt the print.<p>"),
|
||||
question: gettext("Are you sure you want to disconnect from the printer?"),
|
||||
cancel: gettext("Stay Connected"),
|
||||
proceed: gettext("Disconnect"),
|
||||
onproceed: function() {
|
||||
self.requestData();
|
||||
OctoPrint.connection.disconnect();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user