From aeaa016bde574b407fcb8fbd567e94d1479a5768 Mon Sep 17 00:00:00 2001 From: fatalbullethit Date: Fri, 16 Aug 2024 21:16:36 +0200 Subject: [PATCH 1/7] Added second layer confirmation for Cancel Job --- src/components/dialogs/CancelJobDialog.vue | 50 +++++++++++++++++++ src/components/panels/StatusPanel.vue | 12 +++++ .../settings/SettingsUiSettingsTab.vue | 15 ++++++ src/locales/de.json | 8 +++ src/locales/en.json | 8 +++ src/store/gui/index.ts | 1 + src/store/gui/types.ts | 1 + 7 files changed, 95 insertions(+) create mode 100644 src/components/dialogs/CancelJobDialog.vue diff --git a/src/components/dialogs/CancelJobDialog.vue b/src/components/dialogs/CancelJobDialog.vue new file mode 100644 index 000000000..3e2d493e8 --- /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..49e4b0904 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -110,6 +110,7 @@ + @@ -392,6 +393,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 6932890bb..2ce795304 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:", @@ -1202,6 +1208,8 @@ "ConfirmOnEmergencyStopDescription": "Zeige vor einem Notstop einen Bestätigungsdialog.", "ConfirmOnPowerDeviceChange": "Bestätigung für Änderung der Stromversorgung von Geräten", "ConfirmOnPowerDeviceChangeDescription": "Zeige vor Änderung der Stromversorgung von Geräten einen Bestätigungsdialog.", + "ConfirmOnCancelJob": "Bestätigung für Druck abbrechen erforderlich", + "ConfirmOnCancelJobDescription": "Zeige vor dem Druck abbrechen einen Bestätigungsdialog.", "DefaultNavigationState": "Standard Navigationszustand", "DefaultNavigationStateAlwaysClosed": "immer geschlossen", "DefaultNavigationStateAlwaysOpen": "immer geöffnet", diff --git a/src/locales/en.json b/src/locales/en.json index 5c403574b..e7785129d 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:", @@ -1202,6 +1208,8 @@ "ConfirmOnEmergencyStopDescription": "Show a confirmation dialog on Emergency Stop", "ConfirmOnPowerDeviceChange": "Require confirm on Device Power changes", "ConfirmOnPowerDeviceChangeDescription": "Show a confirmation dialog on Device Power changes", + "ConfirmOnCancelJob": "Require confirm on Cancel Job", + "ConfirmOnCancelJobDescription": "Show a confirmation dialog on Cancel Job", "DefaultNavigationState": "Navigation default state", "DefaultNavigationStateAlwaysClosed": "always closed", "DefaultNavigationStateAlwaysOpen": "always open", 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 From f4ef1e5babc0384012e5a366cef881144556b580 Mon Sep 17 00:00:00 2001 From: FatalBulletHit <37146617+FatalBulletHit@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:32:48 +0200 Subject: [PATCH 2/7] Fixed object keys to be in insensitive ascending order. --- src/locales/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index e7785129d..b6c137a17 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1202,14 +1202,14 @@ "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", "ConfirmOnEmergencyStopDescription": "Show a confirmation dialog on Emergency Stop", "ConfirmOnPowerDeviceChange": "Require confirm on Device Power changes", "ConfirmOnPowerDeviceChangeDescription": "Show a confirmation dialog on Device Power changes", - "ConfirmOnCancelJob": "Require confirm on Cancel Job", - "ConfirmOnCancelJobDescription": "Show a confirmation dialog on Cancel Job", "DefaultNavigationState": "Navigation default state", "DefaultNavigationStateAlwaysClosed": "always closed", "DefaultNavigationStateAlwaysOpen": "always open", From 2f3c9fd68534e985c887eb3bd7047978302c44b6 Mon Sep 17 00:00:00 2001 From: FatalBulletHit <37146617+FatalBulletHit@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:32:50 +0200 Subject: [PATCH 3/7] Fixed object keys to be in insensitive ascending order. --- src/locales/de.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/de.json b/src/locales/de.json index 2ce795304..700977e8a 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -1202,14 +1202,14 @@ "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", "ConfirmOnEmergencyStopDescription": "Zeige vor einem Notstop einen Bestätigungsdialog.", "ConfirmOnPowerDeviceChange": "Bestätigung für Änderung der Stromversorgung von Geräten", "ConfirmOnPowerDeviceChangeDescription": "Zeige vor Änderung der Stromversorgung von Geräten einen Bestätigungsdialog.", - "ConfirmOnCancelJob": "Bestätigung für Druck abbrechen erforderlich", - "ConfirmOnCancelJobDescription": "Zeige vor dem Druck abbrechen einen Bestätigungsdialog.", "DefaultNavigationState": "Standard Navigationszustand", "DefaultNavigationStateAlwaysClosed": "immer geschlossen", "DefaultNavigationStateAlwaysOpen": "immer geöffnet", From 59355fd600a19a9606f38003c444beae12d66695 Mon Sep 17 00:00:00 2001 From: fatalbullethit Date: Sun, 18 Aug 2024 13:20:02 +0200 Subject: [PATCH 4/7] hanged toolbar-color from red to normal --- src/components/dialogs/CancelJobDialog.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dialogs/CancelJobDialog.vue b/src/components/dialogs/CancelJobDialog.vue index 3e2d493e8..d64d918d9 100644 --- a/src/components/dialogs/CancelJobDialog.vue +++ b/src/components/dialogs/CancelJobDialog.vue @@ -2,7 +2,7 @@ From 8326ee05cdaef0ee001c4611b0bef6a2f6881fe6 Mon Sep 17 00:00:00 2001 From: fatalbullethit Date: Sun, 18 Aug 2024 13:40:49 +0200 Subject: [PATCH 5/7] fixed missing declaration --- src/components/dialogs/CancelJobDialog.vue | 4 +++- src/components/panels/StatusPanel.vue | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/dialogs/CancelJobDialog.vue b/src/components/dialogs/CancelJobDialog.vue index d64d918d9..402f04771 100644 --- a/src/components/dialogs/CancelJobDialog.vue +++ b/src/components/dialogs/CancelJobDialog.vue @@ -37,8 +37,10 @@ export default class CancelJobDialog extends Mixins(BaseMixin) { @Prop({ type: Boolean, default: false }) showDialog!: boolean - cancelJob(): void { + cancelJob() { this.$socket.emit('printer.print.cancel', {}, { loading: 'statusPrintCancel' }) + + this.closePrompt() } closePrompt() { diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 49e4b0904..2265b61c7 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -167,6 +167,7 @@ export default class StatusPanel extends Mixins(BaseMixin) { bigThumbnail: any } + showCancelJobDialog = false boolShowObjects = false boolShowPauseAtLayer = false From 4c7e9d03da00a83dc3562fafe7082e59f130b721 Mon Sep 17 00:00:00 2001 From: fatalbullethit Date: Sun, 18 Aug 2024 20:11:57 +0200 Subject: [PATCH 6/7] changed icon --- src/components/dialogs/CancelJobDialog.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/dialogs/CancelJobDialog.vue b/src/components/dialogs/CancelJobDialog.vue index 402f04771..2c7a1d771 100644 --- a/src/components/dialogs/CancelJobDialog.vue +++ b/src/components/dialogs/CancelJobDialog.vue @@ -4,7 +4,7 @@ :title="$t('CancelJobDialog.CancelJob')" toolbar-color="normal" card-class="cancel-job-dialog" - :icon="mdiStop" + :icon="mdiStopCircleOutline" :margin-bottom="false"> @@ -142,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,