diff --git a/src/App.vue b/src/App.vue index 5b424894..56e9a44f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -114,11 +114,11 @@ export default class App extends Mixins(BaseMixin) { } get logoColor(): string { - return this.$store.state.gui.theme.logo + return this.$store.state.gui.uiSettings.logo } get primaryColor(): string { - return this.$store.state.gui.theme.primary + return this.$store.state.gui.uiSettings.primary } get warningColor(): string { diff --git a/src/components/TheSidebar.vue b/src/components/TheSidebar.vue index f19592c5..fbd7f075 100644 --- a/src/components/TheSidebar.vue +++ b/src/components/TheSidebar.vue @@ -103,7 +103,7 @@ export default class TheSidebarAlt extends Mixins(BaseMixin) { } get navigationStyle() { - return this.$store.state.gui.dashboard.navigationStyle + return this.$store.state.gui.uiSettings.navigationStyle } get sidebarBackground(): string { @@ -119,7 +119,7 @@ export default class TheSidebarAlt extends Mixins(BaseMixin) { } get boolNaviWebcam(): boolean { - return this.$store.state.gui.webcamSettings.boolNavi + return this.$store.state.gui.uiSettings.boolWebcamNavi } get moonrakerComponents(): string[] { diff --git a/src/components/TheTopCornerMenu.vue b/src/components/TheTopCornerMenu.vue index be6b7211..040bb9b8 100644 --- a/src/components/TheTopCornerMenu.vue +++ b/src/components/TheTopCornerMenu.vue @@ -167,7 +167,7 @@ export default class TheTopCornerMenu extends Mixins(BaseMixin) { this.dialogPowerDeviceChange.device = device.device this.dialogPowerDeviceChange.value = value - const confirmOnPowerDeviceChange = this.$store.state.gui.general.confirmOnPowerDeviceChange + const confirmOnPowerDeviceChange = this.$store.state.gui.uiSettings.confirmOnPowerDeviceChange if (confirmOnPowerDeviceChange) { this.dialogPowerDeviceChange.show = true } diff --git a/src/components/TheTopbar.vue b/src/components/TheTopbar.vue index 96d25b92..e49d1820 100644 --- a/src/components/TheTopbar.vue +++ b/src/components/TheTopbar.vue @@ -198,7 +198,7 @@ export default class TheTopbar extends Mixins(BaseMixin) { } get boolWideNavDrawer() { - return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false + return this.$store.state.gui.uiSettings.boolWideNavDrawer ?? false } get countPrinters() { @@ -214,11 +214,11 @@ export default class TheTopbar extends Mixins(BaseMixin) { } get logoColor(): string { - return this.$store.state.gui.theme.logo + return this.$store.state.gui.uiSettings.logo } btnEmergencyStop() { - const confirmOnEmergencyStop = this.$store.state.gui.general.confirmOnEmergencyStop + const confirmOnEmergencyStop = this.$store.state.gui.uiSettings.confirmOnEmergencyStop if (confirmOnEmergencyStop) { this.showEmergencyStopDialog = true } diff --git a/src/components/charts/TempChart.vue b/src/components/charts/TempChart.vue index beae0480..9464a3c3 100644 --- a/src/components/charts/TempChart.vue +++ b/src/components/charts/TempChart.vue @@ -210,7 +210,7 @@ export default class TempChart extends Mixins(BaseMixin) { } get autoscale() { - return this.$store.state.gui.tempchart.autoscale ?? true + return this.$store.state.gui.view.tempchart.autoscale ?? true } get maxTemp() { diff --git a/src/components/inputs/MacroButton.vue b/src/components/inputs/MacroButton.vue index 770aa63f..d8b4e1a8 100644 --- a/src/components/inputs/MacroButton.vue +++ b/src/components/inputs/MacroButton.vue @@ -68,7 +68,7 @@ import Component from 'vue-class-component' import {Mixins, Prop, Watch} from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' -import {GuiMacrogroupsStateMacrogroupMacro} from '@/store/gui/macrogroups/types' +import {GuiMacrosStateMacrogroupMacro} from '@/store/gui/macros/types' interface param { type: 'int' | 'double' | 'string' | null, @@ -85,7 +85,7 @@ export default class MacroButton extends Mixins(BaseMixin) { private paramArray: string[] = [] private params: params = {} - @Prop({ required: true }) readonly macro!: GuiMacrogroupsStateMacrogroupMacro + @Prop({ required: true }) readonly macro!: GuiMacrosStateMacrogroupMacro @Prop({ default: 'primary' }) readonly color!: string get klipperMacro() { diff --git a/src/components/inputs/MiscellaneousSlider.vue b/src/components/inputs/MiscellaneousSlider.vue index 94de529e..7730b2ea 100644 --- a/src/components/inputs/MiscellaneousSlider.vue +++ b/src/components/inputs/MiscellaneousSlider.vue @@ -106,11 +106,11 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) { } get lockSliders() { - return this.$store.state.gui.general.lockSlidersOnTouchDevices + return this.$store.state.gui.uiSettings.lockSlidersOnTouchDevices } get lockSlidersDelay() { - return this.$store.state.gui.general.lockSlidersDelay + return this.$store.state.gui.uiSettings.lockSlidersDelay } @Debounce(500) diff --git a/src/components/inputs/ToolSlider.vue b/src/components/inputs/ToolSlider.vue index 3e247cbe..7ab98c55 100644 --- a/src/components/inputs/ToolSlider.vue +++ b/src/components/inputs/ToolSlider.vue @@ -119,11 +119,11 @@ export default class ToolSlider extends Mixins(BaseMixin) { } get lockSliders() { - return this.$store.state.gui.general.lockSlidersOnTouchDevices + return this.$store.state.gui.uiSettings.lockSlidersOnTouchDevices } get lockSlidersDelay() { - return this.$store.state.gui.general.lockSlidersDelay + return this.$store.state.gui.uiSettings.lockSlidersDelay } get colorBar() { diff --git a/src/components/mixins/control.ts b/src/components/mixins/control.ts index ec73550e..743c0bbc 100644 --- a/src/components/mixins/control.ts +++ b/src/components/mixins/control.ts @@ -13,11 +13,11 @@ export default class ControlMixin extends Vue { } get feedrateXY() { - return this.$store.state.gui.dashboard?.control?.feedrateXY ?? 100 + return this.$store.state.gui.control?.feedrateXY ?? 100 } get feedrateZ() { - return this.$store.state.gui.dashboard?.control?.feedrateZ ?? 10 + return this.$store.state.gui.control?.feedrateZ ?? 10 } get existsQGL() { diff --git a/src/components/mixins/dashboard.ts b/src/components/mixins/dashboard.ts index 0f780442..e5468bfa 100644 --- a/src/components/mixins/dashboard.ts +++ b/src/components/mixins/dashboard.ts @@ -2,17 +2,17 @@ import Component from 'vue-class-component' import BaseMixin from '@/components/mixins/base' import {allDashboardPanels} from '@/store/variables' import {capitalize} from '@/plugins/helpers' -import {GuiMacrogroupsStateMacrogroup} from '@/store/gui/macrogroups/types' +import {GuiMacrosStateMacrogroup} from '@/store/gui/macros/types' @Component export default class DashboardMixin extends BaseMixin { get macroMode() { - return this.$store.state.gui.dashboard.macroManagement ?? 'simple' + return this.$store.state.gui.macros.mode ?? 'simple' } get macrogroups() { - return this.$store.getters['gui/macrogroups/getAllMacrogroups'] ?? [] + return this.$store.getters['gui/macros/getAllMacrogroups'] ?? [] } get missingPanelsMobile() { @@ -56,7 +56,7 @@ export default class DashboardMixin extends BaseMixin { const missingPanels: any[] = [] if (this.macroMode === 'expert') { - this.macrogroups.forEach((group: GuiMacrogroupsStateMacrogroup) => { + this.macrogroups.forEach((group: GuiMacrosStateMacrogroup) => { allPanels.push('macrogroup_'+group.id) }) @@ -67,7 +67,7 @@ export default class DashboardMixin extends BaseMixin { if (!panels.find((panel) => panel.name === panelname)) missingPanels.push({ name: panelname, - visable: true + visible: true }) }) @@ -77,7 +77,7 @@ export default class DashboardMixin extends BaseMixin { getPanelName(name: string) { if (name.startsWith('macrogroup_')) { const groupId = name.split('_')[1] ?? '' - const group = this.macrogroups.find((group: GuiMacrogroupsStateMacrogroup) => group.id === groupId) + const group = this.macrogroups.find((group: GuiMacrosStateMacrogroup) => group.id === groupId) return (group) ? group.name : 'Macrogroup' } diff --git a/src/components/panels/ControlPanel.vue b/src/components/panels/ControlPanel.vue index 49395529..ec894243 100644 --- a/src/components/panels/ControlPanel.vue +++ b/src/components/panels/ControlPanel.vue @@ -52,7 +52,7 @@ import Panel from '@/components/ui/Panel.vue' }) export default class ControlPanel extends Mixins(BaseMixin) { get controlStyle() { - return this.$store.state.gui.dashboard.control.style ?? 'bars' + return this.$store.state.gui.control.style ?? 'bars' } get existsExtruder() { diff --git a/src/components/panels/ControlPanelBarsControl.vue b/src/components/panels/ControlPanelBarsControl.vue index cb366937..3051ddd2 100644 --- a/src/components/panels/ControlPanelBarsControl.vue +++ b/src/components/panels/ControlPanelBarsControl.vue @@ -55,19 +55,19 @@ import ControlMixin from '@/components/mixins/control' @Component export default class ControlPanelBarsControl extends Mixins(BaseMixin, ControlMixin) { get stepsXYsorted() { - return [...this.$store.state.gui.dashboard.control.stepsXY].sort(function(a, b) { return b-a }) + return [...this.$store.state.gui.control.stepsXY].sort(function(a, b) { return b-a }) } get stepsXYsortedReverse() { - return [...this.$store.state.gui.dashboard.control.stepsXY].sort(function(a, b) { return a-b }) + return [...this.$store.state.gui.control.stepsXY].sort(function(a, b) { return a-b }) } get stepsZsorted() { - return [...this.$store.state.gui.dashboard.control.stepsZ].sort(function(a, b) { return b-a }) + return [...this.$store.state.gui.control.stepsZ].sort(function(a, b) { return b-a }) } get stepsZsortedReverse() { - return [...this.$store.state.gui.dashboard.control.stepsZ].sort(function(a, b) { return a-b }) + return [...this.$store.state.gui.control.stepsZ].sort(function(a, b) { return a-b }) } } diff --git a/src/components/panels/ControlPanelCircleControl.vue b/src/components/panels/ControlPanelCircleControl.vue index 262a2f7c..5ce62843 100644 --- a/src/components/panels/ControlPanelCircleControl.vue +++ b/src/components/panels/ControlPanelCircleControl.vue @@ -344,19 +344,19 @@ import ControlMixin from '@/components/mixins/control' @Component export default class ControlPanelCrossControl extends Mixins(BaseMixin, ControlMixin) { get reverseX() { - return this.$store.state.gui.dashboard.control.reverseX + return this.$store.state.gui.control.reverseX } get reverseY() { - return this.$store.state.gui.dashboard.control.reverseY + return this.$store.state.gui.control.reverseY } get reverseZ() { - return this.$store.state.gui.dashboard.control.reverseZ + return this.$store.state.gui.control.reverseZ } get stepsXY() { - const steps = this.$store.state.gui.dashboard?.control?.stepsCircleXY ?? [] + const steps = this.$store.state.gui.control?.stepsCircleXY ?? [] return Array.from(new Set([ ...(steps ?? []), @@ -364,7 +364,7 @@ export default class ControlPanelCrossControl extends Mixins(BaseMixin, ControlM } get stepsZ() { - const steps = this.$store.state.gui.dashboard?.control?.stepsCircleZ ?? [] + const steps = this.$store.state.gui.control?.stepsCircleZ ?? [] return Array.from(new Set([ ...(steps ?? []), diff --git a/src/components/panels/ControlPanelCrossControl.vue b/src/components/panels/ControlPanelCrossControl.vue index f5d61fe3..1192b8ed 100644 --- a/src/components/panels/ControlPanelCrossControl.vue +++ b/src/components/panels/ControlPanelCrossControl.vue @@ -177,27 +177,27 @@ export default class ControlPanelCrossControl extends Mixins(BaseMixin, ControlM private homeCols = 6 get selectedCrossStep() { - return this.$store.state.gui.dashboard.control.selectedCrossStep + return this.$store.state.gui.control.selectedCrossStep } set selectedCrossStep(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.selectedCrossStep', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.selectedCrossStep', value: newVal }) } get reverseX() { - return this.$store.state.gui.dashboard.control.reverseX + return this.$store.state.gui.control.reverseX } get reverseY() { - return this.$store.state.gui.dashboard.control.reverseY + return this.$store.state.gui.control.reverseY } get reverseZ() { - return this.$store.state.gui.dashboard.control.reverseZ + return this.$store.state.gui.control.reverseZ } get stepsAll() { - return this.$store.state.gui.dashboard?.control?.stepsAll ?? [] + return this.$store.state.gui.control?.stepsAll ?? [] } get stepsReversed() { diff --git a/src/components/panels/ControlPanelExtruder.vue b/src/components/panels/ControlPanelExtruder.vue index f8e81737..2e861b1b 100644 --- a/src/components/panels/ControlPanelExtruder.vue +++ b/src/components/panels/ControlPanelExtruder.vue @@ -85,11 +85,11 @@ export default class ControlPanelExtruder extends Mixins(BaseMixin) { } get feedamounts() { - return this.$store.state.gui.dashboard?.extruder?.feedamounts ?? [] + return this.$store.state.gui.control.extruder?.feedamounts ?? [] } get feedrates() { - return this.$store.state.gui.dashboard?.extruder?.feedrates ?? [] + return this.$store.state.gui.control.extruder?.feedrates ?? [] } get feedamountsSorted() { @@ -101,19 +101,19 @@ export default class ControlPanelExtruder extends Mixins(BaseMixin) { } get currentFeedAmount() { - return parseFloat(this.$store.state.gui.dashboard.extruder.feedamount) + return parseFloat(this.$store.state.gui.control.extruder.feedamount) } set currentFeedAmount(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.extruder.feedamount', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedamount', value: newVal }) } get currentFeedRate() { - return parseFloat(this.$store.state.gui.dashboard.extruder.feedrate) + return parseFloat(this.$store.state.gui.control.extruder.feedrate) } set currentFeedRate(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.extruder.feedrate', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedrate', value: newVal }) } get boolExtrudePossible() { diff --git a/src/components/panels/GcodefilesPanel.vue b/src/components/panels/GcodefilesPanel.vue index 62a913e4..f0e6fd4a 100644 --- a/src/components/panels/GcodefilesPanel.vue +++ b/src/components/panels/GcodefilesPanel.vue @@ -628,55 +628,55 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) { } get hideMetadataColums() { - return this.$store.state.gui.gcodefiles.hideMetadataColums + return this.$store.state.gui.view.gcodefiles.hideMetadataColums } set hideMetadataColums(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.hideMetadataColums', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.hideMetadataColums', value: newVal }) } get showHiddenFiles() { - return this.$store.state.gui.gcodefiles.showHiddenFiles + return this.$store.state.gui.view.gcodefiles.showHiddenFiles } set showHiddenFiles(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.showHiddenFiles', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.showHiddenFiles', value: newVal }) } get showPrintedFiles() { - return this.$store.state.gui.gcodefiles.showPrintedFiles + return this.$store.state.gui.view.gcodefiles.showPrintedFiles } set showPrintedFiles(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.showPrintedFiles', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.showPrintedFiles', value: newVal }) } get sortBy() { - return this.$store.state.gui.gcodefiles.sortBy + return this.$store.state.gui.view.gcodefiles.sortBy } set sortBy(newVal) { if (newVal === undefined) newVal = 'modified' - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.sortBy', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.sortBy', value: newVal }) } get sortDesc() { - return this.$store.state.gui.gcodefiles.sortDesc + return this.$store.state.gui.view.gcodefiles.sortDesc } set sortDesc(newVal) { if (newVal === undefined) newVal = false - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.sortDesc', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.sortDesc', value: newVal }) } get countPerPage() { - return this.$store.state.gui.gcodefiles.countPerPage + return this.$store.state.gui.view.gcodefiles.countPerPage } set countPerPage(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'gcodefiles.countPerPage', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.gcodefiles.countPerPage', value: newVal }) } get timelapseEnabled() { diff --git a/src/components/panels/HistoryListPanel.vue b/src/components/panels/HistoryListPanel.vue index c9f0fe65..a7d98d7c 100644 --- a/src/components/panels/HistoryListPanel.vue +++ b/src/components/panels/HistoryListPanel.vue @@ -473,19 +473,19 @@ export default class HistoryListPanel extends Mixins(BaseMixin) { } get countPerPage() { - return this.$store.state.gui.history.countPerPage + return this.$store.state.gui.view.historycountPerPage } set countPerPage(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'history.countPerPage', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.history.countPerPage', value: newVal }) } get hideColums() { - return this.$store.state.gui.history.hideColums + return this.$store.state.gui.view.history.hideColums } set hideColums(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'history.hideColums', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.history.hideColums', value: newVal }) } refreshHistory() { diff --git a/src/components/panels/HistoryStatisticsPanel.vue b/src/components/panels/HistoryStatisticsPanel.vue index 915b05cb..591f4dbb 100644 --- a/src/components/panels/HistoryStatisticsPanel.vue +++ b/src/components/panels/HistoryStatisticsPanel.vue @@ -89,11 +89,11 @@ export default class HistoryStatisticsPanel extends Mixins(BaseMixin) { } get toggleChart () { - return this.$store.state.gui.history.toggleChartCol3 + return this.$store.state.gui.view.history.toggleChartCol3 } set toggleChart(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'history.toggleChartCol3', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.history.toggleChartCol3', value: newVal }) } formatPrintTime(totalSeconds: number) { diff --git a/src/components/panels/JobqueuePanel.vue b/src/components/panels/JobqueuePanel.vue index a1a7cedf..bc0b5adb 100644 --- a/src/components/panels/JobqueuePanel.vue +++ b/src/components/panels/JobqueuePanel.vue @@ -137,11 +137,11 @@ export default class JobqueuePanel extends Mixins(BaseMixin) { } get countPerPage() { - return this.$store.state.gui.jobqueue.countPerPage + return this.$store.state.gui.view.jobqueue.countPerPage } set countPerPage(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'jobqueue.countPerPage', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.jobqueue.countPerPage', value: newVal }) } refreshHistory() { diff --git a/src/components/panels/Machine/ConfigFilesPanel.vue b/src/components/panels/Machine/ConfigFilesPanel.vue index 1c83c563..279b91fc 100644 --- a/src/components/panels/Machine/ConfigFilesPanel.vue +++ b/src/components/panels/Machine/ConfigFilesPanel.vue @@ -532,47 +532,47 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) { } get countPerPage() { - return this.$store.state.gui.settings.configfiles.countPerPage + return this.$store.state.gui.view.configfiles.countPerPage } set countPerPage(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'settings.configfiles.countPerPage', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.configfiles.countPerPage', value: newVal }) } get showHiddenFiles() { - return this.$store.state.gui.settings.configfiles.showHiddenFiles + return this.$store.state.gui.view.configfiles.showHiddenFiles } set showHiddenFiles(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'settings.configfiles.showHiddenFiles', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.configfiles.showHiddenFiles', value: newVal }) } get hideBackupFiles() { - return this.$store.state.gui.settings.configfiles.hideBackupFiles + return this.$store.state.gui.view.configfiles.hideBackupFiles } set hideBackupFiles(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'settings.configfiles.hideBackupFiles', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.configfiles.hideBackupFiles', value: newVal }) } get sortBy() { - return this.$store.state.gui.settings.configfiles.sortBy + return this.$store.state.gui.view.configfiles.sortBy } set sortBy(newVal) { if (newVal === undefined) newVal = 'filename' - this.$store.dispatch('gui/saveSetting', { name: 'settings.configfiles.sortBy', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.configfiles.sortBy', value: newVal }) } get sortDesc() { - return this.$store.state.gui.settings.configfiles.sortDesc + return this.$store.state.gui.view.configfiles.sortDesc } set sortDesc(newVal) { if (newVal === undefined) newVal = false - this.$store.dispatch('gui/saveSetting', { name: 'settings.configfiles.sortDesc', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.configfiles.sortDesc', value: newVal }) } get registeredDirectories() { diff --git a/src/components/panels/MacrogroupPanel.vue b/src/components/panels/MacrogroupPanel.vue index c47b37e4..83762519 100644 --- a/src/components/panels/MacrogroupPanel.vue +++ b/src/components/panels/MacrogroupPanel.vue @@ -31,7 +31,7 @@ import BaseMixin from '../mixins/base' import Panel from '@/components/ui/Panel.vue' import MacroButton from '@/components/inputs/MacroButton.vue' import {PrinterStateMacro} from '@/store/printer/types' -import {GuiMacrogroupsStateMacrogroupMacro} from '@/store/gui/macrogroups/types' +import {GuiMacrosStateMacrogroupMacro} from '@/store/gui/macros/types' @Component({ components: {MacroButton, Panel} }) @@ -40,17 +40,17 @@ export default class MacrogroupPanel extends Mixins(BaseMixin) { @Prop({ required: true }) panelId!: string get macrogroup() { - return this.$store.getters['gui/macrogroups/getMacrogroup'](this.panelId) + return this.$store.getters['gui/macros/getMacrogroup'](this.panelId) } get allMacros() { - return this.$store.getters['printer/getMacros'] ?? [] + return this.$store.getters['printer/getAllMacros'] ?? [] } get macros() { let macros = this.macrogroup?.macros ?? [] - macros = macros.filter((macro: GuiMacrogroupsStateMacrogroupMacro) => { + macros = macros.filter((macro: GuiMacrosStateMacrogroupMacro) => { if (!this.allMacros.find((existMacro: PrinterStateMacro) => existMacro.name.toLowerCase() === macro.name.toLowerCase())) return false return ( @@ -60,7 +60,7 @@ export default class MacrogroupPanel extends Mixins(BaseMixin) { ) }) - return macros.sort((a: GuiMacrogroupsStateMacrogroupMacro, b: GuiMacrogroupsStateMacrogroupMacro) => a.pos - b.pos) + return macros.sort((a: GuiMacrosStateMacrogroupMacro, b: GuiMacrosStateMacrogroupMacro) => a.pos - b.pos) } get macrogroupStatus() { @@ -71,7 +71,7 @@ export default class MacrogroupPanel extends Mixins(BaseMixin) { ) } - getColor(macro: GuiMacrogroupsStateMacrogroupMacro) { + getColor(macro: GuiMacrosStateMacrogroupMacro) { if (macro.color === 'group') { if (this.macrogroup.color === 'custom') return this.macrogroup.colorCustom else return this.macrogroup.color diff --git a/src/components/panels/MiniconsolePanel.vue b/src/components/panels/MiniconsolePanel.vue index 182d807f..5c502850 100644 --- a/src/components/panels/MiniconsolePanel.vue +++ b/src/components/panels/MiniconsolePanel.vue @@ -162,7 +162,7 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) { } get lastCommands(): string[] { - return this.$store.state.gui.gcodehistory.history ?? [] + return this.$store.state.gui.gcodehistory.entries ?? [] } commandClick(msg: string): void { diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 0d0fc71f..689e92bb 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -388,7 +388,7 @@ export default class StatusPanel extends Mixins(BaseMixin) { color: 'error', icon: 'mdi-stop', loadingName: 'statusPrintCancel', - status: this.$store.state.gui.general.displayCancelPrint ? ['paused', 'printing'] : ['paused'], + status: this.$store.state.gui.uiSettings.displayCancelPrint ? ['paused', 'printing'] : ['paused'], click: this.btnCancelJob }, { text: this.$t('Panels.StatusPanel.ClearPrintStats'), @@ -573,7 +573,7 @@ export default class StatusPanel extends Mixins(BaseMixin) { } get boolBigThumbnail() { - const setting = this.$store.state.gui.dashboard.boolBigThumbnail ?? true + const setting = this.$store.state.gui.uiSettings.boolBigThumbnail ?? true return this.current_filename && setting && this.thumbnailBig } diff --git a/src/components/panels/Timelapse/TimelapseFilesPanel.vue b/src/components/panels/Timelapse/TimelapseFilesPanel.vue index 61a0bc9f..208623cd 100644 --- a/src/components/panels/Timelapse/TimelapseFilesPanel.vue +++ b/src/components/panels/Timelapse/TimelapseFilesPanel.vue @@ -370,31 +370,31 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) { } get sortBy() { - return this.$store.state.gui.timelapse.sortBy ?? 'modified' + return this.$store.state.gui.view.gcodefiles.sortBy ?? 'modified' } set sortBy(newVal) { if (newVal === undefined) newVal = 'modified' - this.$store.dispatch('gui/saveSetting', { name: 'timelapse.sortBy', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.timelapse.sortBy', value: newVal }) } get sortDesc() { - return this.$store.state.gui.timelapse.sortDesc ?? true + return this.$store.state.gui.view.gcodefiles.sortDesc ?? true } set sortDesc(newVal) { if (newVal === undefined) newVal = false - this.$store.dispatch('gui/saveSetting', { name: 'timelapse.sortDesc', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.timelapse.sortDesc', value: newVal }) } get countPerPage() { - return this.$store.state.gui.timelapse?.countPerPage ?? 10 + return this.$store.state.gui.view.gcodefiles?.countPerPage ?? 10 } set countPerPage(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'timelapse.countPerPage', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.timelapse.countPerPage', value: newVal }) } get displayFiles() { diff --git a/src/components/panels/ToolsPanel.vue b/src/components/panels/ToolsPanel.vue index 90576cf6..ffd01622 100644 --- a/src/components/panels/ToolsPanel.vue +++ b/src/components/panels/ToolsPanel.vue @@ -303,19 +303,19 @@ export default class ToolsPanel extends Mixins(BaseMixin) { } get boolTempchart(): boolean { - return this.$store.state.gui.dashboard?.boolTempchart ?? false + return this.$store.state.gui.view.tempchart.boolTempchart ?? false } set boolTempchart(newVal: boolean) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.boolTempchart', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.boolTempchart', value: newVal }) } get autoscaleTempchart(): boolean { - return this.$store.state.gui.tempchart.autoscale ?? false + return this.$store.state.gui.view.tempchart.autoscale ?? false } set autoscaleTempchart(newVal: boolean) { - this.$store.dispatch('gui/saveSetting', { name: 'tempchart.autoscale', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.autoscale', value: newVal }) } get heaters(): PrinterStateHeater[] { @@ -377,12 +377,12 @@ export default class ToolsPanel extends Mixins(BaseMixin) { const serieName = 'bool'+type.charAt(0).toUpperCase() + type.slice(1) const value = this.editHeater[serieName] - const name = 'tempchart.datasetSettings.'+this.editHeater.name+'.'+type + const name = 'view.tempchart.datasetSettings.'+this.editHeater.name+'.'+type this.$store.dispatch('gui/saveSetting', { name, value }) } setVisibleAdditionalSensor(sensor: string): void { - const name = 'tempchart.datasetSettings.'+this.editHeater.name+'.additionalSensors.'+sensor + const name = 'view.tempchart.datasetSettings.'+this.editHeater.name+'.additionalSensors.'+sensor this.$store.dispatch('gui/saveSetting', { name, value: this.editHeater.additionSensors[sensor].bool }) } @@ -391,7 +391,7 @@ export default class ToolsPanel extends Mixins(BaseMixin) { if (typeof value === 'object' && 'hex' in value) value = value.hex this.$store.commit('printer/tempHistory/setColor', { name: this.editHeater.name, value: value }) - const name = 'tempchart.datasetSettings.'+this.editHeater.name+'.color' + const name = 'view.tempchart.datasetSettings.'+this.editHeater.name+'.color' this.$store.dispatch('gui/saveSetting', { name, value }) } diff --git a/src/components/panels/ZoffsetPanel.vue b/src/components/panels/ZoffsetPanel.vue index 96947b46..b21789a7 100644 --- a/src/components/panels/ZoffsetPanel.vue +++ b/src/components/panels/ZoffsetPanel.vue @@ -104,7 +104,7 @@ export default class ZoffsetPanel extends Mixins(BaseMixin) { } get displayZOffsetStandby() { - return this.$store.state.gui.general.displayZOffsetStandby ?? false + return this.$store.state.gui.uiSettings.displayZOffsetStandby ?? false } get homing_origin() { diff --git a/src/components/settings/SettingsConsoleTab.vue b/src/components/settings/SettingsConsoleTab.vue index ae4d04ca..1a138b28 100644 --- a/src/components/settings/SettingsConsoleTab.vue +++ b/src/components/settings/SettingsConsoleTab.vue @@ -120,7 +120,7 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } get consoleFilters() { - return this.$store.getters['gui/consolefilters/getConsolefilters'] ?? [] + return this.$store.getters['gui/console/getConsolefilters'] ?? [] } get availableDirections() { @@ -140,7 +140,7 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } set consoleDirection(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'console.direction', value: newVal }) + this.$store.dispatch('gui/console/saveSetting', { name: 'direction', value: newVal }) } get availableEntryStyles() { @@ -160,7 +160,7 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } set entryStyle(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'console.entryStyle', value: newVal }) + this.$store.dispatch('gui/console/saveSetting', { name: 'entryStyle', value: newVal }) } get consoleHeight() { @@ -168,7 +168,7 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } set consoleHeight(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'console.height', value: newVal }) + this.$store.dispatch('gui/console/saveSetting', { name: 'height', value: newVal }) } @Watch('consoleHeight') @@ -186,15 +186,15 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } set hideWaitTemperatures(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'console.hideWaitTemperatures', value: newVal }) + this.$store.dispatch('gui/console/saveSetting', { name: 'hideWaitTemperatures', value: newVal }) } get hideTimelapse() { - return this.$store.state.gui.console.hideTimelapse + return this.$store.state.gui.console.hideTlCommands } set hideTimelapse(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'console.hideTimelapse', value: newVal }) + this.$store.dispatch('gui/console/saveSetting', { name: 'hideTlCommands', value: newVal }) } existsPresetName(name: string) { @@ -215,7 +215,7 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { regex: filter.regex } - this.$store.dispatch('gui/consolefilters/update', { id: filter.id, values }) + this.$store.dispatch('gui/console/filterUpdate', { id: filter.id, values }) } createFilter() { @@ -240,16 +240,16 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) { } if (this.form.id) - this.$store.dispatch('gui/consolefilters/update', { id: this.form.id, values: filter }) + this.$store.dispatch('gui/console/filterUpdate', { id: this.form.id, values: filter }) else - this.$store.dispatch('gui/consolefilters/store', { values: filter }) + this.$store.dispatch('gui/console/filterStore', { values: filter }) this.clearForm() } } deleteFilter(id: string) { - this.$store.dispatch('gui/consolefilters/delete', id) + this.$store.dispatch('gui/console/filterDelete', id) } } \ No newline at end of file diff --git a/src/components/settings/SettingsControlTab.vue b/src/components/settings/SettingsControlTab.vue index 791c4ae1..195c7ed4 100644 --- a/src/components/settings/SettingsControlTab.vue +++ b/src/components/settings/SettingsControlTab.vue @@ -236,55 +236,55 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { } get controlStyle() { - return this.$store.state.gui.dashboard.control.style ?? 'bar' + return this.$store.state.gui.control.style ?? 'bar' } set controlStyle(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.style', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.style', value: newVal }) } get reverseX() { - return this.$store.state.gui.dashboard.control.reverseX + return this.$store.state.gui.control.reverseX } set reverseX(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.reverseX', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.reverseX', value: newVal }) } get reverseY() { - return this.$store.state.gui.dashboard.control.reverseY + return this.$store.state.gui.control.reverseY } set reverseY(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.reverseY', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.reverseY', value: newVal }) } get reverseZ() { - return this.$store.state.gui.dashboard.control.reverseZ + return this.$store.state.gui.control.reverseZ } set reverseZ(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.reverseZ', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.reverseZ', value: newVal }) } get feedrateXY() { - return this.$store.state.gui.dashboard.control.feedrateXY + return this.$store.state.gui.control.feedrateXY } set feedrateXY(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.feedrateXY', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.feedrateXY', value: newVal }) } get feedrateZ() { - return this.$store.state.gui.dashboard.control.feedrateZ + return this.$store.state.gui.control.feedrateZ } set feedrateZ(newVal) { - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.feedrateZ', value: newVal }) + this.$store.dispatch('gui/saveSetting', { name: 'control.feedrateZ', value: newVal }) } get stepsAll() { - const steps = this.$store.state.gui.dashboard.control.stepsAll + const steps = this.$store.state.gui.control.stepsAll return (steps ?? []).sort(function (a: number,b: number) { return b-a }) } @@ -292,11 +292,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absSteps = [] for(const value of newVal) absSteps.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.stepsAll', value: absSteps }) + this.$store.dispatch('gui/saveSetting', { name: 'control.stepsAll', value: absSteps }) } get stepsXY() { - const steps = this.$store.state.gui.dashboard.control.stepsXY + const steps = this.$store.state.gui.control.stepsXY return steps.sort(function (a: number,b: number) { return b-a }) } @@ -304,11 +304,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absSteps = [] for(const value of steps) absSteps.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.stepsXY', value: absSteps }) + this.$store.dispatch('gui/saveSetting', { name: 'control.stepsXY', value: absSteps }) } get stepsZ() { - const steps = this.$store.state.gui.dashboard.control.stepsZ + const steps = this.$store.state.gui.control.stepsZ return steps.sort(function (a: number,b: number) { return b-a }) } @@ -316,11 +316,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absSteps = [] for(const value of steps) absSteps.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.stepsZ', value: absSteps }) + this.$store.dispatch('gui/saveSetting', { name: 'control.stepsZ', value: absSteps }) } get stepsCircleXY() { - const steps = this.$store.state.gui.dashboard.control.stepsCircleXY + const steps = this.$store.state.gui.control.stepsCircleXY return steps.sort(function (a: number,b: number) { return b-a }) } @@ -328,11 +328,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absSteps = [] for(const value of steps) absSteps.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.stepsCircleXY', value: absSteps }) + this.$store.dispatch('gui/saveSetting', { name: 'control.stepsCircleXY', value: absSteps }) } get stepsCircleZ() { - const steps = this.$store.state.gui.dashboard.control.stepsCircleZ + const steps = this.$store.state.gui.control.stepsCircleZ return steps.sort(function (a: number,b: number) { return b-a }) } @@ -340,11 +340,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absSteps = [] for(const value of steps) absSteps.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.control.stepsCircleZ', value: absSteps }) + this.$store.dispatch('gui/saveSetting', { name: 'control.stepsCircleZ', value: absSteps }) } get feedamountsE() { - const steps = this.$store.state.gui.dashboard.extruder.feedamounts + const steps = this.$store.state.gui.control.extruder.feedamounts return steps.sort(function (a: number,b: number) { return b-a }) } @@ -352,11 +352,11 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absAmounts = [] for(const value of amounts) absAmounts.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.extruder.feedamounts', value: absAmounts }) + this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedamounts', value: absAmounts }) } get feedratesE() { - const steps = this.$store.state.gui.dashboard.extruder.feedrates + const steps = this.$store.state.gui.control.extruder.feedrates return steps.sort(function (a: number,b: number) { return b-a }) } @@ -364,7 +364,7 @@ export default class SettingsControlTab extends Mixins(BaseMixin) { const absRates = [] for(const value of rates) absRates.push(Math.abs(value)) - this.$store.dispatch('gui/saveSetting', { name: 'dashboard.extruder.feedrates', value: absRates }) + this.$store.dispatch('gui/saveSetting', { name: 'control.extruder.feedrates', value: absRates }) } blurFeedrateXY() { diff --git a/src/components/settings/SettingsDashboardTabDesktop.vue b/src/components/settings/SettingsDashboardTabDesktop.vue index 090d2655..9c6517f9 100644 --- a/src/components/settings/SettingsDashboardTabDesktop.vue +++ b/src/components/settings/SettingsDashboardTabDesktop.vue @@ -37,7 +37,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -62,7 +62,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -124,7 +124,7 @@ export default class SettingsDashboardTabDesktop extends Mixins(DashboardMixin) changeState1(name: string, newVal: boolean) { const index = this.desktopLayout1.findIndex((element: any) => element.name === name) if (index !== -1) { - this.desktopLayout1[index].visable = newVal + this.desktopLayout1[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.desktopLayout1', value: this.desktopLayout1 }) } } @@ -132,7 +132,7 @@ export default class SettingsDashboardTabDesktop extends Mixins(DashboardMixin) changeState2(name: string, newVal: boolean) { const index = this.desktopLayout2.findIndex((element: any) => element.name === name) if (index !== -1) { - this.desktopLayout2[index].visable = newVal + this.desktopLayout2[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.desktopLayout2', value: this.desktopLayout2 }) } } diff --git a/src/components/settings/SettingsDashboardTabMobile.vue b/src/components/settings/SettingsDashboardTabMobile.vue index 2733748b..1588706b 100644 --- a/src/components/settings/SettingsDashboardTabMobile.vue +++ b/src/components/settings/SettingsDashboardTabMobile.vue @@ -37,7 +37,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -89,7 +89,7 @@ export default class SettingsDashboardTabMobile extends Mixins(DashboardMixin) { changeState(name: string, newVal: boolean) { const index = this.mobileLayout.findIndex((element: any) => element.name === name) if (index !== -1) { - this.mobileLayout[index].visable = newVal + this.mobileLayout[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.mobileLayout', value: this.mobileLayout }) } } diff --git a/src/components/settings/SettingsDashboardTabTablet.vue b/src/components/settings/SettingsDashboardTabTablet.vue index b2f13a6c..775eb735 100644 --- a/src/components/settings/SettingsDashboardTabTablet.vue +++ b/src/components/settings/SettingsDashboardTabTablet.vue @@ -37,7 +37,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -62,7 +62,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -124,7 +124,7 @@ export default class SettingsDashboardTabTablet extends Mixins(DashboardMixin) { changeState1(name: string, newVal: boolean) { const index = this.tabletLayout1.findIndex((element: any) => element.name === name) if (index !== -1) { - this.tabletLayout1[index].visable = newVal + this.tabletLayout1[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.tabletLayout1', value: this.tabletLayout1 }) } } @@ -132,7 +132,7 @@ export default class SettingsDashboardTabTablet extends Mixins(DashboardMixin) { changeState2(name: string, newVal: boolean) { const index = this.tabletLayout2.findIndex((element: any) => element.name === name) if (index !== -1) { - this.tabletLayout2[index].visable = newVal + this.tabletLayout2[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.tabletLayout2', value: this.tabletLayout2 }) } } diff --git a/src/components/settings/SettingsDashboardTabWidescreen.vue b/src/components/settings/SettingsDashboardTabWidescreen.vue index 1927d293..fa1a033c 100644 --- a/src/components/settings/SettingsDashboardTabWidescreen.vue +++ b/src/components/settings/SettingsDashboardTabWidescreen.vue @@ -37,7 +37,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -62,7 +62,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -87,7 +87,7 @@ {{ getPanelName(element.name) }} - mdi-checkbox-blank-outline + mdi-checkbox-blank-outline mdi-checkbox-marked @@ -159,7 +159,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi changeState1(name: string, newVal: boolean) { const index = this.widescreenLayout1.findIndex((element: any) => element.name === name) if (index !== -1) { - this.widescreenLayout1[index].visable = newVal + this.widescreenLayout1[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.widescreenLayout1', value: this.widescreenLayout1 }) } } @@ -167,7 +167,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi changeState2(name: string, newVal: boolean) { const index = this.widescreenLayout2.findIndex((element: any) => element.name === name) if (index !== -1) { - this.widescreenLayout2[index].visable = newVal + this.widescreenLayout2[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.widescreenLayout2', value: this.widescreenLayout2 }) } } @@ -175,7 +175,7 @@ export default class SettingsDashboardTabWidescreen extends Mixins(DashboardMixi changeState3(name: string, newVal: boolean) { const index = this.widescreenLayout3.findIndex((element: any) => element.name === name) if (index !== -1) { - this.widescreenLayout3[index].visable = newVal + this.widescreenLayout3[index].visible = newVal this.$store.dispatch('gui/saveSetting', {name: 'dashboard.widescreenLayout3', value: this.widescreenLayout3 }) } } diff --git a/src/components/settings/SettingsGeneralTab.vue b/src/components/settings/SettingsGeneralTab.vue index efa0c927..763ddd89 100644 --- a/src/components/settings/SettingsGeneralTab.vue +++ b/src/components/settings/SettingsGeneralTab.vue @@ -18,13 +18,71 @@ + + + {{ $t('Settings.GeneralTab.Backup') }} + {{ $t('Settings.GeneralTab.Restore') }} + + - {{ $t('Settings.GeneralTab.FactoryReset') }} + {{ $t('Settings.GeneralTab.FactoryReset') }} + + + + + + +

{{ $t('Settings.GeneralTab.BackupDialog') }}

+
+
+ + + + + + + + + + + {{ $t('Settings.GeneralTab.Backup') }} + + + +
+
+
- + @@ -36,68 +94,42 @@ + - - - - - - + @@ -105,8 +137,8 @@ {{ $t('Settings.GeneralTab.Reset') }} @@ -115,6 +147,44 @@ + + + + + + +

{{ $t('Settings.GeneralTab.RestoreDialog') }}

+
+
+ + + + + + + + + {{ $t('Settings.GeneralTab.Restore') }} + + + +
+
+
@@ -125,21 +195,74 @@ import { Mixins } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import SettingsRow from '@/components/settings/SettingsRow.vue' import Panel from '@/components/ui/Panel.vue' +import Vue from 'vue' + @Component({ components: {Panel, SettingsRow} }) export default class SettingsGeneralTab extends Mixins(BaseMixin) { + private dialogBackupMainsail = false private dialogResetMainsail = false - private dialogResetMainsailLoading = false - private dbCheckboxes = { - mainsail: false, - mainsail_presets: false, - mainsail_gcodehistory: false, - mainsail_macrogroups: false, - mainsail_remoteprinters: false, - timelapse: false, - history_jobs: false, - history_totals: false, + private dialogRestoreMainsail = false + + private dbCheckboxes: string[] = [] + + private restoreableNamespaces: { name: string, label: string}[] = [] + private restoreObjects: any = {} + + private mainsailKeys: { name: string, label: string}[] = [] + private availableNamespaces: string[] = [] + + $refs!: { + uploadBackupFile: HTMLInputElement + } + + get availableKeys() { + return [ + { + name: 'general', + label: this.$t('Settings.GeneralTab.General')+'' + }, { + name: 'console', + label: this.$t('Settings.ConsoleTab.Console')+'' + }, { + name: 'control', + label: this.$t('Settings.ControlTab.Control')+'' + }, { + name: 'dashboard', + label: this.$t('Settings.DashboardTab.Dashboard')+'' + }, { + name: 'editor', + label: this.$t('Settings.EditorTab.Editor')+'' + }, { + name: 'gcodeviewer', + label: this.$t('Settings.GCodeViewerTab.GCodeViewer')+'' + }, { + name: 'gcodehistory', + label: this.$t('Settings.GeneralTab.DbConsoleHistory')+'' + }, { + name: 'macros', + label: this.$t('Settings.MacrosTab.Macros')+'' + }, { + name: 'presets', + label: this.$t('Settings.PresetsTab.PreheatPresets')+'' + }, { + name: 'remoteprinters', + label: this.$t('Settings.RemotePrintersTab.RemotePrinters')+'' + }, { + name: 'timelapse', + label: this.$t('Settings.TimelapseTab.Timelapse')+'' + }, { + name: 'uiSettings', + label: this.$t('Settings.UiSettingsTab.UiSettings')+'' + }, { + name: 'view', + label: this.$t('Settings.GeneralTab.DbView')+'' + }, { + name: 'webcams', + label: this.$t('Settings.WebcamsTab.Webcams')+'' + } + ] } get printerName() { @@ -214,9 +337,145 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) { return this.$store.state.server.components ?? [] } - resetMainsail() { - this.$store.dispatch('gui/resetMoonrakerDB', this.dbCheckboxes) - this.dialogResetMainsailLoading = true + async refreshNamespaces() { + this.availableNamespaces = [] + + const url = this.$store.getters['socket/getUrl'] + '/server/database/list' + const response = await fetch(url) + if (response) { + const objects = await response.json() + this.availableNamespaces = [...objects.result?.namespaces] ?? [] + } + } + + async refreshMainsailKeys() { + this.mainsailKeys = [] + + const url = this.$store.getters['socket/getUrl'] + '/server/database/item?namespace=mainsail' + const response = await fetch(url) + if (response) { + const objects = await response.json() + if (objects?.result?.value) { + Object.keys(objects?.result?.value).forEach((tmp: string) => { + if (tmp !== 'initVersion') { + const namespace = this.availableKeys.find((namespace) => namespace.name === tmp) + const tmpNamespace = namespace ? namespace : { name: tmp, label: tmp } + this.mainsailKeys.push(tmpNamespace) + } + }) + + this.mainsailKeys = this.mainsailKeys.sort((a, b) => { + if (a.name === 'general') return -1 + if (b.name === 'general') return 1 + + const stringA = a.label.toString().toLowerCase() + const stringB = b.label.toString().toLowerCase() + + if (stringA < stringB) return -1 + if (stringA > stringB) return 1 + + return 0 + }) + } + } + } + + changeNamespace(name: string) { + if (this.dbCheckboxes.includes(name)) { + const index = this.dbCheckboxes.indexOf(name) + if (index >= 0) this.dbCheckboxes.splice(index, 1) + } else this.dbCheckboxes.push(name) + } + + async resetMainsail() { + await this.refreshNamespaces() + if (this.availableNamespaces.includes('mainsail')) await this.refreshMainsailKeys() + else this.mainsailKeys = [] + + this.dbCheckboxes = [] + this.dialogResetMainsail = true + } + + async resetMainsailAction() { + await this.$store.dispatch('socket/addLoading', 'resetMainsail') + await this.$store.dispatch('gui/resetMoonrakerDB', this.dbCheckboxes) + } + + async backupDb() { + this.$store.dispatch('socket/addLoading', 'backupDbButton') + await this.refreshNamespaces() + if (this.availableNamespaces.includes('mainsail')) await this.refreshMainsailKeys() + else this.mainsailKeys = [] + + this.dbCheckboxes = [] + this.dialogBackupMainsail = true + } + + async backupMainsail() { + await this.$store.dispatch('socket/addLoading', 'backupMainsail') + await this.$store.dispatch('gui/backupMoonrakerDB', this.dbCheckboxes) + await this.$store.dispatch('socket/removeLoading', 'backupMainsail') + this.dialogBackupMainsail = false + } + + async restoreDb() { + this.$store.dispatch('socket/addLoading', 'restoreUploadButton') + this.$refs?.uploadBackupFile?.click() + } + + uploadRestore() { + if (this.$refs.uploadBackupFile.files?.length) { + const backup = this.$refs.uploadBackupFile.files[0] + if (backup) { + const reader = new FileReader() + reader.readAsText(backup, 'UTF-8') + reader.onload = (evt) => { + this.restoreableNamespaces = [] + try { + this.restoreObjects = JSON.parse(evt?.target?.result+'') + + Object.keys(this.restoreObjects).forEach((tmp: string) => { + const namespace = this.availableKeys.find((namespace) => namespace.name === tmp) + const tmpNamespace = namespace ? namespace : { name: tmp, label: tmp } + + this.restoreableNamespaces.push(tmpNamespace) + }) + + this.restoreableNamespaces = this.restoreableNamespaces.sort((a, b) => { + if (a.name === 'general') return -1 + if (b.name === 'general') return 1 + + const stringA = a.label.toString().toLowerCase() + const stringB = b.label.toString().toLowerCase() + + if (stringA < stringB) return -1 + if (stringA > stringB) return 1 + + return 0 + }) + + this.dbCheckboxes = [] + this.dialogRestoreMainsail = true + } catch (e) { + Vue.$toast.error(this.$t('Settings.GeneralTab.CannotReadJson')+'') + } + } + reader.onerror = (evt) => { + window.console.error(evt) + } + } + + this.$refs.uploadBackupFile.value = '' + } + } + + async restoreDbAction () { + this.$store.dispatch('socket/addLoading', 'restoreDbAction') + + this.$store.dispatch('gui/restoreMoonrakerDB', { + dbCheckboxes: this.dbCheckboxes, + restoreObjects: this.restoreObjects + }) } } \ No newline at end of file diff --git a/src/components/settings/SettingsMacrosTab.vue b/src/components/settings/SettingsMacrosTab.vue index 6510fd50..9d1fb38d 100644 --- a/src/components/settings/SettingsMacrosTab.vue +++ b/src/components/settings/SettingsMacrosTab.vue @@ -4,11 +4,11 @@

{{ $t('Settings.MacrosTab.General') }}

- +
-