feat: backup/restore/default moonraker db (#476)
* refactor: reset dbCheckboxes Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework moonraker db reset Signed-off-by: Stefan Dej <meteyou@gmail.com> * feat: add function to create a mainsail db backup Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: fix type of dbCheckboxes Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: first restore test Signed-off-by: Stefan Dej <meteyou@gmail.com> * feat: restore db from json file Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework gui store Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: rework gui store issues Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: rework gui store issues with extruder panel Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rename gui/macrogroups to gui/macros and move back to mainsail namespace Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: ignore simple hide macros settings in expert macro mode Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: init load bug Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rename gui/consolefilter to gui/console and move back to mainsail namespace and update gui/macros Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: remove old function in gui/macros Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework gui/presets Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework gui/gcodehistory Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: add all gui restart actions in gui restart action Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework gui/remoteprinters Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: control store gets Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework reset moonraker db in interface settings Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework backup moonraker DB Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: rework restore moonraker db Signed-off-by: Stefan Dej <meteyou@gmail.com> * bugfix: backup/restore moonraker db locale Signed-off-by: Stefan Dej <meteyou@gmail.com> * bugfix: backup/restore moonraker db locale, add tempchart Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: change tempchart settings wrong store path Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: add view locale to db backup/restore and delete old locale Signed-off-by: Stefan Dej <meteyou@gmail.com> * feat: use /config/.theme/default.json when reset moonraker db to fill in default values after reset Signed-off-by: Stefan Dej <meteyou@gmail.com> * feat: use /config/.theme/default.json when mainsail will be loaded the first time Signed-off-by: Stefan Dej <meteyou@gmail.com> * refactor: add description to backup dialog Signed-off-by: Stefan Dej <meteyou@gmail.com> * fix: save macrogroup update Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
1 parent
c4181443e6
commit
7f6e6e5bdf
74 files changed
+1301
-867
No files matched your search
+2
-2
@@ -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 {
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -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 ?? []),
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -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() {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -62,7 +62,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -62,7 +62,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState1(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState1(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -62,7 +62,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState2(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState2(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -87,7 +87,7 @@
|
||||
{{ getPanelName(element.name) }}
|
||||
</v-col>
|
||||
<v-col class="col-auto pl-0">
|
||||
<v-icon v-if="!element.visable" color="grey lighten-1" @click.stop="changeState3(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-if="!element.visible" color="grey lighten-1" @click.stop="changeState3(element.name,true)">mdi-checkbox-blank-outline</v-icon>
|
||||
<v-icon v-else color="primary" @click.stop="changeState3(element.name,false)">mdi-checkbox-marked</v-icon>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,71 @@
|
||||
<v-select v-model="calcEtaTime" :items="calcEtaTimeItems" multiple hide-details dense outlined attach></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.MoonrakerDb')" :dynamicSlotWidth="true">
|
||||
<input type="file" :accept="['.json']" ref="uploadBackupFile" class="d-none" @change="uploadRestore" />
|
||||
<v-btn @click="backupDb" :loading="loadings.includes('backupDbButton')" small>{{ $t('Settings.GeneralTab.Backup') }}</v-btn>
|
||||
<v-btn @click="restoreDb" small :loading="loadings.includes('restoreUploadButton')" class="ml-3">{{ $t('Settings.GeneralTab.Restore') }}</v-btn>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<settings-row :title="$t('Settings.GeneralTab.FactoryReset')" :dynamicSlotWidth="true">
|
||||
<v-btn @click="dialogResetMainsail=true" color="error" small>{{ $t('Settings.GeneralTab.FactoryReset') }}</v-btn>
|
||||
<v-btn @click="resetMainsail" color="error" small>{{ $t('Settings.GeneralTab.FactoryReset') }}</v-btn>
|
||||
</settings-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-dialog v-model="dialogBackupMainsail" persistent :width="360">
|
||||
<panel :title="$t('Settings.GeneralTab.Backup')" card-class="mainsail-backup-dialog" :margin-bottom="false" icon="mdi-help-circle">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="dialogBackupMainsail = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="mb-0">{{ $t('Settings.GeneralTab.BackupDialog') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pl-6">
|
||||
<template v-for="db in mainsailKeys">
|
||||
<v-checkbox
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:key="db.name"
|
||||
@change="changeNamespace(db.name)"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<v-checkbox
|
||||
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
|
||||
v-if="availableNamespaces.includes('timelapse')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('timelapse')"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
:label="$t('Settings.GeneralTab.DbWebcams')"
|
||||
v-if="availableNamespaces.includes('webcams')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('webcams')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
color="red"
|
||||
@click="backupMainsail"
|
||||
:loading="loadings.includes('backupMainsail')"
|
||||
>
|
||||
{{ $t('Settings.GeneralTab.Backup') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogResetMainsail" persistent :width="360">
|
||||
<panel :title="$t('Settings.GeneralTab.FactoryReset')" card-class="ractory-reset-dialog" :margin-bottom="false" icon="mdi-help-circle">
|
||||
<panel :title="$t('Settings.GeneralTab.FactoryReset')" card-class="factory-reset-dialog" :margin-bottom="false" icon="mdi-help-circle">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="dialogResetMainsail = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
@@ -36,68 +94,42 @@
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pl-6">
|
||||
<template v-for="db in mainsailKeys">
|
||||
<v-checkbox
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:key="db.name"
|
||||
@change="changeNamespace(db.name)"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.mainsail"
|
||||
:label="$t('Settings.GeneralTab.DbGeneral')"
|
||||
v-if="moonrakerDbNamespaces.includes('mainsail')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.mainsail_presets"
|
||||
:label="$t('Settings.GeneralTab.DbPresets')"
|
||||
v-if="moonrakerDbNamespaces.includes('mainsail_presets')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.mainsail_gcodehistory"
|
||||
:label="$t('Settings.GeneralTab.DbGcodehistry')"
|
||||
v-if="moonrakerDbNamespaces.includes('mainsail_gcodehistory')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.mainsail_macrogroups"
|
||||
:label="$t('Settings.GeneralTab.DbMacrogroups')"
|
||||
v-if="moonrakerDbNamespaces.includes('mainsail_macrogroups')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.mainsail_remoteprinters"
|
||||
:label="$t('Settings.GeneralTab.DbRemoteprinters')"
|
||||
v-if="moonrakerDbNamespaces.includes('mainsail_remoteprinters')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.webcams"
|
||||
:label="$t('Settings.GeneralTab.DbWebcams')"
|
||||
v-if="moonrakerDbNamespaces.includes('webcams')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.timelapse"
|
||||
:label="$t('Settings.GeneralTab.DbTimelapseSettings')"
|
||||
v-if="moonrakerDbNamespaces.includes('timelapse')"
|
||||
v-if="availableNamespaces.includes('timelapse')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('timelapse')"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
:label="$t('Settings.GeneralTab.DbWebcams')"
|
||||
v-if="availableNamespaces.includes('webcams')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('webcams')"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.history_jobs"
|
||||
:label="$t('Settings.GeneralTab.DbHistoryJobs')"
|
||||
v-if="moonrakerComponents.includes('history')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('history_jobs')"
|
||||
></v-checkbox>
|
||||
<v-checkbox
|
||||
v-model="dbCheckboxes.history_totals"
|
||||
:label="$t('Settings.GeneralTab.DbHistoryTotals')"
|
||||
v-if="moonrakerComponents.includes('history')"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
@change="changeNamespace('history_totals')"
|
||||
></v-checkbox>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -105,8 +137,8 @@
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
color="red"
|
||||
@click="resetMainsail"
|
||||
:loading="dialogResetMainsailLoading"
|
||||
@click="resetMainsailAction"
|
||||
:loading="loadings.includes('resetMainsail')"
|
||||
>
|
||||
{{ $t('Settings.GeneralTab.Reset') }}
|
||||
</v-btn>
|
||||
@@ -115,6 +147,44 @@
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogRestoreMainsail" persistent :width="360">
|
||||
<panel :title="$t('Settings.GeneralTab.Restore')" card-class="factory-reset-dialog" :margin-bottom="false" icon="mdi-help-circle">
|
||||
<template v-slot:buttons>
|
||||
<v-btn icon tile @click="dialogRestoreMainsail = false"><v-icon>mdi-close-thick</v-icon></v-btn>
|
||||
</template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col>
|
||||
<p class="mb-0">{{ $t('Settings.GeneralTab.RestoreDialog') }}</p>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="pl-6">
|
||||
<template v-for="db in restoreableNamespaces">
|
||||
<v-checkbox
|
||||
:label="db.label"
|
||||
hide-details
|
||||
class="mt-0"
|
||||
:key="db.name"
|
||||
@change="changeNamespace(db.name)"
|
||||
></v-checkbox>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
<v-col class="text-center">
|
||||
<v-btn
|
||||
color="red"
|
||||
@click="restoreDbAction"
|
||||
:loading="loadings.includes('restoreMainsail')"
|
||||
>
|
||||
{{ $t('Settings.GeneralTab.Restore') }}
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</panel>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -4,11 +4,11 @@
|
||||
<v-card-text v-if="showGeneral">
|
||||
<h3 class="text-h5 mb-3">{{ $t('Settings.MacrosTab.General') }}</h3>
|
||||
<settings-row :title="$t('Settings.MacrosTab.Management')">
|
||||
<v-select v-model="macroManagement" :items="macroManagements" outlined dense hide-details attach></v-select>
|
||||
<v-select v-model="mode" :items="modes" outlined dense hide-details attach></v-select>
|
||||
</settings-row>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
</v-card-text>
|
||||
<template v-if="macroManagement === 'expert'">
|
||||
<template v-if="mode === 'expert'">
|
||||
<settings-macros-tab-expert @update:showGeneral="updateShowGeneral" @scrollToTop="scrollToTop"></settings-macros-tab-expert>
|
||||
</template>
|
||||
<template v-else>
|
||||
@@ -30,7 +30,7 @@ import SettingsMacrosTabExpert from '@/components/settings/SettingsMacrosTabExpe
|
||||
export default class SettingsMacrosTab extends Mixins(BaseMixin) {
|
||||
private showGeneral = true
|
||||
|
||||
get macroManagements() {
|
||||
get modes() {
|
||||
return [
|
||||
{
|
||||
text: this.$t('Settings.MacrosTab.Simple'),
|
||||
@@ -43,12 +43,12 @@ export default class SettingsMacrosTab extends Mixins(BaseMixin) {
|
||||
]
|
||||
}
|
||||
|
||||
get macroManagement() {
|
||||
return this.$store.state.gui?.dashboard?.macroManagement ?? 'simple'
|
||||
get mode() {
|
||||
return this.$store.state.gui?.macros?.mode ?? 'simple'
|
||||
}
|
||||
|
||||
set macroManagement(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'dashboard.macroManagement', value: newVal })
|
||||
set mode(newVal) {
|
||||
this.$store.dispatch('gui/macros/saveSetting', { name: 'mode', value: newVal })
|
||||
}
|
||||
|
||||
updateShowGeneral(newVal: boolean) {
|
||||
|
||||
@@ -192,7 +192,7 @@ import draggable from 'vuedraggable'
|
||||
import SettingsRow from '@/components/settings/SettingsRow.vue'
|
||||
import {Debounce} from 'vue-debounce-decorator'
|
||||
import {PrinterStateMacro} from '@/store/printer/types'
|
||||
import {GuiMacrogroupsStateMacrogroup, GuiMacrogroupsStateMacrogroupMacro} from '@/store/gui/macrogroups/types'
|
||||
import {GuiMacrosStateMacrogroup, GuiMacrosStateMacrogroupMacro} from '@/store/gui/macros/types'
|
||||
|
||||
@Component({
|
||||
components: {SettingsRow, draggable}
|
||||
@@ -253,24 +253,24 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get availableMacros() {
|
||||
return this.allMacros.filter((m: GuiMacrogroupsStateMacrogroupMacro) => !this.editGroupUsedMacros.includes(m.name))
|
||||
return this.allMacros.filter((m: GuiMacrosStateMacrogroupMacro) => !this.editGroupUsedMacros.includes(m.name))
|
||||
}
|
||||
|
||||
get groups() {
|
||||
return this.$store.getters['gui/macrogroups/getAllMacrogroups'] ?? []
|
||||
return this.$store.getters['gui/macros/getAllMacrogroups'] ?? []
|
||||
}
|
||||
|
||||
get editGroupUsedMacros() {
|
||||
return this.editGroup?.macros?.map((m: GuiMacrogroupsStateMacrogroupMacro) => m.name) ?? []
|
||||
return this.editGroup?.macros?.map((m: GuiMacrosStateMacrogroupMacro) => m.name) ?? []
|
||||
}
|
||||
|
||||
get editGroup(): GuiMacrogroupsStateMacrogroup | null {
|
||||
return this.$store.getters['gui/macrogroups/getMacrogroup'](this.editGroupId)
|
||||
get editGroup(): GuiMacrosStateMacrogroup | null {
|
||||
return this.$store.getters['gui/macros/getMacrogroup'](this.editGroupId)
|
||||
}
|
||||
|
||||
get editGroupMacros() {
|
||||
const macros = this.editGroup?.macros ?? []
|
||||
macros.sort((a: GuiMacrogroupsStateMacrogroupMacro, b: GuiMacrogroupsStateMacrogroupMacro) => a.pos - b.pos)
|
||||
macros.sort((a: GuiMacrosStateMacrogroupMacro, b: GuiMacrosStateMacrogroupMacro) => a.pos - b.pos)
|
||||
|
||||
return macros
|
||||
}
|
||||
@@ -280,7 +280,7 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
existsGroupName(name: string) {
|
||||
return (this.groups.findIndex((group: GuiMacrogroupsStateMacrogroup) => group.name === name && group.id != this.editGroupId) >= 0)
|
||||
return (this.groups.findIndex((group: GuiMacrosStateMacrogroup) => group.name === name && group.id != this.editGroupId) >= 0)
|
||||
}
|
||||
|
||||
clearColorObject(color: any): string {
|
||||
@@ -304,29 +304,29 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
showInPause: true,
|
||||
showInPrinting: true,
|
||||
}
|
||||
this.editGroupId = await this.$store.dispatch('gui/macrogroups/store', { values })
|
||||
this.editGroupId = await this.$store.dispatch('gui/macros/groupStore', { values })
|
||||
|
||||
this.boolFormEdit = true
|
||||
}
|
||||
|
||||
editMacrogroup(group: GuiMacrogroupsStateMacrogroup) {
|
||||
editMacrogroup(group: GuiMacrosStateMacrogroup) {
|
||||
this.boolFormEdit = true
|
||||
this.editGroupId = group.id
|
||||
}
|
||||
|
||||
deleteMacrogroup(id: string) {
|
||||
this.$store.dispatch('gui/macrogroups/delete', id)
|
||||
this.$store.dispatch('gui/macros/groupDelete', id)
|
||||
}
|
||||
|
||||
addMacroToGroup(macro: PrinterStateMacro) {
|
||||
this.$store.dispatch('gui/macrogroups/addMacroToMacrogroup', {
|
||||
this.$store.dispatch('gui/macros/addMacroToMacrogroup', {
|
||||
id: this.editGroupId,
|
||||
macro: macro.name
|
||||
})
|
||||
}
|
||||
|
||||
updateMacroFromGroup(macro: GuiMacrogroupsStateMacrogroupMacro, option: string, value: boolean | string | number) {
|
||||
this.$store.dispatch('gui/macrogroups/updateMacroFromMacrogroup', {
|
||||
updateMacroFromGroup(macro: GuiMacrosStateMacrogroupMacro, option: string, value: boolean | string | number) {
|
||||
this.$store.dispatch('gui/macros/updateMacroFromMacrogroup', {
|
||||
id: this.editGroupId,
|
||||
macro: macro.name,
|
||||
option: option,
|
||||
@@ -344,7 +344,7 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
this.updateMacroFromGroup(this.editGroupMacros[newIndex], 'pos', oldPos)
|
||||
}
|
||||
|
||||
changeColorMacroFromGroup(macro: GuiMacrogroupsStateMacrogroupMacro) {
|
||||
changeColorMacroFromGroup(macro: GuiMacrosStateMacrogroupMacro) {
|
||||
let index = this.macroColors.findIndex((color) => color.value === macro.color) + 1
|
||||
const maxIndex = this.macroColors.length - 1
|
||||
|
||||
@@ -354,8 +354,8 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
this.updateMacroFromGroup(macro, 'color', newColor)
|
||||
}
|
||||
|
||||
removeMacroFromGroup(macro: GuiMacrogroupsStateMacrogroupMacro) {
|
||||
this.$store.dispatch('gui/macrogroups/removeMacroFromMacrogroup', {
|
||||
removeMacroFromGroup(macro: GuiMacrosStateMacrogroupMacro) {
|
||||
this.$store.dispatch('gui/macros/removeMacroFromMacrogroup', {
|
||||
id: this.editGroupId,
|
||||
macro: macro.name
|
||||
})
|
||||
@@ -376,7 +376,7 @@ export default class SettingsMacrosTabExpert extends Mixins(BaseMixin) {
|
||||
const values:any = {}
|
||||
values[option] = newVal
|
||||
|
||||
this.$store.dispatch('gui/macrogroups/update', {
|
||||
this.$store.dispatch('gui/macros/groupUpdate', {
|
||||
id: this.editGroupId,
|
||||
values
|
||||
})
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class SettingsMacrosTabSimple extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get hiddenMacros() {
|
||||
return this.$store.state.gui.dashboard.hiddenMacros ?? []
|
||||
return this.$store.state.gui.macros.hiddenMacros ?? []
|
||||
}
|
||||
|
||||
getMacroStatus(name: string) {
|
||||
@@ -49,7 +49,7 @@ export default class SettingsMacrosTabSimple extends Mixins(BaseMixin) {
|
||||
else
|
||||
hiddenMacros.push(name.toUpperCase())
|
||||
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'dashboard.hiddenMacros', value: hiddenMacros })
|
||||
this.$store.dispatch('gui/macros/saveSetting', { name: 'hiddenMacros', value: hiddenMacros })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -306,7 +306,7 @@ export default class SettingsPresetsTab extends Mixins(BaseMixin) {
|
||||
|
||||
saveCooldown() {
|
||||
if (this.cooldownForm.valid) {
|
||||
this.$store.dispatch('gui/presets/updateCooldownGcode', this.cooldownForm.gcode)
|
||||
this.$store.dispatch('gui/presets/saveSetting', { name: 'cooldownGcode', value: this.cooldownForm.gcode })
|
||||
this.cooldownForm.bool = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,95 +115,95 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
|
||||
private defaultPrimaryColor = defaultPrimaryColor
|
||||
|
||||
get logoColor() {
|
||||
return this.$store.state.gui.theme.logo
|
||||
return this.$store.state.gui.uiSettings.logo
|
||||
}
|
||||
|
||||
set logoColor(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'theme.logo', value: newVal})
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.logo', value: newVal})
|
||||
}
|
||||
|
||||
get primaryColor() {
|
||||
return this.$store.state.gui.theme.primary
|
||||
return this.$store.state.gui.uiSettings.primary
|
||||
}
|
||||
|
||||
set primaryColor(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'theme.primary', value: newVal})
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.primary', value: newVal})
|
||||
}
|
||||
|
||||
get boolBigThumbnail() {
|
||||
return this.$store.state.gui.dashboard.boolBigThumbnail
|
||||
return this.$store.state.gui.uiSettings.boolBigThumbnail
|
||||
}
|
||||
|
||||
set boolBigThumbnail(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'dashboard.boolBigThumbnail', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.boolBigThumbnail', value: newVal })
|
||||
}
|
||||
|
||||
get boolWebcamInNavigation() {
|
||||
return this.$store.state.gui.webcamSettings.boolNavi ?? false
|
||||
return this.$store.state.gui.uiSettings.boolWebcamNavi ?? false
|
||||
}
|
||||
|
||||
set boolWebcamInNavigation(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'webcamSettings.boolNavi', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.boolWebcamNavi', value: newVal })
|
||||
}
|
||||
|
||||
get displayCancelPrint() {
|
||||
return this.$store.state.gui.general.displayCancelPrint
|
||||
return this.$store.state.gui.uiSettings.displayCancelPrint
|
||||
}
|
||||
|
||||
set displayCancelPrint(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.displayCancelPrint', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.displayCancelPrint', value: newVal })
|
||||
}
|
||||
|
||||
get displayZOffsetStandby() {
|
||||
return this.$store.state.gui.general.displayZOffsetStandby
|
||||
return this.$store.state.gui.uiSettings.displayZOffsetStandby
|
||||
}
|
||||
|
||||
set displayZOffsetStandby(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.displayZOffsetStandby', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.displayZOffsetStandby', value: newVal })
|
||||
}
|
||||
|
||||
get confirmOnEmergencyStop() {
|
||||
return this.$store.state.gui.general.confirmOnEmergencyStop
|
||||
return this.$store.state.gui.uiSettings.confirmOnEmergencyStop
|
||||
}
|
||||
|
||||
set confirmOnEmergencyStop(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.confirmOnEmergencyStop', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.confirmOnEmergencyStop', value: newVal })
|
||||
}
|
||||
|
||||
get confirmOnPowerDeviceChange() {
|
||||
return this.$store.state.gui.general.confirmOnPowerDeviceChange
|
||||
return this.$store.state.gui.uiSettings.confirmOnPowerDeviceChange
|
||||
}
|
||||
|
||||
set confirmOnPowerDeviceChange(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.confirmOnPowerDeviceChange', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.confirmOnPowerDeviceChange', value: newVal })
|
||||
}
|
||||
|
||||
get lockSliders() {
|
||||
return this.$store.state.gui.general.lockSlidersOnTouchDevices
|
||||
return this.$store.state.gui.uiSettings.lockSlidersOnTouchDevices
|
||||
}
|
||||
|
||||
set lockSliders(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'general.lockSlidersOnTouchDevices', value: newVal})
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.lockSlidersOnTouchDevices', value: newVal})
|
||||
}
|
||||
|
||||
get lockSlidersDelay() {
|
||||
return this.$store.state.gui.general.lockSlidersDelay
|
||||
return this.$store.state.gui.uiSettings.lockSlidersDelay
|
||||
}
|
||||
|
||||
set lockSlidersDelay(newVal) {
|
||||
(newVal >= 0) ? this.$store.dispatch('gui/saveSetting', {name: 'general.lockSlidersDelay', value: newVal}) : {}
|
||||
(newVal >= 0) ? this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.lockSlidersDelay', value: newVal}) : {}
|
||||
}
|
||||
|
||||
get boolWideNavDrawer() {
|
||||
return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false
|
||||
return this.$store.state.gui.uiSettings.boolWideNavDrawer ?? false
|
||||
}
|
||||
|
||||
get navigationStyleSetting() {
|
||||
return this.$store.state.gui.dashboard.navigationStyle
|
||||
return this.$store.state.gui.uiSettings.navigationStyle
|
||||
}
|
||||
|
||||
set navigationStyleSetting(newVal) {
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'dashboard.navigationStyle', value: newVal })
|
||||
this.$store.dispatch('gui/saveSetting', {name: 'uiSettings.navigationStyle', value: newVal })
|
||||
}
|
||||
|
||||
get navigationStyles() {
|
||||
@@ -220,7 +220,7 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get boolHideUploadAndPrintButton() {
|
||||
return this.$store.state.gui.dashboard.boolHideUploadAndPrintButton ?? false
|
||||
return this.$store.state.gui.uiSettings.boolHideUploadAndPrintButton ?? false
|
||||
}
|
||||
|
||||
set boolHideUploadAndPrintButton(newVal) {
|
||||
|
||||
+10
-6
@@ -605,15 +605,18 @@
|
||||
"FactoryReset": "Factory reset",
|
||||
"FactoryDialog": "Please select all the sections you want to reset:",
|
||||
"Reset": "reset",
|
||||
"DbGeneral": "General",
|
||||
"DbPresets": "Presets",
|
||||
"DbGcodehistry": "G-Code History",
|
||||
"DbMacrogroups": "Macrogroups",
|
||||
"DbRemoteprinters": "Remoteprinters",
|
||||
"DbConsoleHistory": "Console History",
|
||||
"DbView": "View Settings",
|
||||
"DbHistoryJobs": "History Jobs",
|
||||
"DbHistoryTotals": "History Totals",
|
||||
"DbWebcams": "Webcams",
|
||||
"DbTimelapseSettings": "Timelapse Settings"
|
||||
"DbTimelapseSettings": "Timelapse Settings",
|
||||
"MoonrakerDb": "Moonraker DB",
|
||||
"Backup": "Backup",
|
||||
"BackupDialog": "Please select all the sections you want to create a backup:",
|
||||
"Restore": "Restore",
|
||||
"CannotReadJson": "Cannot read/parse backup file.",
|
||||
"RestoreDialog": "Please select all the sections you want to restore:"
|
||||
},
|
||||
"WebcamsTab": {
|
||||
"Webcams": "Webcams",
|
||||
@@ -724,6 +727,7 @@
|
||||
"Management": "Management",
|
||||
"Simple": "Simple",
|
||||
"Expert": "Expert",
|
||||
"Group": "Group",
|
||||
"NoGroups": "No group found...",
|
||||
"Macrogroups": "Groups",
|
||||
"EditGroup": "Edit Group",
|
||||
|
||||
@@ -150,7 +150,7 @@ export default class PageConsole extends Mixins(BaseMixin) {
|
||||
}
|
||||
|
||||
get lastCommands(): string[] {
|
||||
return this.$store.state.gui.gcodehistory.history ?? []
|
||||
return this.$store.state.gui.gcodehistory.entries ?? []
|
||||
}
|
||||
|
||||
commandClick(msg: string): void {
|
||||
|
||||
@@ -97,7 +97,7 @@ export default class PageDashboard extends Mixins(DashboardMixin) {
|
||||
get mobileLayout() {
|
||||
let panels = this.$store.getters['gui/getPanels']('mobileLayout')
|
||||
panels = panels.concat(this.missingPanelsMobile)
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -105,14 +105,14 @@ export default class PageDashboard extends Mixins(DashboardMixin) {
|
||||
get tabletLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('tabletLayout1')
|
||||
panels = panels.concat(this.missingPanelsTablet)
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
get tabletLayout2() {
|
||||
let panels = this.$store.getters['gui/getPanels']('tabletLayout2')
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -120,14 +120,14 @@ export default class PageDashboard extends Mixins(DashboardMixin) {
|
||||
get desktopLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('desktopLayout1')
|
||||
panels = panels.concat(this.missingPanelsDesktop)
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
get desktopLayout2() {
|
||||
let panels = this.$store.getters['gui/getPanels']('desktopLayout2')
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
@@ -135,21 +135,21 @@ export default class PageDashboard extends Mixins(DashboardMixin) {
|
||||
get widescreenLayout1() {
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout1')
|
||||
panels = panels.concat(this.missingPanelsWidescreen)
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
get widescreenLayout2() {
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout2')
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
get widescreenLayout3() {
|
||||
let panels = this.$store.getters['gui/getPanels']('widescreenLayout3')
|
||||
panels = panels.filter((element: any) => element.visable)
|
||||
panels = panels.filter((element: any) => element.visible)
|
||||
|
||||
return panels
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export const getters: GetterTree<FarmPrinterState, any> = {
|
||||
},
|
||||
|
||||
getLogoColor: (state) => {
|
||||
return state.data.gui?.theme?.logo ?? defaultLogoColor
|
||||
return state.data.gui?.uiSettings?.logo ?? defaultLogoColor
|
||||
},
|
||||
|
||||
getStatus: (state, getters) => {
|
||||
|
||||
+231
-137
@@ -3,10 +3,16 @@ import {ActionTree} from 'vuex'
|
||||
import {GuiState} from '@/store/gui/types'
|
||||
import {RootState} from '@/store/types'
|
||||
import { getDefaultState } from './index'
|
||||
import {themeDir} from '@/store/variables'
|
||||
|
||||
export const actions: ActionTree<GuiState, RootState> = {
|
||||
reset({ commit }) {
|
||||
reset({ commit, dispatch }) {
|
||||
commit('reset')
|
||||
|
||||
dispatch('console/reset')
|
||||
dispatch('gcodehistory/reset')
|
||||
dispatch('macros/reset')
|
||||
dispatch('presets/reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
@@ -15,107 +21,73 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
},
|
||||
|
||||
initStore({ commit, dispatch, rootState }, payload) {
|
||||
|
||||
//added in V2.1.0
|
||||
if (
|
||||
payload.value.dashboard?.control !== undefined &&
|
||||
'useCross' in payload.value.dashboard?.control
|
||||
) {
|
||||
dispatch('saveSetting', { name: 'dashboard.control.style', value: 'cross' })
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'dashboard.control.useCross' })
|
||||
delete payload.value.dashboard?.control.useCross
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.webcam) {
|
||||
window.console.debug('convert old webcams')
|
||||
|
||||
if (payload.value.webcam.configs && payload.value.webcam.configs.length) {
|
||||
payload.value.webcam.configs.forEach((oldWebcam: any) => {
|
||||
const newWebcam = {...oldWebcam, urlStream: oldWebcam.url, urlSnapshot: oldWebcam.url.replace('action=stream', 'action=snapshot')}
|
||||
delete newWebcam.url
|
||||
dispatch('webcam/store', { values: newWebcam })
|
||||
})
|
||||
}
|
||||
|
||||
commit('saveSetting', { name: 'webcamSettings.boolNavi', value: payload.value.webcam.boolNavi })
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'webcam' })
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.presets) {
|
||||
window.console.debug('convert old presets')
|
||||
|
||||
if (payload.value.presets && payload.value.presets.length) {
|
||||
payload.value.presets.forEach((oldPreset: any) => {
|
||||
dispatch('presets/store', { values: oldPreset })
|
||||
})
|
||||
|
||||
delete payload.value.presets
|
||||
}
|
||||
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'presets' })
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.cooldownGcode) {
|
||||
window.console.debug('convert old cooldownGcode')
|
||||
|
||||
dispatch('presets/updateCooldownGcode', payload.value.cooldownGcode)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'cooldownGcode' })
|
||||
delete payload.value.cooldownGcode
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.console?.customFilters) {
|
||||
window.console.debug('convert old consolefilters')
|
||||
|
||||
if (payload.value.console.customFilters && payload.value.console.customFilters.length) {
|
||||
payload.value.console.customFilters.forEach((oldFilter: any) => {
|
||||
dispatch('consolefilters/store', {values: oldFilter})
|
||||
})
|
||||
}
|
||||
|
||||
delete payload.value.console.customFilters
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'console.customFilters' })
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.remote_printers) {
|
||||
if (!rootState.socket?.remoteMode) {
|
||||
window.console.debug('convert old remotePrinters')
|
||||
|
||||
payload.value.remote_printers.forEach((printer: any) => {
|
||||
const values = {
|
||||
hostname: printer.hostname ?? '',
|
||||
port: printer.port ?? 7125,
|
||||
settings: printer.settings ?? {},
|
||||
}
|
||||
dispatch('remoteprinters/store', { values })
|
||||
})
|
||||
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'remote_printers' })
|
||||
}
|
||||
|
||||
delete payload.value.remote_printers
|
||||
}
|
||||
|
||||
//added in V2.1.0
|
||||
if (payload.value.dashboard?.macrogroups) {
|
||||
window.console.debug('convert old macrogroups')
|
||||
|
||||
payload.value.dashboard?.macrogroups.forEach((macrogroup: any) => {
|
||||
dispatch('macrogroups/store', { values: macrogroup })
|
||||
})
|
||||
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'dashboard.macrogroups' })
|
||||
|
||||
delete payload.value.dashboard.macrogroups
|
||||
if ('remoteprinters' in payload.value) {
|
||||
if (!rootState.socket?.remoteMode) dispatch('remoteprinters/initStore', payload.value.remoteprinters.printers)
|
||||
delete payload.value.remoteprinters
|
||||
}
|
||||
|
||||
commit('setData', payload.value)
|
||||
},
|
||||
|
||||
/*
|
||||
* Create mainsail namespace in moonraker DB and fill in default values
|
||||
*/
|
||||
async initDb({ dispatch, rootGetters }) {
|
||||
const baseUrl = rootGetters['socket/getUrl'] + '/server/database/item'
|
||||
|
||||
const urlDefault = rootGetters['socket/getUrl'] + '/server/files/config/' + themeDir + '/default.json?time=' + Date.now()
|
||||
const responseDefault = await fetch(urlDefault)
|
||||
let defaults: any = {}
|
||||
if (responseDefault) {
|
||||
defaults = await responseDefault.json()
|
||||
if (defaults.error?.code === 404) defaults = {}
|
||||
}
|
||||
|
||||
for (const key in defaults) {
|
||||
if (['webcams', 'timelapse'].includes(key)) {
|
||||
for (const key2 of defaults[key]) {
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: key,
|
||||
key: key2,
|
||||
value: defaults[key][key2]
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: 'mainsail',
|
||||
key: key,
|
||||
value: defaults[key]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: 'mainsail',
|
||||
key: 'initVersion',
|
||||
value: rootGetters['getVersion']
|
||||
})
|
||||
})
|
||||
|
||||
dispatch('init')
|
||||
},
|
||||
|
||||
saveSetting({ commit }, payload) {
|
||||
commit('saveSetting', payload)
|
||||
|
||||
@@ -139,7 +111,7 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
commit('setGcodefilesMetadata', data)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'gcodefiles',
|
||||
newVal: state.gcodefiles
|
||||
newVal: state.view.gcodefiles
|
||||
})
|
||||
},
|
||||
|
||||
@@ -147,7 +119,7 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
commit('setGcodefilesShowHiddenFiles', data)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'gcodefiles',
|
||||
newVal: state.gcodefiles
|
||||
newVal: state.view.gcodefiles
|
||||
})
|
||||
},
|
||||
|
||||
@@ -155,66 +127,188 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
commit('setCurrentWebcam', payload)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'webcamSettings.currentCam',
|
||||
newVal: state.webcamSettings.currentCam
|
||||
newVal: state.view.webcam.currentCam
|
||||
})
|
||||
},
|
||||
|
||||
setTempchartDatasetAdditionalSensorSetting({ commit, dispatch, state }, payload) {
|
||||
commit('setTempchartDatasetAdditionalSensorSetting', payload)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'tempchart',
|
||||
newVal: state.tempchart
|
||||
keyName: 'view.tempchart',
|
||||
newVal: state.view.tempchart
|
||||
})
|
||||
},
|
||||
|
||||
async resetMoonrakerDB({ commit, dispatch }, payload) {
|
||||
await commit('setResetDatabases', payload)
|
||||
dispatch('resetMoonrakerDbLoop')
|
||||
},
|
||||
async resetMoonrakerDB({ commit, dispatch, rootGetters }, payload) {
|
||||
const baseUrl = rootGetters['socket/getUrl'] + '/server/database/item'
|
||||
|
||||
async resetMoonrakerDbLoop({ state, commit }) {
|
||||
if (state.resetDatabases.length) {
|
||||
const namespace = state.resetDatabases[0]
|
||||
|
||||
if (namespace.startsWith('mainsail') || ['webcams', 'timelapse'].includes(namespace)) {
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: namespace }, { action: 'gui/resetMoonrakerDbLoopItems' })
|
||||
} else if (namespace === 'history_jobs') {
|
||||
Vue.$socket.emit('server.history.delete_job', { all: true }, { action: 'gui/resetMoonrakerDbLoopItems' })
|
||||
} else if (namespace === 'history_totals') {
|
||||
Vue.$socket.emit('server.history.reset_totals', { }, { action: 'gui/resetMoonrakerDbLoopItems' })
|
||||
}
|
||||
|
||||
await commit('removeResetDatabase', namespace)
|
||||
} else window.location.reload()
|
||||
},
|
||||
|
||||
resetMoonrakerDbLoopItems({ dispatch }, payload) {
|
||||
if ('value' in payload && Object.keys(payload.value).length) {
|
||||
Object.keys(payload.value).forEach(key => {
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: payload.namespace, key: key })
|
||||
})
|
||||
const urlDefault = rootGetters['socket/getUrl'] + '/server/files/config/' + themeDir + '/default.json?time=' + Date.now()
|
||||
const responseDefault = await fetch(urlDefault)
|
||||
let defaults: any = {}
|
||||
if (responseDefault) {
|
||||
defaults = await responseDefault.json()
|
||||
if (defaults.error?.code === 404) defaults = {}
|
||||
}
|
||||
|
||||
dispatch('resetMoonrakerDbLoop')
|
||||
for (const key of payload) {
|
||||
if (['webcams', 'timelapse'].includes(key)) {
|
||||
const url = baseUrl + '?namespace=' + key
|
||||
|
||||
const response = await fetch(url)
|
||||
const objects = await response.json()
|
||||
if (objects?.result?.value) {
|
||||
for (const item of Object.keys(objects?.result?.value)) {
|
||||
await fetch(url+'&key='+item, { method: 'DELETE' })
|
||||
}
|
||||
}
|
||||
|
||||
if (key in defaults) {
|
||||
for (const key2 of defaults[key]) {
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: key,
|
||||
key: key2,
|
||||
value: defaults[key][key2]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (key === 'history_jobs') {
|
||||
await fetch(rootGetters['socket/getUrl'] + '/server/history/job?all=true', { method: 'DELETE' })
|
||||
} else if (key === 'history_totals') {
|
||||
await fetch(rootGetters['socket/getUrl'] + '/server/history/reset_totals', { method: 'POST' })
|
||||
} else {
|
||||
await fetch(rootGetters['socket/getUrl'] + '/server/database/item?namespace=mainsail&key=' + key, { method: 'DELETE' })
|
||||
|
||||
if (key in defaults) {
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: 'mainsail',
|
||||
key: key,
|
||||
value: defaults[key]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.location.reload()
|
||||
},
|
||||
|
||||
async backupMoonrakerDB({ commit, dispatch, rootGetters }, payload) {
|
||||
const backup: any = {}
|
||||
|
||||
const responseMainsail = await fetch(rootGetters['socket/getUrl'] + '/server/database/item?namespace=mainsail')
|
||||
const objectsMainsail = await responseMainsail.json()
|
||||
const mainsailDb = objectsMainsail?.result?.value ?? {}
|
||||
|
||||
for (const key of payload) {
|
||||
if (['timelapse', 'webcams'].includes(key)) {
|
||||
const url = rootGetters['socket/getUrl'] + '/server/database/item?namespace=' + key
|
||||
|
||||
const response = await fetch(url)
|
||||
const objects = await response.json()
|
||||
if (objects?.result?.value) backup[key] = {...objects?.result?.value}
|
||||
} else if (key in mainsailDb) {
|
||||
backup[key] = {...mainsailDb[key]}
|
||||
}
|
||||
}
|
||||
|
||||
const element = document.createElement('a')
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(backup)))
|
||||
element.setAttribute('download', 'backup-mainsail.json')
|
||||
element.style.display = 'none'
|
||||
document.body.appendChild(element)
|
||||
element.click()
|
||||
|
||||
document.body.removeChild(element)
|
||||
},
|
||||
|
||||
async restoreMoonrakerDB({ rootGetters }, payload) {
|
||||
const baseUrl = rootGetters['socket/getUrl'] + '/server/database/item'
|
||||
const mainsailUrl = baseUrl + '?namespace=mainsail'
|
||||
const responseNamespaces = await fetch(rootGetters['socket/getUrl'] + '/server/database/list')
|
||||
const objectsNamespaces = await responseNamespaces.json()
|
||||
const namespacesArray = objectsNamespaces?.result?.namespaces ?? []
|
||||
let mainsailArray: string[] = []
|
||||
|
||||
if (namespacesArray.includes('mainsail')) {
|
||||
const responseMainsail = await fetch(mainsailUrl)
|
||||
const objectsMainsail = await responseMainsail.json()
|
||||
mainsailArray = Object.keys(objectsMainsail?.result?.value ?? {})
|
||||
}
|
||||
|
||||
for (const key of payload.dbCheckboxes) {
|
||||
if (['timelapse', 'webcams'].includes(key)) {
|
||||
if (namespacesArray.includes(key)) {
|
||||
const url = baseUrl + '?namespace=' + key
|
||||
const response = await fetch(url)
|
||||
const objects = await response.json()
|
||||
if (objects?.result?.value) {
|
||||
for (const item of Object.keys(objects?.result?.value)) {
|
||||
await fetch(url + '&key=' + item, {method: 'DELETE'})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const key2 of Object.keys(payload.restoreObjects[key])) {
|
||||
const value = payload.restoreObjects[key][key2]
|
||||
await fetch(baseUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: key,
|
||||
key: key2,
|
||||
value
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (mainsailArray.includes(key)) await fetch(mainsailUrl+'&key='+key, { method: 'DELETE' })
|
||||
await fetch(mainsailUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
namespace: 'mainsail',
|
||||
key,
|
||||
value: payload.restoreObjects[key]
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
window.location.reload()
|
||||
},
|
||||
|
||||
setHistoryColumns({ commit, dispatch, state }, data) {
|
||||
commit('setHistoryColumns', data)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'history',
|
||||
newVal: state.history
|
||||
keyName: 'view.history',
|
||||
newVal: state.view.history
|
||||
})
|
||||
},
|
||||
|
||||
hideStatusInHistoryList({ commit, dispatch, state }, name) {
|
||||
const array: string[] = [...state.history.hidePrintStatus]
|
||||
const array: string[] = [...state.view.history.hidePrintStatus]
|
||||
|
||||
if (!array.includes(name)) {
|
||||
array.push(name)
|
||||
commit('setHistoryHidePrintStatus', array)
|
||||
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'history.hidePrintStatus',
|
||||
keyName: 'view.history.hidePrintStatus',
|
||||
newVal: array
|
||||
})
|
||||
}
|
||||
@@ -231,7 +325,7 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
},
|
||||
|
||||
showStatusInHistoryList({ commit, dispatch, state }, name) {
|
||||
const array: string[] = [...state.history.hidePrintStatus]
|
||||
const array: string[] = [...state.view.history.hidePrintStatus]
|
||||
|
||||
const index = array.indexOf(name)
|
||||
if (index !== -1) {
|
||||
@@ -239,7 +333,7 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
commit('setHistoryHidePrintStatus', array)
|
||||
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'history.hidePrintStatus',
|
||||
keyName: 'view.history.hidePrintStatus',
|
||||
newVal: array
|
||||
})
|
||||
}
|
||||
@@ -247,7 +341,7 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
|
||||
resetLayout({ dispatch }, name) {
|
||||
const defaultState = getDefaultState()
|
||||
// eslint-disable-next-line
|
||||
// @ts-ignore
|
||||
const newVal: any = defaultState.dashboard[name] ?? []
|
||||
|
||||
dispatch('saveSetting', {
|
||||
@@ -259,8 +353,8 @@ export const actions: ActionTree<GuiState, RootState> = {
|
||||
toggleHideUploadAndPrintBtn({commit, dispatch, state}, payload) {
|
||||
commit('toggleHideUploadAndPrintBtn', payload)
|
||||
dispatch('updateSettings', {
|
||||
keyName: 'dashboard.boolHideUploadAndPrintButton',
|
||||
newVal: state.dashboard.boolHideUploadAndPrintButton
|
||||
keyName: 'uiSettings.boolHideUploadAndPrintButton',
|
||||
newVal: state.uiSettings.boolHideUploadAndPrintButton
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { ActionTree } from 'vuex'
|
||||
import {RootState} from '@/store/types'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import Vue from 'vue'
|
||||
import {GuiConsoleState} from '@/store/gui/console/types'
|
||||
|
||||
export const actions: ActionTree<GuiConsoleState, RootState> = {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
saveSetting({ dispatch }, payload) {
|
||||
dispatch('gui/saveSetting', {
|
||||
name: 'console.'+payload.name,
|
||||
value: payload.value
|
||||
}, { root: true })
|
||||
},
|
||||
|
||||
filterUpload(_, payload) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail', key: 'console.consolefilters.'+payload.id, value: payload.value })
|
||||
},
|
||||
|
||||
filterStore({ commit, dispatch, state }, payload) {
|
||||
const id = uuidv4()
|
||||
|
||||
commit('filterStore', { id, values: payload.values })
|
||||
dispatch('filterUpload', {
|
||||
id,
|
||||
value: state.consolefilters[id]
|
||||
})
|
||||
},
|
||||
|
||||
filterUpdate({ commit, dispatch, state }, payload) {
|
||||
commit('filterUpdate', payload)
|
||||
dispatch('filterUpload', {
|
||||
id: payload.id,
|
||||
value: state.consolefilters[payload.id]
|
||||
})
|
||||
},
|
||||
|
||||
filterDelete({ commit }, payload) {
|
||||
commit('filterDelete', payload)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'console.consolefilters.'+payload })
|
||||
},
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import { GetterTree } from 'vuex'
|
||||
import {GuiConsolefiltersState, GuiConsolefiltersStateFilter} from '@/store/gui/consolefilters/types'
|
||||
import {GuiConsoleState, GuiConsoleStateFilter} from '@/store/gui/console/types'
|
||||
import {caseInsensitiveSort} from '@/plugins/helpers'
|
||||
import {timelapseConsoleFilters} from '@/store/variables'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const getters: GetterTree<GuiConsolefiltersState, any> = {
|
||||
export const getters: GetterTree<GuiConsoleState, any> = {
|
||||
|
||||
getConsolefilters:(state) => {
|
||||
const consolefilters: GuiConsolefiltersStateFilter[] = []
|
||||
const consolefilters: GuiConsoleStateFilter[] = []
|
||||
|
||||
Object.keys(state.consolefilters).forEach((id: string) => {
|
||||
consolefilters.push({...state.consolefilters[id], id})
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Module } from 'vuex'
|
||||
import { actions } from '@/store/gui/console/actions'
|
||||
import { mutations } from '@/store/gui/console/mutations'
|
||||
import { getters } from '@/store/gui/console/getters'
|
||||
import {GuiConsoleState} from '@/store/gui/console/types'
|
||||
|
||||
export const getDefaultState = (): GuiConsoleState => {
|
||||
return {
|
||||
hideWaitTemperatures: true,
|
||||
hideTlCommands: true,
|
||||
direction: 'table',
|
||||
entryStyle: 'default',
|
||||
height: 300,
|
||||
consolefilters: {},
|
||||
}
|
||||
}
|
||||
|
||||
// initial state
|
||||
const state = getDefaultState()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const console: Module<GuiConsoleState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
import { getDefaultState } from './index'
|
||||
import {MutationTree} from 'vuex'
|
||||
import Vue from 'vue'
|
||||
import {GuiConsolefiltersState} from '@/store/gui/consolefilters/types'
|
||||
import {GuiConsoleState} from '@/store/gui/console/types'
|
||||
|
||||
export const mutations: MutationTree<GuiConsolefiltersState> = {
|
||||
export const mutations: MutationTree<GuiConsoleState> = {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
initStore(state, payload) {
|
||||
Vue.set(state, 'consolefilters', payload.value)
|
||||
},
|
||||
|
||||
store(state, payload) {
|
||||
filterStore(state, payload) {
|
||||
Vue.set(state.consolefilters, payload.id, payload.values)
|
||||
},
|
||||
|
||||
update(state, payload) {
|
||||
filterUpdate(state, payload) {
|
||||
if (payload.id in state.consolefilters) {
|
||||
const preset = {...state.consolefilters[payload.id]}
|
||||
Object.assign(preset, payload.values)
|
||||
@@ -25,7 +21,7 @@ export const mutations: MutationTree<GuiConsolefiltersState> = {
|
||||
}
|
||||
},
|
||||
|
||||
delete(state, payload) {
|
||||
filterDelete(state, payload) {
|
||||
if (payload in state.consolefilters) {
|
||||
Vue.delete(state.consolefilters, payload)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
export interface GuiConsoleState {
|
||||
hideWaitTemperatures: boolean
|
||||
hideTlCommands: boolean
|
||||
direction: 'table' | 'shell'
|
||||
entryStyle: 'default' | 'compact'
|
||||
height: number
|
||||
consolefilters: {
|
||||
[key: string]: GuiConsoleStateFilter
|
||||
}
|
||||
}
|
||||
|
||||
export interface GuiConsoleStateFilter {
|
||||
id?: string | null
|
||||
bool: boolean
|
||||
name: string
|
||||
regex: string
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import { ActionTree } from 'vuex'
|
||||
import {RootState} from '@/store/types'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import Vue from 'vue'
|
||||
import {GuiConsolefiltersState} from '@/store/gui/consolefilters/types'
|
||||
|
||||
export const actions: ActionTree<GuiConsolefiltersState, RootState> = {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
window.console.debug('init gui/consolefilters')
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: 'mainsail_consolefilters' }, { action: 'gui/consolefilters/initStore' })
|
||||
},
|
||||
|
||||
initStore({ commit }, payload) {
|
||||
commit('reset')
|
||||
commit('initStore', payload)
|
||||
},
|
||||
|
||||
upload(_, payload) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail_consolefilters', key: payload.id, value: payload.value })
|
||||
},
|
||||
|
||||
store({ commit, dispatch, state }, payload) {
|
||||
const id = uuidv4()
|
||||
|
||||
commit('store', { id, values: payload.values })
|
||||
dispatch('upload', {
|
||||
id,
|
||||
value: state.consolefilters[id]
|
||||
})
|
||||
},
|
||||
|
||||
update({ commit, dispatch, state }, payload) {
|
||||
commit('update', payload)
|
||||
dispatch('upload', {
|
||||
id: payload.id,
|
||||
value: state.consolefilters[payload.id]
|
||||
})
|
||||
},
|
||||
|
||||
delete({ commit }, payload) {
|
||||
commit('delete', payload)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail_consolefilters', key: payload })
|
||||
},
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Module } from 'vuex'
|
||||
import { actions } from '@/store/gui/consolefilters/actions'
|
||||
import { mutations } from '@/store/gui/consolefilters/mutations'
|
||||
import { getters } from '@/store/gui/consolefilters/getters'
|
||||
import {GuiConsolefiltersState} from '@/store/gui/consolefilters/types'
|
||||
|
||||
export const getDefaultState = (): GuiConsolefiltersState => {
|
||||
return {
|
||||
consolefilters: {},
|
||||
}
|
||||
}
|
||||
|
||||
// initial state
|
||||
const state = getDefaultState()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const consolefilters: Module<GuiConsolefiltersState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
export interface GuiConsolefiltersState {
|
||||
consolefilters: {
|
||||
[key: string]: GuiConsolefiltersStateFilter
|
||||
}
|
||||
}
|
||||
|
||||
export interface GuiConsolefiltersStateFilter {
|
||||
id?: string | null
|
||||
bool: boolean
|
||||
name: string
|
||||
regex: string
|
||||
}
|
||||
@@ -9,22 +9,12 @@ export const actions: ActionTree<GuiGcodehistoryState, RootState> = {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
window.console.debug('init gui/gcodehistory')
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: 'mainsail_gcodehistory' }, { action: 'gui/gcodehistory/initStore' })
|
||||
},
|
||||
|
||||
initStore({ commit }, payload) {
|
||||
commit('reset')
|
||||
commit('initStore', payload)
|
||||
},
|
||||
|
||||
upload({ state }) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail_gcodehistory', key: 'history', value: state.history })
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail', key: 'gcodehistory.entries', value: state.entries })
|
||||
},
|
||||
|
||||
async addToHistory({ commit, dispatch, state }, payload) {
|
||||
const newHistory = [...state.history]
|
||||
const newHistory = [...state.entries]
|
||||
newHistory.push(payload)
|
||||
|
||||
while (newHistory.length > maxGcodeHistory) newHistory.splice(0, 1)
|
||||
|
||||
@@ -6,7 +6,7 @@ import {GuiGcodehistoryState} from '@/store/gui/gcodehistory/types'
|
||||
|
||||
export const getDefaultState = (): GuiGcodehistoryState => {
|
||||
return {
|
||||
history: [],
|
||||
entries: [],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,7 @@ export const mutations: MutationTree<GuiGcodehistoryState> = {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
initStore(state, payload) {
|
||||
Vue.set(state, 'history', payload.value?.history)
|
||||
},
|
||||
|
||||
updateHistory(state, payload) {
|
||||
Vue.set(state, 'history', payload)
|
||||
Vue.set(state, 'entries', payload)
|
||||
},
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
export interface GuiGcodehistoryState {
|
||||
history: string[]
|
||||
entries: string[]
|
||||
}
|
||||
+14
-13
@@ -1,25 +1,25 @@
|
||||
import {GetterTree} from 'vuex'
|
||||
import {GuiState} from '@/store/gui/types'
|
||||
import {GuiMacrogroupsStateMacrogroup} from '@/store/gui/macrogroups/types'
|
||||
import {GuiMacrosStateMacrogroup} from '@/store/gui/macros/types'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const getters: GetterTree<GuiState, any> = {
|
||||
|
||||
getDatasetValue: (state) => (payload: { name: string, type: string }) => {
|
||||
if (
|
||||
payload.name in state.tempchart.datasetSettings &&
|
||||
payload.type in state.tempchart.datasetSettings[payload.name]
|
||||
) return state.tempchart.datasetSettings[payload.name][payload.type]
|
||||
payload.name in state.view.tempchart.datasetSettings &&
|
||||
payload.type in state.view.tempchart.datasetSettings[payload.name]
|
||||
) return state.view.tempchart.datasetSettings[payload.name][payload.type]
|
||||
|
||||
return ['temperature', 'target'].includes(payload.type)
|
||||
},
|
||||
|
||||
getDatasetAdditionalSensorValue: (state) => (payload: { name: string, sensor: string }) => {
|
||||
if (
|
||||
payload.name in state.tempchart.datasetSettings &&
|
||||
'additionalSensors' in state.tempchart.datasetSettings[payload.name] &&
|
||||
payload.sensor in state.tempchart.datasetSettings[payload.name].additionalSensors
|
||||
) return state.tempchart.datasetSettings[payload.name].additionalSensors[payload.sensor]
|
||||
payload.name in state.view.tempchart.datasetSettings &&
|
||||
'additionalSensors' in state.view.tempchart.datasetSettings[payload.name] &&
|
||||
payload.sensor in state.view.tempchart.datasetSettings[payload.name].additionalSensors
|
||||
) return state.view.tempchart.datasetSettings[payload.name].additionalSensors[payload.sensor]
|
||||
|
||||
return true
|
||||
},
|
||||
@@ -28,19 +28,20 @@ export const getters: GetterTree<GuiState, any> = {
|
||||
return !state.dashboard.nonExpandPanels?.includes(name) ?? true
|
||||
},
|
||||
|
||||
getPanels: (state, getters) => (viewport: string) => {
|
||||
getPanels: (state, getters, rootState) => (viewport: string) => {
|
||||
// @ts-ignore
|
||||
let panels = state.dashboard[viewport]?.filter((element: any) => element !== null) ?? []
|
||||
|
||||
if (state.dashboard.macroManagement === 'simple') panels = panels.filter((element: any) => !element.name.startsWith('macrogroup_'))
|
||||
if (rootState.gui.macros.mode === 'simple') panels = panels.filter((element: any) => !element.name.startsWith('macrogroup_'))
|
||||
else {
|
||||
panels = panels.filter((element: any) => element.name !== 'macros')
|
||||
const macrogroups = getters['macrogroups/getAllMacrogroups']
|
||||
const macrogroups = getters['macros/getAllMacrogroups']
|
||||
if (macrogroups.length) {
|
||||
panels = panels.filter((element: any) => {
|
||||
if (!element.name.startsWith('macrogroup_')) return true
|
||||
|
||||
const macrogroupId = element.name.substr(11)
|
||||
return (macrogroups.findIndex((macrogroup: GuiMacrogroupsStateMacrogroup) => macrogroup.id === macrogroupId) !== -1)
|
||||
return (macrogroups.findIndex((macrogroup: GuiMacrosStateMacrogroup) => macrogroup.id === macrogroupId) !== -1)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -53,6 +54,6 @@ export const getters: GetterTree<GuiState, any> = {
|
||||
},
|
||||
|
||||
getLockedSliders: (state) => (name: string) => {
|
||||
return state.dashboard.lockedSliders?.includes(name) ?? false
|
||||
return state.view.lockedSliders?.includes(name) ?? false
|
||||
}
|
||||
}
|
||||
+137
-147
@@ -6,9 +6,9 @@ import { getters } from '@/store/gui/getters'
|
||||
import {defaultLogoColor, defaultPrimaryColor} from '@/store/variables'
|
||||
|
||||
// load modules
|
||||
import { consolefilters } from '@/store/gui/consolefilters'
|
||||
import { console } from '@/store/gui/console'
|
||||
import { gcodehistory } from '@/store/gui/gcodehistory'
|
||||
import { macrogroups } from '@/store/gui/macrogroups'
|
||||
import { macros } from '@/store/gui/macros'
|
||||
import { presets } from '@/store/gui/presets'
|
||||
import { remoteprinters } from '@/store/gui/remoteprinters'
|
||||
import { webcams } from '@/store/gui/webcams'
|
||||
@@ -18,174 +18,85 @@ export const getDefaultState = (): GuiState => {
|
||||
general: {
|
||||
printername: '',
|
||||
language: 'en',
|
||||
displayCancelPrint: false,
|
||||
displayZOffsetStandby: false,
|
||||
lockSlidersOnTouchDevices: true,
|
||||
lockSlidersDelay: 1.5,
|
||||
confirmOnEmergencyStop: false,
|
||||
confirmOnPowerDeviceChange: false,
|
||||
calcEstimateTime: ['file', 'filament'],
|
||||
calcEtaTime: ['file', 'filament', 'slicer'],
|
||||
calcEtaTime: ['file', 'filament', 'slicer']
|
||||
},
|
||||
theme: {
|
||||
logo: defaultLogoColor,
|
||||
primary: defaultPrimaryColor,
|
||||
},
|
||||
dashboard: {
|
||||
boolTempchart: true,
|
||||
boolBigThumbnail: true,
|
||||
boolWideNavDrawer: false,
|
||||
navigationStyle: 'iconsAndText',
|
||||
macroManagement: 'simple',
|
||||
hiddenMacros: [],
|
||||
hiddenTempChart: [],
|
||||
control: {
|
||||
style: 'bars',
|
||||
feedrateXY: 100,
|
||||
stepsXY: [ 100, 10, 1 ],
|
||||
feedrateZ: 25,
|
||||
stepsZ: [ 25, 1, 0.1 ],
|
||||
stepsAll: [0.1, 1, 10, 25, 50, 100],
|
||||
stepsCircleXY: [1, 10, 50, 100],
|
||||
stepsCircleZ: [0.1, 1, 10, 50],
|
||||
selectedCrossStep: null,
|
||||
reverseX: false,
|
||||
reverseY: false,
|
||||
reverseZ: false
|
||||
},
|
||||
control: {
|
||||
style: 'bars',
|
||||
feedrateXY: 100,
|
||||
stepsXY: [ 100, 10, 1 ],
|
||||
feedrateZ: 25,
|
||||
stepsZ: [ 25, 1, 0.1 ],
|
||||
stepsAll: [0.1, 1, 10, 25, 50, 100],
|
||||
stepsCircleXY: [1, 10, 50, 100],
|
||||
stepsCircleZ: [0.1, 1, 10, 50],
|
||||
selectedCrossStep: null,
|
||||
reverseX: false,
|
||||
reverseY: false,
|
||||
reverseZ: false,
|
||||
extruder: {
|
||||
feedamount: 25,
|
||||
feedamounts: [ 50, 25, 10, 5, 1 ],
|
||||
feedrate: 5,
|
||||
feedrates: [ 15, 10, 5, 2, 1 ],
|
||||
},
|
||||
},
|
||||
dashboard: {
|
||||
nonExpandPanels: [],
|
||||
mobileLayout: [
|
||||
{ 'name': 'webcam', visable: false },
|
||||
{ 'name': 'zoffset', visable: true },
|
||||
{ 'name': 'control', visable: true },
|
||||
{ 'name': 'macros', visable: true },
|
||||
{ 'name': 'printsettings', visable: true },
|
||||
{ 'name': 'machine-settings', visable: true },
|
||||
{ 'name': 'miscellaneous', visable: true },
|
||||
{ 'name': 'tools', visable: true },
|
||||
{ 'name': 'miniconsole', visable: false },
|
||||
{ 'name': 'webcam', visible: false },
|
||||
{ 'name': 'zoffset', visible: true },
|
||||
{ 'name': 'control', visible: true },
|
||||
{ 'name': 'macros', visible: true },
|
||||
{ 'name': 'printsettings', visible: true },
|
||||
{ 'name': 'machine-settings', visible: true },
|
||||
{ 'name': 'miscellaneous', visible: true },
|
||||
{ 'name': 'tools', visible: true },
|
||||
{ 'name': 'miniconsole', visible: false },
|
||||
],
|
||||
tabletLayout1: [
|
||||
{ 'name': 'webcam', visable: true },
|
||||
{ 'name': 'zoffset', visable: true },
|
||||
{ 'name': 'control', visable: true },
|
||||
{ 'name': 'macros', visable: true },
|
||||
{ 'name': 'printsettings', visable: true },
|
||||
{ 'name': 'machine-settings', visable: true },
|
||||
{ 'name': 'miscellaneous', visable: true },
|
||||
{ 'name': 'webcam', visible: true },
|
||||
{ 'name': 'zoffset', visible: true },
|
||||
{ 'name': 'control', visible: true },
|
||||
{ 'name': 'macros', visible: true },
|
||||
{ 'name': 'printsettings', visible: true },
|
||||
{ 'name': 'machine-settings', visible: true },
|
||||
{ 'name': 'miscellaneous', visible: true },
|
||||
],
|
||||
tabletLayout2: [
|
||||
{ 'name': 'tools', visable: true },
|
||||
{ 'name': 'miniconsole', visable: true },
|
||||
{ 'name': 'tools', visible: true },
|
||||
{ 'name': 'miniconsole', visible: true },
|
||||
],
|
||||
desktopLayout1: [
|
||||
{ 'name': 'webcam', visable: true },
|
||||
{ 'name': 'zoffset', visable: true },
|
||||
{ 'name': 'control', visable: true },
|
||||
{ 'name': 'macros', visable: true },
|
||||
{ 'name': 'printsettings', visable: true },
|
||||
{ 'name': 'machine-settings', visable: true },
|
||||
{ 'name': 'miscellaneous', visable: true },
|
||||
{ 'name': 'webcam', visible: true },
|
||||
{ 'name': 'zoffset', visible: true },
|
||||
{ 'name': 'control', visible: true },
|
||||
{ 'name': 'macros', visible: true },
|
||||
{ 'name': 'printsettings', visible: true },
|
||||
{ 'name': 'machine-settings', visible: true },
|
||||
{ 'name': 'miscellaneous', visible: true },
|
||||
],
|
||||
desktopLayout2: [
|
||||
{ 'name': 'tools', visable: true },
|
||||
{ 'name': 'miniconsole', visable: true },
|
||||
{ 'name': 'tools', visible: true },
|
||||
{ 'name': 'miniconsole', visible: true },
|
||||
],
|
||||
widescreenLayout1: [
|
||||
{ 'name': 'zoffset', visable: true },
|
||||
{ 'name': 'control', visable: true },
|
||||
{ 'name': 'macros', visable: true },
|
||||
{ 'name': 'miscellaneous', visable: true },
|
||||
{ 'name': 'zoffset', visible: true },
|
||||
{ 'name': 'control', visible: true },
|
||||
{ 'name': 'macros', visible: true },
|
||||
{ 'name': 'miscellaneous', visible: true },
|
||||
],
|
||||
widescreenLayout2: [
|
||||
{ 'name': 'tools', visable: true },
|
||||
{ 'name': 'printsettings', visable: true },
|
||||
{ 'name': 'machine-settings', visable: true },
|
||||
{ 'name': 'tools', visible: true },
|
||||
{ 'name': 'printsettings', visible: true },
|
||||
{ 'name': 'machine-settings', visible: true },
|
||||
],
|
||||
widescreenLayout3: [
|
||||
{ 'name': 'webcam', visable: true },
|
||||
{ 'name': 'miniconsole', visable: true },
|
||||
{ 'name': 'webcam', visible: true },
|
||||
{ 'name': 'miniconsole', visible: true },
|
||||
],
|
||||
nonExpandPanels: []
|
||||
},
|
||||
webcamSettings: {
|
||||
currentCam: {
|
||||
dashboard: 'all',
|
||||
page: 'all'
|
||||
},
|
||||
boolNavi: false,
|
||||
},
|
||||
tempchart: {
|
||||
autoscale: false,
|
||||
datasetSettings: {
|
||||
|
||||
},
|
||||
},
|
||||
console: {
|
||||
hideWaitTemperatures: true,
|
||||
hideTlCommands: true,
|
||||
direction: 'table',
|
||||
entryStyle: 'default',
|
||||
height: 300
|
||||
},
|
||||
gcodefiles: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'modified',
|
||||
sortDesc: true,
|
||||
showHiddenFiles: false,
|
||||
showPrintedFiles: true,
|
||||
hideMetadataColums: []
|
||||
},
|
||||
timelapse: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'modified',
|
||||
sortDesc: true,
|
||||
showHiddenFiles: false,
|
||||
},
|
||||
jobqueue: {
|
||||
countPerPage: 10,
|
||||
},
|
||||
heightmap: {
|
||||
probed: true,
|
||||
mesh: false,
|
||||
flat: false,
|
||||
wireframe: true,
|
||||
scale: 0.5,
|
||||
scaleVisualMap: false,
|
||||
},
|
||||
history: {
|
||||
countPerPage: 10,
|
||||
toggleChartCol3: 'filament_usage',
|
||||
hidePrintStatus: [],
|
||||
hideColums: [
|
||||
'size',
|
||||
'modified',
|
||||
'end_time',
|
||||
'total_duration',
|
||||
'filament_total',
|
||||
'first_layer_extr_temp',
|
||||
'first_layer_bed_temp',
|
||||
'first_layer_height',
|
||||
'layer_height',
|
||||
'object_height',
|
||||
]
|
||||
},
|
||||
settings: {
|
||||
configfiles: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'filename',
|
||||
sortDesc: false,
|
||||
showHiddenFiles: false,
|
||||
hideBackupFiles: false
|
||||
}
|
||||
},
|
||||
editor: {
|
||||
minimap: false,
|
||||
escToClose: true,
|
||||
confirmUnsavedChanges: true
|
||||
},
|
||||
@@ -194,7 +105,7 @@ export const getDefaultState = (): GuiState => {
|
||||
gridColor : '#0000FF',
|
||||
backgroundColor : '#000000',
|
||||
colorMode : 2,
|
||||
showAxes : 'true',
|
||||
showAxes : true,
|
||||
minFeed : 20,
|
||||
maxFeed : 100,
|
||||
minFeedColor : '#0000FF',
|
||||
@@ -211,6 +122,85 @@ export const getDefaultState = (): GuiState => {
|
||||
voxelHeight: 1,
|
||||
specularLighting: false,
|
||||
},
|
||||
uiSettings: {
|
||||
logo: defaultLogoColor,
|
||||
primary: defaultPrimaryColor,
|
||||
displayCancelPrint: false,
|
||||
displayZOffsetStandby: false,
|
||||
lockSlidersOnTouchDevices: true,
|
||||
lockSlidersDelay: 1.5,
|
||||
confirmOnEmergencyStop: false,
|
||||
confirmOnPowerDeviceChange: false,
|
||||
boolBigThumbnail: true,
|
||||
boolWideNavDrawer: false,
|
||||
boolHideUploadAndPrintButton: false,
|
||||
boolWebcamNavi: false,
|
||||
navigationStyle: 'iconsAndText',
|
||||
},
|
||||
view: {
|
||||
configfiles: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'filename',
|
||||
sortDesc: false,
|
||||
showHiddenFiles: false,
|
||||
hideBackupFiles: false
|
||||
},
|
||||
gcodefiles: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'modified',
|
||||
sortDesc: true,
|
||||
showHiddenFiles: false,
|
||||
showPrintedFiles: true,
|
||||
hideMetadataColums: []
|
||||
},
|
||||
heightmap: {
|
||||
probed: true,
|
||||
mesh: false,
|
||||
flat: false,
|
||||
wireframe: true,
|
||||
scale: 0.5,
|
||||
scaleVisualMap: false,
|
||||
},
|
||||
history: {
|
||||
countPerPage: 10,
|
||||
toggleChartCol3: 'filament_usage',
|
||||
hidePrintStatus: [],
|
||||
hideColums: [
|
||||
'size',
|
||||
'modified',
|
||||
'end_time',
|
||||
'total_duration',
|
||||
'filament_total',
|
||||
'first_layer_extr_temp',
|
||||
'first_layer_bed_temp',
|
||||
'first_layer_height',
|
||||
'layer_height',
|
||||
'object_height',
|
||||
]
|
||||
},
|
||||
jobqueue: {
|
||||
countPerPage: 10,
|
||||
},
|
||||
lockedSliders: [],
|
||||
tempchart: {
|
||||
boolTempchart: true,
|
||||
hiddenDataset: [],
|
||||
autoscale: false,
|
||||
datasetSettings: { },
|
||||
},
|
||||
timelapse: {
|
||||
countPerPage: 10,
|
||||
sortBy: 'modified',
|
||||
sortDesc: true,
|
||||
showHiddenFiles: false,
|
||||
},
|
||||
webcam: {
|
||||
currentCam: {
|
||||
dashboard: 'all',
|
||||
page: 'all'
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,9 +214,9 @@ export const gui: Module<GuiState, any> = {
|
||||
actions,
|
||||
mutations,
|
||||
modules: {
|
||||
consolefilters,
|
||||
console,
|
||||
gcodehistory,
|
||||
macrogroups,
|
||||
macros,
|
||||
presets,
|
||||
remoteprinters,
|
||||
webcams,
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Module } from 'vuex'
|
||||
import { actions } from '@/store/gui/macrogroups/actions'
|
||||
import { mutations } from '@/store/gui/macrogroups/mutations'
|
||||
import { getters } from '@/store/gui/macrogroups/getters'
|
||||
import {GuiMacrogroupsState} from '@/store/gui/macrogroups/types'
|
||||
|
||||
export const getDefaultState = (): GuiMacrogroupsState => {
|
||||
return {
|
||||
macrogroups: {},
|
||||
}
|
||||
}
|
||||
|
||||
// initial state
|
||||
const state = getDefaultState()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const macrogroups: Module<GuiMacrogroupsState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -2,64 +2,62 @@ import { ActionTree } from 'vuex'
|
||||
import {RootState} from '@/store/types'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import Vue from 'vue'
|
||||
import {GuiMacrogroupsState} from '@/store/gui/macrogroups/types'
|
||||
import {GuiMacrosState} from '@/store/gui/macros/types'
|
||||
|
||||
export const actions: ActionTree<GuiMacrogroupsState, RootState> = {
|
||||
export const actions: ActionTree<GuiMacrosState, RootState> = {
|
||||
reset({ commit }) {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
window.console.debug('init gui/macrogroups')
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: 'mainsail_macrogroups' }, { action: 'gui/macrogroups/initStore' })
|
||||
saveSetting({ dispatch }, payload) {
|
||||
dispatch('gui/saveSetting', {
|
||||
name: 'macros.'+payload.name,
|
||||
value: payload.value
|
||||
}, { root: true })
|
||||
},
|
||||
|
||||
initStore({ commit }, payload) {
|
||||
commit('reset')
|
||||
commit('initStore', payload)
|
||||
groupUpload({ state }, id) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail', key: 'macros.macrogroups.'+id, value: state.macrogroups[id] })
|
||||
},
|
||||
|
||||
upload({ state }, id) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail_macrogroups', key: id, value: state.macrogroups[id] })
|
||||
},
|
||||
|
||||
async store({ commit, dispatch, state }, payload) {
|
||||
async groupStore({ commit, dispatch, state }, payload) {
|
||||
const id = uuidv4()
|
||||
|
||||
await commit('store', { id, values: payload.values })
|
||||
await dispatch('upload', id)
|
||||
await commit('groupStore', { id, values: payload.values })
|
||||
await dispatch('groupUpload', id)
|
||||
|
||||
return id
|
||||
},
|
||||
|
||||
update({ commit, dispatch, state }, payload) {
|
||||
commit('update', payload)
|
||||
dispatch('upload', payload.id)
|
||||
groupUpdate({ commit, dispatch, state }, payload) {
|
||||
commit('groupUpdate', payload)
|
||||
dispatch('groupUpload', payload.id)
|
||||
},
|
||||
|
||||
addMacroToMacrogroup({ commit, dispatch }, payload) {
|
||||
commit('addMacroToMacrogroup', payload)
|
||||
dispatch('upload', payload.id)
|
||||
dispatch('groupUpload', payload.id)
|
||||
},
|
||||
|
||||
updateMacroFromMacrogroup({ commit, dispatch }, payload) {
|
||||
commit('updateMacroFromMacrogroup', payload)
|
||||
dispatch('upload', payload.id)
|
||||
dispatch('groupUpload', payload.id)
|
||||
},
|
||||
|
||||
removeMacroFromMacrogroup({ commit, dispatch }, payload) {
|
||||
commit('removeMacroFromMacrogroup', payload)
|
||||
dispatch('upload', payload.id)
|
||||
dispatch('groupUpload', payload.id)
|
||||
},
|
||||
|
||||
delete({ commit, dispatch, rootState }, id) {
|
||||
commit('delete', id)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail_macrogroups', key: id })
|
||||
groupDelete({ commit, dispatch, rootState }, id) {
|
||||
commit('groupDelete', id)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'macros.macrogroups.'+id })
|
||||
|
||||
const layouts = ['mobileLayout', 'tabletLayout1', 'tabletLayout2', 'desktopLayout1', 'desktopLayout2',
|
||||
'widescreenLayout1', 'widescreenLayout2', 'widescreenLayout3']
|
||||
|
||||
layouts.forEach((layoutname: string) => {
|
||||
// @ts-ignore
|
||||
const layoutArray = [...rootState.gui?.dashboard[layoutname]]
|
||||
|
||||
const index = layoutArray.findIndex((layoutPos: any) => layoutPos.name === 'macrogroup_'+id)
|
||||
@@ -67,6 +65,7 @@ export const actions: ActionTree<GuiMacrogroupsState, RootState> = {
|
||||
commit('gui/deleteFromDashboardLayout', { layoutname, index }, { root: true })
|
||||
dispatch('gui/updateSettings', {
|
||||
keyName: 'dashboard.'+layoutname,
|
||||
// @ts-ignore
|
||||
newVal: rootState.gui?.dashboard[layoutname]
|
||||
}, { root: true })
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { GetterTree } from 'vuex'
|
||||
import {GuiMacrogroupsState, GuiMacrogroupsStateMacrogroup} from '@/store/gui/macrogroups/types'
|
||||
import {GuiMacrosState, GuiMacrosStateMacrogroup} from '@/store/gui/macros/types'
|
||||
import {caseInsensitiveSort} from '@/plugins/helpers'
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const getters: GetterTree<GuiMacrogroupsState, any> = {
|
||||
export const getters: GetterTree<GuiMacrosState, any> = {
|
||||
|
||||
getAllMacrogroups: (state) => {
|
||||
const macrogroups: GuiMacrogroupsStateMacrogroup[] = []
|
||||
const macrogroups: GuiMacrosStateMacrogroup[] = []
|
||||
|
||||
Object.keys(state.macrogroups).forEach((id: string) => {
|
||||
macrogroups.push({...state.macrogroups[id], id})
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Module } from 'vuex'
|
||||
import { actions } from '@/store/gui/macros/actions'
|
||||
import { mutations } from '@/store/gui/macros/mutations'
|
||||
import { getters } from '@/store/gui/macros/getters'
|
||||
import {GuiMacrosState} from '@/store/gui/macros/types'
|
||||
|
||||
export const getDefaultState = (): GuiMacrosState => {
|
||||
return {
|
||||
mode: 'simple',
|
||||
hiddenMacros: [],
|
||||
macrogroups: {},
|
||||
}
|
||||
}
|
||||
|
||||
// initial state
|
||||
const state = getDefaultState()
|
||||
|
||||
// eslint-disable-next-line
|
||||
export const macros: Module<GuiMacrosState, any> = {
|
||||
namespaced: true,
|
||||
state,
|
||||
getters,
|
||||
actions,
|
||||
mutations
|
||||
}
|
||||
@@ -1,22 +1,18 @@
|
||||
import { getDefaultState } from './index'
|
||||
import {getDefaultState} from './index'
|
||||
import {MutationTree} from 'vuex'
|
||||
import Vue from 'vue'
|
||||
import {GuiMacrogroupsState, GuiMacrogroupsStateMacrogroupMacro} from '@/store/gui/macrogroups/types'
|
||||
import {GuiMacrosState, GuiMacrosStateMacrogroupMacro} from '@/store/gui/macros/types'
|
||||
|
||||
export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
export const mutations: MutationTree<GuiMacrosState> = {
|
||||
reset(state) {
|
||||
Object.assign(state, getDefaultState())
|
||||
},
|
||||
|
||||
initStore(state, payload) {
|
||||
Vue.set(state, 'macrogroups', payload.value)
|
||||
},
|
||||
|
||||
store(state, payload) {
|
||||
groupStore(state, payload) {
|
||||
Vue.set(state.macrogroups, payload.id, payload.values)
|
||||
},
|
||||
|
||||
update(state, payload) {
|
||||
groupUpdate(state, payload) {
|
||||
if (payload.id in state.macrogroups) {
|
||||
const preset = {...state.macrogroups[payload.id]}
|
||||
Object.assign(preset, payload.values)
|
||||
@@ -28,7 +24,7 @@ export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
addMacroToMacrogroup(state, payload) {
|
||||
const macros = [...state.macrogroups[payload.id]?.macros ?? []]
|
||||
|
||||
const newMacro: GuiMacrogroupsStateMacrogroupMacro = {
|
||||
const newMacro: GuiMacrosStateMacrogroupMacro = {
|
||||
pos: 1,
|
||||
name: payload.macro,
|
||||
color: 'group',
|
||||
@@ -37,7 +33,7 @@ export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
showInPause: true
|
||||
}
|
||||
|
||||
if (macros.length) newMacro.pos = Math.max(...macros.map((m: GuiMacrogroupsStateMacrogroupMacro) => m.pos)) + 1
|
||||
if (macros.length) newMacro.pos = Math.max(...macros.map((m: GuiMacrosStateMacrogroupMacro) => m.pos)) + 1
|
||||
macros.push(newMacro)
|
||||
|
||||
Vue.set(state.macrogroups[payload.id], 'macros', macros)
|
||||
@@ -45,7 +41,7 @@ export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
|
||||
updateMacroFromMacrogroup(state, payload) {
|
||||
const macros = [...state.macrogroups[payload.id]?.macros ?? []]
|
||||
const updateMacroIndex = macros.findIndex((m: GuiMacrogroupsStateMacrogroupMacro) => m.name === payload.macro)
|
||||
const updateMacroIndex = macros.findIndex((m: GuiMacrosStateMacrogroupMacro) => m.name === payload.macro)
|
||||
if (updateMacroIndex !== -1) {
|
||||
const macro = macros[updateMacroIndex]
|
||||
// @ts-ignore
|
||||
@@ -56,12 +52,12 @@ export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
|
||||
removeMacroFromMacrogroup(state, payload) {
|
||||
const macros = [...state.macrogroups[payload.id]?.macros ?? []]
|
||||
const deletedMacroIndex = macros.findIndex((m: GuiMacrogroupsStateMacrogroupMacro) => m.name === payload.macro)
|
||||
const deletedMacroIndex = macros.findIndex((m: GuiMacrosStateMacrogroupMacro) => m.name === payload.macro)
|
||||
if (deletedMacroIndex !== -1) {
|
||||
const oldPos = macros[deletedMacroIndex].pos
|
||||
macros.splice(deletedMacroIndex, 1)
|
||||
|
||||
macros.filter((macro: GuiMacrogroupsStateMacrogroupMacro) => macro.pos > oldPos).forEach((macro: GuiMacrogroupsStateMacrogroupMacro) => {
|
||||
macros.filter((macro: GuiMacrosStateMacrogroupMacro) => macro.pos > oldPos).forEach((macro: GuiMacrosStateMacrogroupMacro) => {
|
||||
macro.pos = macro.pos - 1
|
||||
})
|
||||
}
|
||||
@@ -69,7 +65,7 @@ export const mutations: MutationTree<GuiMacrogroupsState> = {
|
||||
Vue.set(state.macrogroups[payload.id], 'macros', macros)
|
||||
},
|
||||
|
||||
delete(state, payload) {
|
||||
groupDelete(state, payload) {
|
||||
if (payload in state.macrogroups) {
|
||||
Vue.delete(state.macrogroups, payload)
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
export interface GuiMacrogroupsState {
|
||||
export interface GuiMacrosState {
|
||||
mode: 'simple' | 'expert'
|
||||
hiddenMacros: string[]
|
||||
macrogroups: {
|
||||
[key: string]: GuiMacrogroupsStateMacrogroup
|
||||
[key: string]: GuiMacrosStateMacrogroup
|
||||
}
|
||||
}
|
||||
|
||||
export interface GuiMacrogroupsStateMacrogroup {
|
||||
export interface GuiMacrosStateMacrogroup {
|
||||
id: string | null
|
||||
name: string
|
||||
color: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'custom'
|
||||
@@ -12,10 +14,10 @@ export interface GuiMacrogroupsStateMacrogroup {
|
||||
showInStandby: boolean
|
||||
showInPrinting: boolean
|
||||
showInPause: boolean
|
||||
macros?: GuiMacrogroupsStateMacrogroupMacro[]
|
||||
macros?: GuiMacrosStateMacrogroupMacro[]
|
||||
}
|
||||
|
||||
export interface GuiMacrogroupsStateMacrogroupMacro {
|
||||
export interface GuiMacrosStateMacrogroupMacro {
|
||||
pos: number
|
||||
name: string
|
||||
color: 'group' | 'primary' | 'secondary' | 'success' | 'warning' | 'error'
|
||||
+17
-33
@@ -43,38 +43,38 @@ export const mutations: MutationTree<GuiState> = {
|
||||
},
|
||||
|
||||
setHeaterChartVisibility(state, payload) {
|
||||
const index = state.dashboard.hiddenTempChart.indexOf(payload.name.toUpperCase())
|
||||
const index = state.view.tempchart.hiddenDataset.indexOf(payload.name.toUpperCase())
|
||||
|
||||
if (payload.hidden && index === -1) state.dashboard.hiddenTempChart.push(payload.name.toUpperCase())
|
||||
else if (payload.hidden !== true && index > -1) state.dashboard.hiddenTempChart.splice(index, 1)
|
||||
if (payload.hidden && index === -1) state.view.tempchart.hiddenDataset.push(payload.name.toUpperCase())
|
||||
else if (payload.hidden !== true && index > -1) state.view.tempchart.hiddenDataset.splice(index, 1)
|
||||
},
|
||||
|
||||
setGcodefilesMetadata(state, data) {
|
||||
if (data.value && state.gcodefiles.hideMetadataColums.includes(data.name)) {
|
||||
state.gcodefiles.hideMetadataColums.splice(state.gcodefiles.hideMetadataColums.indexOf(data.name), 1)
|
||||
} else if (!data.value && !state.gcodefiles.hideMetadataColums.includes(data.name)) {
|
||||
state.gcodefiles.hideMetadataColums.push(data.name)
|
||||
if (data.value && state.view.gcodefiles.hideMetadataColums.includes(data.name)) {
|
||||
state.view.gcodefiles.hideMetadataColums.splice(state.view.gcodefiles.hideMetadataColums.indexOf(data.name), 1)
|
||||
} else if (!data.value && !state.view.gcodefiles.hideMetadataColums.includes(data.name)) {
|
||||
state.view.gcodefiles.hideMetadataColums.push(data.name)
|
||||
}
|
||||
},
|
||||
|
||||
setGcodefilesShowHiddenFiles(state, value) {
|
||||
Vue.set(state.gcodefiles, 'showHiddenFiles', value)
|
||||
Vue.set(state.view.gcodefiles, 'showHiddenFiles', value)
|
||||
},
|
||||
|
||||
setCurrentWebcam(state, payload) {
|
||||
Vue.set(state.webcamSettings.currentCam, payload.viewport, payload.value)
|
||||
Vue.set(state.view.webcam.currentCam, payload.viewport, payload.value)
|
||||
},
|
||||
|
||||
setHistoryColumns(state, data) {
|
||||
if (data.value && state.history.hideColums.includes(data.name)) {
|
||||
state.history.hideColums.splice(state.history.hideColums.indexOf(data.name), 1)
|
||||
} else if (!data.value && !state.history.hideColums.includes(data.name)) {
|
||||
state.history.hideColums.push(data.name)
|
||||
if (data.value && state.view.history.hideColums.includes(data.name)) {
|
||||
state.view.history.hideColums.splice(state.view.history.hideColums.indexOf(data.name), 1)
|
||||
} else if (!data.value && !state.view.history.hideColums.includes(data.name)) {
|
||||
state.view.history.hideColums.push(data.name)
|
||||
}
|
||||
},
|
||||
|
||||
setHistoryHidePrintStatus(state, payload) {
|
||||
Vue.set(state.history, 'hidePrintStatus', payload)
|
||||
Vue.set(state.view.history, 'hidePrintStatus', payload)
|
||||
},
|
||||
|
||||
addClosePanel(state, payload) {
|
||||
@@ -98,13 +98,14 @@ export const mutations: MutationTree<GuiState> = {
|
||||
},
|
||||
|
||||
deleteFromDashboardLayout(state, payload) {
|
||||
// @ts-ignore
|
||||
const layoutArray = [...state.dashboard[payload.layoutname]]
|
||||
layoutArray.splice(payload.index, 1)
|
||||
Vue.set(state.dashboard, payload.layoutname, layoutArray)
|
||||
},
|
||||
|
||||
addToLockedSliders(state, payload){
|
||||
const lockedSliders = [...state.dashboard.lockedSliders]
|
||||
const lockedSliders = [...state.view.lockedSliders]
|
||||
if (!lockedSliders.includes(payload.name)) {
|
||||
lockedSliders.push(payload.name)
|
||||
|
||||
@@ -113,7 +114,7 @@ export const mutations: MutationTree<GuiState> = {
|
||||
},
|
||||
|
||||
removeFromLockedSliders(state, payload){
|
||||
const lockedSliders = [...state.dashboard.lockedSliders]
|
||||
const lockedSliders = [...state.view.lockedSliders]
|
||||
const index = lockedSliders.indexOf(payload.name)
|
||||
if (index > -1) {
|
||||
lockedSliders.splice(index, 1)
|
||||
@@ -125,21 +126,4 @@ export const mutations: MutationTree<GuiState> = {
|
||||
toggleHideUploadAndPrintBtn(state, payload) {
|
||||
Vue.set(state.dashboard, 'boolHideUploadAndPrintButton', payload)
|
||||
},
|
||||
|
||||
setResetDatabases(state, payload) {
|
||||
const array: string[] = []
|
||||
Object.keys(payload).forEach((element) => {
|
||||
if (payload[element] === true) array.push(element)
|
||||
})
|
||||
|
||||
Vue.set(state, 'resetDatabases', array)
|
||||
},
|
||||
|
||||
removeResetDatabase(state, payload) {
|
||||
const array = [...state.resetDatabases]
|
||||
const index = array.findIndex((element) => element === payload)
|
||||
if (index !== -1) array.splice(index, 1)
|
||||
|
||||
Vue.set(state, 'resetDatabases', array)
|
||||
}
|
||||
}
|
||||
@@ -9,18 +9,15 @@ export const actions: ActionTree<GuiPresetsState, RootState> = {
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
window.console.debug('init gui/presets')
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: 'mainsail_presets' }, { action: 'gui/presets/initStore' })
|
||||
},
|
||||
|
||||
initStore({ commit }, payload) {
|
||||
commit('reset')
|
||||
commit('initStore', payload)
|
||||
saveSetting({ dispatch }, payload) {
|
||||
dispatch('gui/saveSetting', {
|
||||
name: 'presets.'+payload.name,
|
||||
value: payload.value
|
||||
}, { root: true })
|
||||
},
|
||||
|
||||
upload(_, payload) {
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail_presets', key: payload.id, value: payload.value })
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail', key: 'presets.presets.'+payload.id, value: payload.value })
|
||||
},
|
||||
|
||||
store({ commit, dispatch, state }, payload) {
|
||||
@@ -41,16 +38,8 @@ export const actions: ActionTree<GuiPresetsState, RootState> = {
|
||||
})
|
||||
},
|
||||
|
||||
updateCooldownGcode({ commit, dispatch }, payload) {
|
||||
commit('updateCooldownGcode', payload)
|
||||
dispatch('upload', {
|
||||
id: 'cooldownGcode',
|
||||
value: payload
|
||||
})
|
||||
},
|
||||
|
||||
delete({ commit }, payload) {
|
||||
commit('delete', payload)
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail_presets', key: payload })
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'presets.presets.'+payload })
|
||||
},
|
||||
}
|
||||
@@ -6,21 +6,14 @@ import {GuiRemoteprintersState} from '@/store/gui/remoteprinters/types'
|
||||
|
||||
export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
|
||||
reset({ commit, dispatch, state }) {
|
||||
Object.keys(state.remoteprinters).forEach((printerId) => {
|
||||
Object.keys(state.printers).forEach((printerId) => {
|
||||
dispatch('farm/unregisterPrinter', printerId, { root: true })
|
||||
})
|
||||
|
||||
commit('reset')
|
||||
},
|
||||
|
||||
init() {
|
||||
window.console.debug('init gui/remoteprinters')
|
||||
Vue.$socket.emit('server.database.get_item', { namespace: 'mainsail_remoteprinters' }, { action: 'gui/remoteprinters/initStore' })
|
||||
},
|
||||
|
||||
initFromLocalstorage({ dispatch }) {
|
||||
window.console.debug('init gui/remoteprinters from localStorage')
|
||||
|
||||
const value = JSON.parse(localStorage.getItem('printers') ?? '{}')
|
||||
if (Array.isArray(value)) {
|
||||
const printers: any = {}
|
||||
@@ -30,15 +23,14 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
|
||||
printers[id] = printer
|
||||
})
|
||||
|
||||
dispatch('initStore', { value: printers })
|
||||
} else dispatch('initStore', { value })
|
||||
dispatch('initStore', printers)
|
||||
}
|
||||
},
|
||||
|
||||
async initStore({ commit, dispatch, state }, payload) {
|
||||
dispatch('reset')
|
||||
|
||||
Object.keys(payload.value).forEach((printerId: string) => {
|
||||
const printer = payload.value[printerId]
|
||||
Object.keys(payload).forEach((printerId: string) => {
|
||||
const printer = payload[printerId]
|
||||
commit('store', { id: printerId, values: printer })
|
||||
dispatch('farm/registerPrinter', {
|
||||
id: printerId,
|
||||
@@ -53,23 +45,23 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
|
||||
if (rootState.socket?.remoteMode) {
|
||||
const printers: any[] = []
|
||||
|
||||
Object.keys(state.remoteprinters).forEach((id: string) => {
|
||||
Object.keys(state.printers).forEach((id: string) => {
|
||||
printers.push({
|
||||
hostname: state.remoteprinters[id].hostname,
|
||||
port: state.remoteprinters[id].port,
|
||||
settings: state.remoteprinters[id].settings,
|
||||
hostname: state.printers[id].hostname,
|
||||
port: state.printers[id].port,
|
||||
settings: state.printers[id].settings,
|
||||
})
|
||||
})
|
||||
|
||||
localStorage.setItem('printers', JSON.stringify(printers))
|
||||
} else if (id in state.remoteprinters) {
|
||||
} else if (id in state.printers) {
|
||||
const value = {
|
||||
hostname: state.remoteprinters[id].hostname,
|
||||
port: state.remoteprinters[id].port,
|
||||
settings: state.remoteprinters[id].settings ?? {},
|
||||
hostname: state.printers[id].hostname,
|
||||
port: state.printers[id].port,
|
||||
settings: state.printers[id].settings ?? {},
|
||||
}
|
||||
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail_remoteprinters', key: id, value })
|
||||
Vue.$socket.emit('server.database.post_item', { namespace: 'mainsail', key: 'remoteprinters.printers.'+id, value })
|
||||
}
|
||||
},
|
||||
|
||||
@@ -107,6 +99,6 @@ export const actions: ActionTree<GuiRemoteprintersState, RootState> = {
|
||||
commit('delete', id)
|
||||
dispatch('farm/unregisterPrinter', id, { root: true })
|
||||
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail_remoteprinters', key: id })
|
||||
Vue.$socket.emit('server.database.delete_item', { namespace: 'mainsail', key: 'remoteprinters.printers'+id })
|
||||
},
|
||||
}
|
||||
@@ -8,14 +8,14 @@ import {caseInsensitiveSort} from '@/plugins/helpers'
|
||||
// eslint-disable-next-line
|
||||
export const getters: GetterTree<GuiRemoteprintersState, any> = {
|
||||
getRemoteprinters: (state, getters, rootState, rootGetters) => {
|
||||
const remoteprinters: GuiRemoteprintersStatePrinter[] = []
|
||||
const printers: GuiRemoteprintersStatePrinter[] = []
|
||||
|
||||
Object.keys(state.remoteprinters).forEach((id: string) => {
|
||||
Object.keys(state.printers).forEach((id: string) => {
|
||||
const socket = {...rootGetters['farm/getPrinterSocketState'](id)}
|
||||
|
||||
remoteprinters.push({...state.remoteprinters[id], id, socket})
|
||||
printers.push({...state.printers[id], id, socket})
|
||||
})
|
||||
|
||||
return caseInsensitiveSort(remoteprinters, 'hostname')
|
||||
return caseInsensitiveSort(printers, 'hostname')
|
||||
},
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import {GuiRemoteprintersState} from '@/store/gui/remoteprinters/types'
|
||||
|
||||
export const getDefaultState = (): GuiRemoteprintersState => {
|
||||
return {
|
||||
remoteprinters: {},
|
||||
printers: {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,21 +9,21 @@ export const mutations: MutationTree<GuiRemoteprintersState> = {
|
||||
},
|
||||
|
||||
store(state, payload) {
|
||||
Vue.set(state.remoteprinters, payload.id, payload.values)
|
||||
Vue.set(state.printers, payload.id, payload.values)
|
||||
},
|
||||
|
||||
update(state, payload) {
|
||||
if (payload.id in state.remoteprinters) {
|
||||
const preset = {...state.remoteprinters[payload.id]}
|
||||
if (payload.id in state.printers) {
|
||||
const preset = {...state.printers[payload.id]}
|
||||
Object.assign(preset, payload.values)
|
||||
|
||||
Vue.set(state.remoteprinters, payload.id, preset)
|
||||
Vue.set(state.printers, payload.id, preset)
|
||||
}
|
||||
},
|
||||
|
||||
delete(state, payload) {
|
||||
if (payload in state.remoteprinters) {
|
||||
Vue.delete(state.remoteprinters, payload)
|
||||
if (payload in state.printers) {
|
||||
Vue.delete(state.printers, payload)
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import {FarmPrinterStateSocket} from '@/store/farm/printer/types'
|
||||
|
||||
export interface GuiRemoteprintersState {
|
||||
remoteprinters: {
|
||||
printers: {
|
||||
[key: string]: GuiRemoteprintersStatePrinter
|
||||
}
|
||||
}
|
||||
|
||||
+144
-7
@@ -1,10 +1,147 @@
|
||||
import {GuiMacrosState} from '@/store/gui/macros/types'
|
||||
import {GuiConsoleState} from '@/store/gui/console/types'
|
||||
import {GuiPresetsState} from '@/store/gui/presets/types'
|
||||
import {GuiRemoteprintersState} from '@/store/gui/remoteprinters/types'
|
||||
|
||||
export interface GuiState {
|
||||
webcamSettings: {
|
||||
currentCam: {
|
||||
dashboard: string
|
||||
page: string
|
||||
}
|
||||
boolNavi: boolean
|
||||
general: {
|
||||
printername: string
|
||||
language: string
|
||||
calcEstimateTime: string[] // file, filament are possible values
|
||||
calcEtaTime: string[] // file, filament, slicer are possible values
|
||||
}
|
||||
[key: string]: any
|
||||
console?: GuiConsoleState
|
||||
control: {
|
||||
style: 'bars' | 'circle' | 'cross'
|
||||
feedrateXY: number
|
||||
stepsXY: number[]
|
||||
feedrateZ: number
|
||||
stepsZ: number[]
|
||||
stepsAll: number[]
|
||||
stepsCircleXY: number[]
|
||||
stepsCircleZ: number[]
|
||||
selectedCrossStep: null | number
|
||||
reverseX: boolean
|
||||
reverseY: boolean
|
||||
reverseZ: boolean
|
||||
extruder: {
|
||||
feedamount: number
|
||||
feedamounts: number[]
|
||||
feedrate: number
|
||||
feedrates: number[]
|
||||
}
|
||||
}
|
||||
dashboard: {
|
||||
nonExpandPanels: string[]
|
||||
mobileLayout: GuiStateLayoutoption[]
|
||||
tabletLayout1: GuiStateLayoutoption[]
|
||||
tabletLayout2: GuiStateLayoutoption[]
|
||||
desktopLayout1: GuiStateLayoutoption[]
|
||||
desktopLayout2: GuiStateLayoutoption[]
|
||||
widescreenLayout1: GuiStateLayoutoption[]
|
||||
widescreenLayout2: GuiStateLayoutoption[]
|
||||
widescreenLayout3: GuiStateLayoutoption[]
|
||||
}
|
||||
editor: {
|
||||
escToClose: boolean
|
||||
confirmUnsavedChanges: boolean
|
||||
}
|
||||
gcodeViewer: {
|
||||
extruderColors : string[]
|
||||
gridColor : string
|
||||
backgroundColor : string
|
||||
colorMode : number
|
||||
showAxes : boolean
|
||||
minFeed : number
|
||||
maxFeed : number
|
||||
minFeedColor : string
|
||||
maxFeedColor : string
|
||||
progressColor : string
|
||||
showCursor: boolean
|
||||
showTravelMoves: boolean
|
||||
showObjectSelection: boolean
|
||||
hdRendering: boolean
|
||||
forceLineRendering: boolean
|
||||
transparency: boolean
|
||||
voxelMode: boolean
|
||||
voxelWidth: number
|
||||
voxelHeight: number
|
||||
specularLighting: boolean
|
||||
}
|
||||
macros?: GuiMacrosState
|
||||
presets?: GuiPresetsState
|
||||
remoteprinters?: GuiRemoteprintersState
|
||||
uiSettings: {
|
||||
logo: string
|
||||
primary: string
|
||||
displayCancelPrint: boolean
|
||||
displayZOffsetStandby: boolean
|
||||
lockSlidersOnTouchDevices: boolean
|
||||
lockSlidersDelay: number
|
||||
confirmOnEmergencyStop: boolean
|
||||
confirmOnPowerDeviceChange: boolean
|
||||
boolBigThumbnail: boolean
|
||||
boolWideNavDrawer: boolean
|
||||
boolHideUploadAndPrintButton: boolean
|
||||
boolWebcamNavi: boolean
|
||||
navigationStyle: 'iconsAndText' | 'iconsOnly'
|
||||
}
|
||||
view: {
|
||||
configfiles: {
|
||||
countPerPage: number
|
||||
sortBy: string
|
||||
sortDesc: boolean
|
||||
showHiddenFiles: boolean
|
||||
hideBackupFiles: boolean
|
||||
}
|
||||
gcodefiles: {
|
||||
countPerPage: number
|
||||
sortBy: string
|
||||
sortDesc: boolean
|
||||
showHiddenFiles: boolean
|
||||
showPrintedFiles: boolean
|
||||
hideMetadataColums: string[]
|
||||
}
|
||||
heightmap: {
|
||||
probed: boolean
|
||||
mesh: boolean
|
||||
flat: boolean
|
||||
wireframe: boolean
|
||||
scale: number
|
||||
scaleVisualMap: boolean
|
||||
}
|
||||
history: {
|
||||
countPerPage: number
|
||||
toggleChartCol3: string
|
||||
hidePrintStatus: string[]
|
||||
hideColums: string[]
|
||||
}
|
||||
jobqueue: {
|
||||
countPerPage: number
|
||||
}
|
||||
lockedSliders: string[]
|
||||
tempchart: {
|
||||
boolTempchart: boolean
|
||||
hiddenDataset: string[]
|
||||
autoscale: boolean
|
||||
datasetSettings: any
|
||||
}
|
||||
timelapse: {
|
||||
countPerPage: number
|
||||
sortBy: string
|
||||
sortDesc: boolean
|
||||
showHiddenFiles: boolean
|
||||
}
|
||||
webcam: {
|
||||
currentCam: {
|
||||
dashboard: string
|
||||
page: string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface GuiStateLayoutoption {
|
||||
name: string
|
||||
visible: boolean
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export const getters: GetterTree<PrinterState, RootState> = {
|
||||
const array: PrinterStateMacro[] = []
|
||||
const hiddenMacros: string[] = []
|
||||
|
||||
rootState.gui?.dashboard.hiddenMacros.forEach((item: string, index: number) => {
|
||||
rootState.gui?.macros?.hiddenMacros.forEach((item: string, index: number) => {
|
||||
hiddenMacros[index] = item.toLowerCase()
|
||||
})
|
||||
|
||||
@@ -365,7 +365,7 @@ export const getters: GetterTree<PrinterState, RootState> = {
|
||||
getAllMacros: state => {
|
||||
const array: PrinterStateMacro[] = []
|
||||
|
||||
Object.keys(state.configfile.config).forEach(prop => {
|
||||
Object.keys(state.configfile?.config ?? {}).forEach(prop => {
|
||||
if (prop.startsWith('gcode_macro') &&
|
||||
!prop.startsWith('gcode_macro _') &&
|
||||
!Object.hasOwnProperty.call(state.configfile.config[prop], 'rename_existing')) {
|
||||
|
||||
@@ -24,12 +24,8 @@ export const actions: ActionTree<ServerState, RootState> = {
|
||||
|
||||
checkDatabases({ dispatch, commit, rootState }, payload) {
|
||||
if (payload.namespaces?.includes('mainsail')) dispatch('gui/init', null, { root: true })
|
||||
else dispatch('gui/initDb', null, { root: true })
|
||||
if (payload.namespaces?.includes('webcams')) dispatch('gui/webcams/init', null, { root: true })
|
||||
if (payload.namespaces?.includes('mainsail_presets')) dispatch('gui/presets/init', null, { root: true })
|
||||
if (payload.namespaces?.includes('mainsail_consolefilters')) dispatch('gui/consolefilters/init', null, { root: true })
|
||||
if (payload.namespaces?.includes('mainsail_gcodehistory')) dispatch('gui/gcodehistory/init', null, { root: true })
|
||||
if (payload.namespaces?.includes('mainsail_macrogroups')) dispatch('gui/macrogroups/init', null, { root: true })
|
||||
if (!rootState.socket?.remoteMode && payload.namespaces?.includes('mainsail_remoteprinters')) dispatch('gui/remoteprinters/init', null, { root: true })
|
||||
|
||||
commit('saveDbNamespaces', payload.namespaces)
|
||||
|
||||
@@ -84,7 +80,7 @@ export const actions: ActionTree<ServerState, RootState> = {
|
||||
commit('clearGcodeStore')
|
||||
|
||||
let events: ServerStateEvent[] = payload.gcode_store
|
||||
const filters = rootGetters['gui/consolefilters/getConsolefilterRules']
|
||||
const filters = rootGetters['gui/console/getConsolefilterRules']
|
||||
filters.forEach((filter: string) => {
|
||||
try {
|
||||
const regex = new RegExp(filter)
|
||||
@@ -113,7 +109,7 @@ export const actions: ActionTree<ServerState, RootState> = {
|
||||
|
||||
let formatMessage = formatConsoleMessage(message)
|
||||
|
||||
const filters = rootGetters['gui/consolefilters/getConsolefilterRules']
|
||||
const filters = rootGetters['gui/console/getConsolefilterRules']
|
||||
let boolImport = true
|
||||
filters.every((filter: string) => {
|
||||
try {
|
||||
|
||||
@@ -111,7 +111,7 @@ export const getters: GetterTree<ServerHistoryState, any> = {
|
||||
name: current.status,
|
||||
value: 1,
|
||||
itemStyle: itemStyle,
|
||||
showInTable: !rootState.gui?.history.hidePrintStatus.includes(current.status),
|
||||
showInTable: !rootState.gui?.view.history.hidePrintStatus.includes(current.status),
|
||||
label: {
|
||||
color: '#fff'
|
||||
}
|
||||
@@ -216,7 +216,7 @@ export const getters: GetterTree<ServerHistoryState, any> = {
|
||||
},
|
||||
|
||||
getFilterdJobList: (state, getters, rootState) => {
|
||||
const hideStatus = rootState.gui.history.hidePrintStatus
|
||||
const hideStatus = rootState.gui.view.history.hidePrintStatus
|
||||
|
||||
return state.jobs.filter((job: ServerHistoryStateJob) => {
|
||||
return !hideStatus.includes(job.status)
|
||||
|
||||
Reference in new issue
Block a user