From cc584c0c808c692b51078933a9991e21988d5b12 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 27 Aug 2024 21:10:16 +0200 Subject: [PATCH 01/12] chore(prettier): add support to sort locale json files (#1976) --- .prettierrc | 8 +++++++ package-lock.json | 21 +++++++++++++++---- package.json | 3 ++- .../panels/Status/ExcludeObjectDialogMap.vue | 4 ++-- src/locales/da.json | 1 - src/locales/es.json | 1 - src/locales/fr.json | 2 +- src/locales/it.json | 2 +- src/locales/pl.json | 2 +- src/locales/ru.json | 2 +- src/locales/se.json | 2 +- 11 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.prettierrc b/.prettierrc index 456bf2ce1..b0c885617 100644 --- a/.prettierrc +++ b/.prettierrc @@ -18,6 +18,14 @@ "options": { "tabWidth": 2 } + }, + { + "files": "src/locales/*.json", + "options": { + "plugins": ["prettier-plugin-sort-json"], + "jsonRecursiveSort": true, + "jsonSortOrder": "{ \"placeThisFirst\": null, \"/^[a-zA-Z0-9]/\": \"caseInsensitiveNumeric\" }" + } } ] } diff --git a/package-lock.json b/package-lock.json index 255490f1d..cc060d99e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,8 @@ "eslint-plugin-vue": "^9.0.0", "postcss": "^8.4.31", "postcss-nesting": "^12.0.1", - "prettier": "^3.0.0", + "prettier": "^3.3.3", + "prettier-plugin-sort-json": "^4.0.0", "sass": "~1.32", "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", @@ -8052,9 +8053,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -8066,6 +8067,18 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-sort-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-sort-json/-/prettier-plugin-sort-json-4.0.0.tgz", + "integrity": "sha512-zV5g+bWFD2zAqyQ8gCkwUTC49o9FxslaUdirwivt5GZHcf57hCocavykuyYqbExoEsuBOg8IU36OY7zmVEMOWA==", + "dev": true, + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/package.json b/package.json index 65de31342..c97fef7c1 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,8 @@ "eslint-plugin-vue": "^9.0.0", "postcss": "^8.4.31", "postcss-nesting": "^12.0.1", - "prettier": "^3.0.0", + "prettier": "^3.3.3", + "prettier-plugin-sort-json": "^4.0.0", "sass": "~1.32", "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", diff --git a/src/components/panels/Status/ExcludeObjectDialogMap.vue b/src/components/panels/Status/ExcludeObjectDialogMap.vue index 2a5a18dcb..b004817f4 100644 --- a/src/components/panels/Status/ExcludeObjectDialogMap.vue +++ b/src/components/panels/Status/ExcludeObjectDialogMap.vue @@ -62,8 +62,8 @@ hoverName === object.name ? primaryColor : excluded_objects.includes(object.name) - ? '#6668' - : '#bbb' + ? '#6668' + : '#bbb' " @mouseover="showObjectTooltip(object.name)" @mouseout="hideObjectTooltip" diff --git a/src/locales/da.json b/src/locales/da.json index 35e9a865d..6c8049e9d 100644 --- a/src/locales/da.json +++ b/src/locales/da.json @@ -990,7 +990,6 @@ "DbHistoryTotals": "Totalhistorik", "DbMaintenance": "Vedligeholdelse", "DbNavigation": "Navigation", - "DBNavigation": "Navigation", "DbTimelapseSettings": "Timelapse indstillinger", "DbView": "Vis indstillinger", "EstimateValues": { diff --git a/src/locales/es.json b/src/locales/es.json index 7261fdcd7..a71309968 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -1001,7 +1001,6 @@ "DbHistoryTotals": "Historial Totales", "DbMaintenance": "Mantenimiento", "DbNavigation": "Navegación", - "DBNavigation": "Navegación", "DbTimelapseSettings": "Ajustes de Timelapse", "DbView": "Ajustes de Vista", "DbWebcams": "Cámaras web", diff --git a/src/locales/fr.json b/src/locales/fr.json index 87901bd98..9ee45b299 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -931,7 +931,7 @@ "DbConsoleHistory": "Historique de la console", "DbHistoryJobs": "Historique des travaux", "DbHistoryTotals": "Historique Totaux", - "DBNavigation": "Navigation", + "DbNavigation": "Navigation", "DbTimelapseSettings": "Réglages Timelapse", "DbView": "Voir les paramètres", "EstimateValues": { diff --git a/src/locales/it.json b/src/locales/it.json index d4a2267fd..cf4572474 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -922,7 +922,7 @@ "DbConsoleHistory": "Cronologia Console", "DbHistoryJobs": "Cronologia Lavori", "DbHistoryTotals": "Cronologia Totali", - "DBNavigation": "Navigazione", + "DbNavigation": "Navigazione", "DbTimelapseSettings": "Impostazioni Timelapse", "DbView": "Vedi Impostazioni ", "EstimateValues": { diff --git a/src/locales/pl.json b/src/locales/pl.json index 7887bada8..844439810 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -906,7 +906,7 @@ "DbConsoleHistory": "Historia Konsoli", "DbHistoryJobs": "Historia wydruków", "DbHistoryTotals": "Łączna historia", - "DBNavigation": "Nawigacja", + "DbNavigation": "Nawigacja", "DbTimelapseSettings": "Ustawienia timelapse", "DbView": "Ustawienia", "EstimateValues": { diff --git a/src/locales/ru.json b/src/locales/ru.json index 95b7a368d..a5628c716 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -944,7 +944,7 @@ "DbConsoleHistory": "История консоли", "DbHistoryJobs": "История заданий", "DbHistoryTotals": "Всего заданий", - "DBNavigation": "Навигация", + "DbNavigation": "Навигация", "DbTimelapseSettings": "Настройки таймлапса", "DbView": "Настройки отображения", "EstimateValues": { diff --git a/src/locales/se.json b/src/locales/se.json index ec8607981..851b3200d 100644 --- a/src/locales/se.json +++ b/src/locales/se.json @@ -922,7 +922,7 @@ "DbConsoleHistory": "Konsolhistorik", "DbHistoryJobs": "Jobbhistorik", "DbHistoryTotals": "Historik totalt", - "DBNavigation": "Navigering", + "DbNavigation": "Navigering", "DbTimelapseSettings": "Timelapse inställningar", "DbView": "Visa inställningar", "EstimateValues": { From 03ca19a8b3991d59c625236373ff70aaa382cae1 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 27 Aug 2024 21:16:40 +0200 Subject: [PATCH 02/12] feat(console): add option for RAW-output (for debugging) (#1975) --- src/components/console/ConsoleTableEntry.vue | 12 +++++++++++- src/components/panels/MiniconsolePanel.vue | 15 +++++++++++++++ src/locales/en.json | 1 + src/pages/Console.vue | 15 +++++++++++++++ src/store/gui/console/index.ts | 1 + src/store/gui/console/types.ts | 1 + 6 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/components/console/ConsoleTableEntry.vue b/src/components/console/ConsoleTableEntry.vue index e00ff72c2..f8d14f631 100644 --- a/src/components/console/ConsoleTableEntry.vue +++ b/src/components/console/ConsoleTableEntry.vue @@ -1,7 +1,13 @@ @@ -38,6 +44,10 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) { return classes } + get rawOutput() { + return this.$store.state.gui.console.rawOutput ?? false + } + commandClick(event: Event) { const eventTarget = event.target as Element if (eventTarget.localName === 'a' && eventTarget.className.indexOf('command') !== -1) { diff --git a/src/components/panels/MiniconsolePanel.vue b/src/components/panels/MiniconsolePanel.vue index 1c5d0daf3..8a5168dc6 100644 --- a/src/components/panels/MiniconsolePanel.vue +++ b/src/components/panels/MiniconsolePanel.vue @@ -50,6 +50,13 @@ :label="filter.name" @change="toggleFilter(filter)" /> + + + @@ -204,6 +211,14 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) { this.$store.dispatch('gui/saveSetting', { name: 'console.autoscroll', value: newVal }) } + get rawOutput(): boolean { + return this.$store.state.gui.console.rawOutput ?? false + } + + set rawOutput(newVal) { + this.$store.dispatch('gui/saveSetting', { name: 'console.rawOutput', value: newVal }) + } + commandClick(msg: string): void { this.gcode = msg diff --git a/src/locales/en.json b/src/locales/en.json index 5c403574b..2f0c91bf3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -663,6 +663,7 @@ "Headline": "Console", "HideTemperatures": "Hide temperatures", "HideTimelapse": "Hide Timelapse", + "RawOutput": "RAW-Output (for debugging)", "SendCode": "Send code...", "SetupConsole": "Setup Console" }, diff --git a/src/pages/Console.vue b/src/pages/Console.vue index a37067bcb..39a5da20b 100644 --- a/src/pages/Console.vue +++ b/src/pages/Console.vue @@ -71,6 +71,13 @@ :label="filter.name" @change="toggleFilter(filter)" /> + + + @@ -193,6 +200,14 @@ export default class PageConsole extends Mixins(BaseMixin) { this.$store.dispatch('gui/saveSetting', { name: 'console.autoscroll', value: newVal }) } + get rawOutput(): boolean { + return this.$store.state.gui.console.rawOutput ?? false + } + + set rawOutput(newVal) { + this.$store.dispatch('gui/saveSetting', { name: 'console.rawOutput', value: newVal }) + } + commandClick(msg: string): void { this.gcode = msg diff --git a/src/store/gui/console/index.ts b/src/store/gui/console/index.ts index b152a5c7e..d8e6e31c8 100644 --- a/src/store/gui/console/index.ts +++ b/src/store/gui/console/index.ts @@ -13,6 +13,7 @@ export const getDefaultState = (): GuiConsoleState => { height: 300, autoscroll: true, consolefilters: {}, + rawOutput: false, } } diff --git a/src/store/gui/console/types.ts b/src/store/gui/console/types.ts index 35e63cda8..6e487f9f3 100644 --- a/src/store/gui/console/types.ts +++ b/src/store/gui/console/types.ts @@ -9,6 +9,7 @@ export interface GuiConsoleState { consolefilters: { [key: string]: GuiConsoleStateFilter } + rawOutput: boolean } export interface GuiConsoleStateFilter { From cab5ea62b7c1a97d2673f8c110d073eb1844e5e6 Mon Sep 17 00:00:00 2001 From: Patrick Gehrsitz Date: Tue, 27 Aug 2024 21:18:01 +0200 Subject: [PATCH 03/12] fix(ExtruderPanel): restore mode after extruding/retracting (#1965) Co-authored-by: Stefan Dej --- .../panels/Extruder/ExtruderControlPanelControl.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/panels/Extruder/ExtruderControlPanelControl.vue b/src/components/panels/Extruder/ExtruderControlPanelControl.vue index fdb7a10a8..25d1d053b 100644 --- a/src/components/panels/Extruder/ExtruderControlPanelControl.vue +++ b/src/components/panels/Extruder/ExtruderControlPanelControl.vue @@ -263,13 +263,21 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi } sendRetract(): void { - const gcode = `M83\nG1 E-${this.feedamount} F${this.feedrate * 60}` + const gcode = + `SAVE_GCODE_STATE NAME=ui_retract\n` + + `M83\n` + + `G1 E-${this.feedamount} F${this.feedrate * 60}\n` + + `RESTORE_GCODE_STATE NAME=ui_retract` this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnRetract' }) } sendExtrude(): void { - const gcode = `M83\nG1 E${this.feedamount} F${this.feedrate * 60}` + const gcode = + `SAVE_GCODE_STATE NAME=ui_extrude\n` + + `M83\n` + + `G1 E${this.feedamount} F${this.feedrate * 60}\n` + + `RESTORE_GCODE_STATE NAME=ui_extrude` this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) this.$socket.emit('printer.gcode.script', { script: gcode }, { loading: 'btnDetract' }) } From 21dab3913c4ad5833a88d46ee8a8e1f0fa897ff4 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 27 Aug 2024 21:42:58 +0200 Subject: [PATCH 04/12] refactor(timelapse): refactor the timelapse status panel (#1982) --- .../TimelapseRenderingsettingsDialog.vue | 134 ++++++ src/components/mixins/timelapse.ts | 78 ++++ .../panels/Timelapse/TimelapseStatusPanel.vue | 398 +++++------------- 3 files changed, 314 insertions(+), 296 deletions(-) create mode 100644 src/components/dialogs/TimelapseRenderingsettingsDialog.vue create mode 100644 src/components/mixins/timelapse.ts diff --git a/src/components/dialogs/TimelapseRenderingsettingsDialog.vue b/src/components/dialogs/TimelapseRenderingsettingsDialog.vue new file mode 100644 index 000000000..035b84561 --- /dev/null +++ b/src/components/dialogs/TimelapseRenderingsettingsDialog.vue @@ -0,0 +1,134 @@ + + diff --git a/src/components/mixins/timelapse.ts b/src/components/mixins/timelapse.ts new file mode 100644 index 000000000..c1ad6be45 --- /dev/null +++ b/src/components/mixins/timelapse.ts @@ -0,0 +1,78 @@ +import Component from 'vue-class-component' +import Vue from 'vue' + +@Component +export default class TimelapseMixin extends Vue { + get variable_fps() { + return this.$store.state.server.timelapse?.settings?.variable_fps ?? false + } + + set variable_fps(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { variable_fps: newVal }) + } + + get variable_fps_min() { + return this.$store.state.server.timelapse?.settings?.variable_fps_min ?? 5 + } + + set variable_fps_min(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_min: newVal }) + } + + get variable_fps_max() { + return this.$store.state.server.timelapse?.settings?.variable_fps_max ?? 60 + } + + set variable_fps_max(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { variable_fps_max: newVal }) + } + + get targetlength() { + return this.$store.state.server.timelapse?.settings?.targetlength ?? 10 + } + + set targetlength(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { targetlength: newVal }) + } + + get output_framerate() { + return this.$store.state.server.timelapse?.settings?.output_framerate ?? 30 + } + + set output_framerate(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { output_framerate: newVal }) + } + + get duplicatelastframe() { + return this.$store.state.server.timelapse?.settings?.duplicatelastframe ?? 0 + } + + set duplicatelastframe(newVal) { + this.$store.dispatch('server/timelapse/saveSetting', { duplicatelastframe: newVal }) + } + + get framesCount() { + return this.$store.state.server.timelapse?.lastFrame?.count ?? 0 + } + + get estimatedVideoLength() { + let seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.output_framerate) + + if (this.variable_fps) { + seconds = Math.round((this.framesCount + this.duplicatelastframe) / this.variableTargetFps) + if (seconds < this.targetlength) seconds = this.targetlength + } + + return seconds > 60 + ? Math.floor(seconds / 60) + 'm ' + (seconds - Math.floor(seconds / 60) * 60) + 's' + : seconds + 's' + } + + get variableTargetFps() { + let targetFps = Math.floor(this.framesCount / this.targetlength) + targetFps = Math.max(targetFps, this.variable_fps_min) + targetFps = Math.min(targetFps, this.variable_fps_max) + + return targetFps + } +} diff --git a/src/components/panels/Timelapse/TimelapseStatusPanel.vue b/src/components/panels/Timelapse/TimelapseStatusPanel.vue index 2129fc85c..29a3ca7d3 100644 --- a/src/components/panels/Timelapse/TimelapseStatusPanel.vue +++ b/src/components/panels/Timelapse/TimelapseStatusPanel.vue @@ -1,223 +1,100 @@ - - From f6f3c77d9756d4db90f0a8de1b7a9b4b21dd3c34 Mon Sep 17 00:00:00 2001 From: FatalBulletHit <37146617+FatalBulletHit@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:12:37 +0200 Subject: [PATCH 06/12] feat: added second layer confirmation for Cancel Job (#1978) Co-authored-by: Stefan Dej --- src/components/dialogs/CancelJobDialog.vue | 50 +++++++++++++++++++ src/components/panels/StatusPanel.vue | 18 +++++++ .../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, 101 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..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 From 695832a6d013e1988b63e9f7cc649a84dfe8c51c Mon Sep 17 00:00:00 2001 From: CF3B5 Date: Sun, 8 Sep 2024 06:23:19 +0800 Subject: [PATCH 07/12] feat: adds a file structure sidebar in the editor (#1943) Co-authored-by: Stefan Dej --- src/components/TheEditor.vue | 141 +++++++++++++++++++++++++-- src/components/inputs/Codemirror.vue | 26 +++-- src/locales/en.json | 1 + src/locales/zh.json | 1 + src/store/files/types.ts | 10 ++ 5 files changed, 164 insertions(+), 15 deletions(-) diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index e740c7db8..215ed1ccd 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -31,6 +31,10 @@ {{ mdiHelp }} {{ $t('Editor.ConfigReference') }} + + {{ mdiFormatListCheckbox }} + {{ $t('Editor.FileStructure') }} + {{ mdiCloseThick }} - + + :file-extension="fileExtension" + class="codemirror" + @lineChange="lineChanges" /> +
+ + + + +
- +
{{ snackbarHeadline }}
@@ -123,7 +160,7 @@ diff --git a/src/locales/en.json b/src/locales/en.json index 002e964e7..b12da347f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -203,6 +203,7 @@ "Downloading": "Downloading", "FailedSave": "{filename} could not be uploaded!", "FileReadOnly": "read-only", + "FileStructure": "File Structure", "SaveClose": "Save & close", "SaveRestart": "Save & Restart", "SuccessfullySaved": "{filename} successfully saved.", diff --git a/src/locales/zh.json b/src/locales/zh.json index 884c60b6d..9b522bb45 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -197,6 +197,7 @@ "Downloading": "正在下载", "FailedSave": "上传{filename}失败!", "FileReadOnly": "只读文件", + "FileStructure": "结构", "SaveClose": "保存并关闭", "SaveRestart": "保存并重启", "SuccessfullySaved": "{filename}保存成功!", diff --git a/src/store/files/types.ts b/src/store/files/types.ts index 55197c159..e862daf16 100644 --- a/src/store/files/types.ts +++ b/src/store/files/types.ts @@ -97,3 +97,13 @@ export interface ApiGetDirectoryReturnFile { filename: string permissions: string } + +export interface ConfigFileKey { + name: string + type: string + line: number +} + +export interface ConfigFileSection extends ConfigFileKey { + children: ConfigFileKey[] +} From c2226dcc03009b42eeadc6a782b9b4551a8a8ab3 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 8 Sep 2024 00:28:16 +0200 Subject: [PATCH 08/12] feat: add output on connection dialog for unauthorized (#1996) --- src/components/TheConnectingDialog.vue | 39 +++++++++++--------------- src/locales/en.json | 1 + src/plugins/webSocketClient.ts | 5 ++++ src/store/socket/actions.ts | 4 +++ src/store/socket/index.ts | 1 + src/store/socket/mutations.ts | 4 ++- src/store/socket/types.ts | 1 + 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/components/TheConnectingDialog.vue b/src/components/TheConnectingDialog.vue index d32bdd7c9..68bff8c66 100644 --- a/src/components/TheConnectingDialog.vue +++ b/src/components/TheConnectingDialog.vue @@ -1,35 +1,30 @@ - - @@ -52,10 +47,6 @@ export default class TheConnectingDialog extends Mixins(BaseMixin, ThemeMixin) { counter = 0 - get protocol() { - return this.$store.state.socket.protocol - } - get hostname() { return this.$store.state.socket.hostname } @@ -94,6 +85,10 @@ export default class TheConnectingDialog extends Mixins(BaseMixin, ThemeMixin) { return this.formatHostname } + get connectionFailedMessage() { + return this.$store.state.socket.connectionFailedMessage ?? null + } + reconnect() { this.counter++ this.$store.dispatch('socket/setData', { connectingFailed: false }) diff --git a/src/locales/en.json b/src/locales/en.json index b12da347f..9cafae33c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -154,6 +154,7 @@ "CannotConnectTo": "Cannot connect to Moonraker ({host}).", "CheckMoonrakerLog": "If this message appears repeatedly, please have a look in the log file located at:", "Connecting": "Connecting to {host}", + "ErrorMessage": "Error message: {message}", "Failed": "Connection failed", "Initializing": "Initializing", "TryAgain": "try again" diff --git a/src/plugins/webSocketClient.ts b/src/plugins/webSocketClient.ts index 1208bb7cb..6e4820240 100644 --- a/src/plugins/webSocketClient.ts +++ b/src/plugins/webSocketClient.ts @@ -36,6 +36,11 @@ export class WebSocketClient { window.console.error(`Response Error: ${data.error.message} (${wait?.action ?? 'no action'})`) } + if (data.error.message === 'Unauthorized' && wait?.action === 'server/setConnectionId') { + this.close() + this.store?.dispatch('socket/setConnectionFailed', data.error.message) + } + if (wait?.id) { const modulename = wait.action?.split('/')[1] ?? null diff --git a/src/store/socket/actions.ts b/src/store/socket/actions.ts index 0a207d48b..24263cd2d 100644 --- a/src/store/socket/actions.ts +++ b/src/store/socket/actions.ts @@ -173,4 +173,8 @@ export const actions: ActionTree = { reportDebug(_, payload) { window.console.log(payload) }, + + setConnectionFailed({ commit }, payload) { + commit('setDisconnected', payload) + }, } diff --git a/src/store/socket/index.ts b/src/store/socket/index.ts index c50c7bc7a..f9f1a8681 100644 --- a/src/store/socket/index.ts +++ b/src/store/socket/index.ts @@ -20,6 +20,7 @@ export const getDefaultState = (): SocketState => { isConnected: false, isConnecting: false, connectingFailed: false, + connectionFailedMessage: null, loadings: [], initializationList: ['server'], connection_id: null, diff --git a/src/store/socket/mutations.ts b/src/store/socket/mutations.ts index 9399eb169..96ed25d60 100644 --- a/src/store/socket/mutations.ts +++ b/src/store/socket/mutations.ts @@ -16,11 +16,13 @@ export const mutations: MutationTree = { Vue.set(state, 'connectingFailed', false) }, - setDisconnected(state) { + setDisconnected(state, message?: string) { Vue.set(state, 'isConnected', false) Vue.set(state, 'isConnecting', false) Vue.set(state, 'connectingFailed', true) Vue.set(state, 'connection_id', null) + + if (message) Vue.set(state, 'connectionFailedMessage', message) }, setData(state, payload) { diff --git a/src/store/socket/types.ts b/src/store/socket/types.ts index c2675e784..9c8d0c1ee 100644 --- a/src/store/socket/types.ts +++ b/src/store/socket/types.ts @@ -7,6 +7,7 @@ export interface SocketState { isConnected: boolean isConnecting: boolean connectingFailed: boolean + connectionFailedMessage: string | null loadings: string[] initializationList: string[] connection_id: number | null From d4357c88e721af09349311c3d89a02d4261eba47 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 8 Sep 2024 00:28:29 +0200 Subject: [PATCH 09/12] refactor(webcam): refactor Mjpegstreamer-Adaptive Webcam mode (#1994) --- .../streamers/MjpegstreamerAdaptive.vue | 271 ++++++++++-------- src/locales/en.json | 2 + 2 files changed, 148 insertions(+), 125 deletions(-) diff --git a/src/components/webcams/streamers/MjpegstreamerAdaptive.vue b/src/components/webcams/streamers/MjpegstreamerAdaptive.vue index 39f04cc30..cac1ee5f8 100644 --- a/src/components/webcams/streamers/MjpegstreamerAdaptive.vue +++ b/src/components/webcams/streamers/MjpegstreamerAdaptive.vue @@ -1,55 +1,58 @@ diff --git a/src/locales/en.json b/src/locales/en.json index c45e91e90..e13f50b3a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -822,6 +822,7 @@ "WebcamPanel": { "All": "All", "ConnectingTo": "Connecting to {url}", + "Disconnected": "Disconnected", "ErrorWhileConnecting": "Error while connecting to {url}", "FPS": "FPS", "Headline": "Webcam", From 6fd64df01211927dca6f55721f1e5ad75ac95c25 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 8 Sep 2024 00:43:12 +0200 Subject: [PATCH 12/12] refactor: refactor machine settings panel (#1991)