diff --git a/src/components/dialogs/CancelJobDialog.vue b/src/components/dialogs/CancelJobDialog.vue new file mode 100644 index 000000000..db9edc6b9 --- /dev/null +++ b/src/components/dialogs/CancelJobDialog.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index ba405f501..d0a3833bb 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -110,6 +110,10 @@ + @@ -141,9 +145,11 @@ import { mdiDotsVertical, } from '@mdi/js' import { PrinterStateMacro } from '@/store/printer/types' +import CancelJobDialog from '@/components/dialogs/CancelJobDialog.vue' @Component({ components: { + CancelJobDialog, KlippyStatePanel, MinSettingsPanel, Panel, @@ -166,6 +172,7 @@ export default class StatusPanel extends Mixins(BaseMixin) { bigThumbnail: any } + showCancelJobDialog = false boolShowObjects = false boolShowPauseAtLayer = false @@ -392,6 +399,17 @@ export default class StatusPanel extends Mixins(BaseMixin) { } btnCancelJob() { + const confirmOnCancelJob = this.$store.state.gui.uiSettings.confirmOnCancelJob + if (confirmOnCancelJob) { + this.showCancelJobDialog = true + return + } + + this.cancelJob() + } + + cancelJob() { + this.showCancelJobDialog = false this.$socket.emit('printer.print.cancel', {}, { loading: 'statusPrintCancel' }) } diff --git a/src/components/settings/SettingsUiSettingsTab.vue b/src/components/settings/SettingsUiSettingsTab.vue index 0bc26e456..14bb0f33e 100644 --- a/src/components/settings/SettingsUiSettingsTab.vue +++ b/src/components/settings/SettingsUiSettingsTab.vue @@ -178,6 +178,13 @@ + + + + @@ -426,6 +433,14 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin, ThemeMixin) this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.confirmOnPowerDeviceChange', value: newVal }) } + get confirmOnCancelJob() { + return this.$store.state.gui.uiSettings.confirmOnCancelJob + } + + set confirmOnCancelJob(newVal) { + this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.confirmOnCancelJob', value: newVal }) + } + get lockSliders() { return this.$store.state.gui.uiSettings.lockSlidersOnTouchDevices } diff --git a/src/locales/de.json b/src/locales/de.json index 67220131d..bc4ac382c 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -144,6 +144,12 @@ "ScrewName": "Name der Schraube", "ScrewOutput": "{current} von {max}" }, + "CancelJobDialog": { + "AreYouSure": "Bist du sicher?", + "CancelJob": "Druck abbrechen", + "No": "Nein", + "Yes": "Ja" + }, "ConnectionDialog": { "CannotConnectTo": "Kann keine Verbindung zu Moonraker ({host}) herstellen.", "CheckMoonrakerLog": "Wenn diese Meldung wiederholt erscheint, schaue bitte in die Logdatei unter:", @@ -1196,6 +1202,8 @@ "BoolBigThumbnailDescription": "Zeige ein großes Thumbnail in der Status-Anzeige während eines Drucks.", "BoolHideUploadAndPrintButton": "\"Hochladen & Drucken\" Schaltfläche ausblenden", "BoolHideUploadAndPrintButtonDescription": "Blendet die \"Hochladen & Drucken\" Schaltfläche in der Kopfleiste ein oder aus.", + "ConfirmOnCancelJob": "Bestätigung für Druck abbrechen erforderlich", + "ConfirmOnCancelJobDescription": "Zeige vor dem Druck abbrechen einen Bestätigungsdialog.", "ConfirmOnCoolDown": "Bestätigung für Abkühlen erforderlich", "ConfirmOnCoolDownDescription": "Zeige vor dem Abkühlen einen Bestätigungsdialog.", "ConfirmOnEmergencyStop": "Bestätigung für Notstopp erforderlich", diff --git a/src/locales/en.json b/src/locales/en.json index 2f0c91bf3..002e964e7 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -144,6 +144,12 @@ "ScrewName": "Screw Name", "ScrewOutput": "{current} of {max}" }, + "CancelJobDialog": { + "AreYouSure": "Are you sure?", + "CancelJob": "Cancel Job", + "No": "No", + "Yes": "Yes" + }, "ConnectionDialog": { "CannotConnectTo": "Cannot connect to Moonraker ({host}).", "CheckMoonrakerLog": "If this message appears repeatedly, please have a look in the log file located at:", @@ -1197,6 +1203,8 @@ "BoolBigThumbnailDescription": "Display a large thumbnail in the status panel during a print.", "BoolHideUploadAndPrintButton": "Hide Upload and Print Button", "BoolHideUploadAndPrintButtonDescription": "Show or hide the \"Upload and Print\" button in the top bar.", + "ConfirmOnCancelJob": "Require confirm on Cancel Job", + "ConfirmOnCancelJobDescription": "Show a confirmation dialog on Cancel Job", "ConfirmOnCoolDown": "Require confirm on CoolDown", "ConfirmOnCoolDownDescription": "Show a confirmation dialog on CoolDown", "ConfirmOnEmergencyStop": "Require confirm on Emergency Stop", diff --git a/src/store/gui/index.ts b/src/store/gui/index.ts index 6f94a5344..b8aaa2903 100644 --- a/src/store/gui/index.ts +++ b/src/store/gui/index.ts @@ -166,6 +166,7 @@ export const getDefaultState = (): GuiState => { confirmOnEmergencyStop: false, confirmOnCoolDown: false, confirmOnPowerDeviceChange: false, + confirmOnCancelJob: false, boolBigThumbnail: true, bigThumbnailBackground: defaultBigThumbnailBackground, boolWideNavDrawer: false, diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index a1bef68e2..fb3589081 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -108,6 +108,7 @@ export interface GuiState { confirmOnEmergencyStop: boolean confirmOnCoolDown: boolean confirmOnPowerDeviceChange: boolean + confirmOnCancelJob: boolean boolBigThumbnail: boolean bigThumbnailBackground: string boolWideNavDrawer: boolean