diff --git a/docs/_data/themes.csv b/docs/_data/themes.csv index 61fa655e..5bde75b2 100644 --- a/docs/_data/themes.csv +++ b/docs/_data/themes.csv @@ -2,3 +2,4 @@ name,short_note,author,repo Dracula,,steadyjaw,dracula-mainsail-theme Cyberpunk,,Dario-Ciceri,cp2077-mainsail-theme Mainsail x Voron Toolhead,Various toolhead images inside the theme folder can be renamed to 'sidebar-background.png',eriroh,Mainsail-x-Voron-Toolhead-Theme +Rat Rig (unofficial), includes various sidebar images which can be renamed to ‘sidebar-background.png’,Raabi91,ratrig-mainsail-theme diff --git a/docs/faq/index.md b/docs/faq/index.md new file mode 100644 index 00000000..bbb76770 --- /dev/null +++ b/docs/faq/index.md @@ -0,0 +1,13 @@ +--- +layout: default +title: FAQ +nav_order: 110 +has_children: true +permalink: /faq/ +has_toc: false +--- +# Frequently Askes Questions + +We are still gathering some "frequently asked questions" and will publish them here soon. + +The primary reason why this section already exists, is because of the Klipper warnings in the subcategory, that needed to be fixed fast. diff --git a/docs/faq/klipper_warnings/deprecated_option.md b/docs/faq/klipper_warnings/deprecated_option.md new file mode 100644 index 00000000..d526ddf8 --- /dev/null +++ b/docs/faq/klipper_warnings/deprecated_option.md @@ -0,0 +1,95 @@ +--- +layout: default +title: Deprecated Options +parent: Klipper Warnings +grand_parent: FAQ +nav_order: 20 +has_children: false +permalink: /faq/klipper_warnings/deprecated_option +has_toc: false +--- + +# Deprecated Options + +###### default_parameter +## Removal of `default_parameter_` for gcode macros. + +In the past, default parameters for gcode macros were defined like so: + +```yaml +[gcode_macro PRINT_START] +default_parameter_EXTRUDER: 230 +gcode: + ... +``` +This would define a macro called `PRINT_START` that can be called with an `EXTRUDER` parameter like so: `PRINT_START EXTRUDER=200`. If no value is passed for `EXTRUDER` the default value of 230 is used. This style of default parameters has been deprecated. Instead, define your macro like so: + +{% raw %} +```yaml +[gcode_macro PRINT_START] +gcode: + {% set EXTRUDER_TEMP = params.EXTRUDER|default(10)|int %} +``` +{% endraw %} +Take note of the following important aspects: +- Parameters passed to gcode macros are stored in the `params` object. So if your macro is called with `VALUE=50`, `params.VALUE` will contain the value 50. After the deprecation, only the `params` object will contain these values. +- Make sure to name your "set variable" something else as the name of the variable in the `params` object (see how I used `EXTRUDER_TEMP` for the "set variable" and `EXTRUDER` for the actual macro parameter above) to avoid confusion and possible parsing errors. +- If you want to pass a default, add `|default()` to the end of the params variable (see above, where my default value is 10). +- To ensure that `EXTRUDER_TEMP` will have an integer value, add `|int` to the end of the command, to turn passed parameters (if they exist) and the default into an integer. Depending on what kind of parameter you're passing, there are `|int` `|float` `|bool` or `|string` converters available. Make sure that you convert to int if you want to compare the values in your gcode macro. + +The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot! +[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}. +{: .info} + +###### step_distance +## Removal of `step_distance` + +`step_distance` describes the distance covered by a certain axis with 1 stepper (micro-)step. The downside of this parameter (and one of the reasons for its removal, is that if one were to change the microstepping of a stepper, the step_distance changes as well. Klipper therefore removed the `step_distance` parameter in favor of `rotation_distance` and `full_steps_per_rotation`. These two parameters are unaffected by microstepping, and can be easily determined by inspecting the used hardware. + +Perform the following steps to convert your config: +- comment out the old `step_distance` parameter +- add three new parameters: + - `full_steps_per_rotation` this is 400 for 0.9 degree stepper motors and 200 for 1.8 degree stepper motors. + - `rotation_distance` this can be determined either according to hardware, or by converting the old `step_distance` using math. + - `gear_ratio` can additionally be used to describe an axis that uses a reduction gear (like the Voron-2 Z axis) + - The easiest way to obtain the correct values for `rotation_distance` and `gear_ratio` is to check the official Voron printer github repositories. All example configs have been updated to include the correct values for the new parameters. Keep in mind that you'll still have to calibrate your extruder steps/mm if you choose to copy the values for the extruder. Instructions on how to convert and recalibrate the extruder values can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#extruder). + - The formulas to convert `step_distance` to `rotation distance` can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-from-steps_per_mm-or-step_distance) + - Guidance on how to inspect your hardware to determine your conversion distance can be found [here](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#obtaining-rotation_distance-by-inspecting-the-hardware). Make sure to also consider any reduction gearing, if applicable, by checking [this section](https://github.com/Klipper3d/klipper/blob/master/docs/Rotation_Distance.md#using-a-gear_ratio) as well. + - For every stepper, except your extruder, you should end up with even numbers (e.g. 40 instead of 39.9683). + +The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot! +[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}. +{: .info} + +###### pin_map +## Removal of `pin_map` + +For Voron printers, this is only relevant if you're running an arduino based controller board and use pins named similar to `ar19` etc. These pin declarations are no longer valid and need to be replaced with their hardware pin identifiers. To find the appropriate hardware pin identifier perform a google image search for your board plus `pinout`. E.g.: + +`arduino mega 2560 pinout` + +which will yield images such as this one: + +![image](https://user-images.githubusercontent.com/4352664/138724260-5813281d-d62d-4b0c-87ee-1f64d301c15f.png) + +There, find the pin you're trying to replace. The old pin maps use the digital number of the pin. For example, if your old pin was `ar10`, looking at the image you will find that the `D10` pin corresponds to `PB4`. Replace all pins in your config accordingly, and finally remove the `pin_map:` configuration parameter from your `mcu` section. + +Alternatively, you can copy an appropriate `[board_pins]` block from [this location](https://github.com/Klipper3d/klipper/blob/master/config/sample-aliases.cfg) to your config. If you're using multiple arduinos, make sure to add the appropriate mcu to each block like so: + +```yaml +[board_pins arduino-mega] +mcu: mcu +``` + +The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot! +[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}. +{: .info} + +###### pid_integral_max +## Removal of `pid_integral_max` + +Remove any instances of `pid_integral_max` from your config. + +The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot! +[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}. +{: .info} diff --git a/docs/faq/klipper_warnings/deprecated_value.md b/docs/faq/klipper_warnings/deprecated_value.md new file mode 100644 index 00000000..575e0aed --- /dev/null +++ b/docs/faq/klipper_warnings/deprecated_value.md @@ -0,0 +1,21 @@ +--- +layout: default +title: Deprecated Values +parent: Klipper Warnings +grand_parent: FAQ +nav_order: 10 +has_children: false +permalink: /faq/klipper_warnings/deprecated_value +has_toc: false +--- + +# Deprecated Values + +###### rpi_temperature +## Removal of `rpi_temperature` sensor alias. + +Replace `sensor_type: rpi_temperature` by `sensor_type: temperature_host` everywhere in your config. + +The above description was provided by our community member [FHeilmann](https://github.com/FHeilmann){:target="_blank"} and we have his permission to publish it here. Thanks a lot! +[Source](https://gist.github.com/FHeilmann/a8097b3e908e85de7255bbe6246ddfd5){:target="_blank"}. +{: .info} diff --git a/docs/faq/klipper_warnings/index.md b/docs/faq/klipper_warnings/index.md new file mode 100644 index 00000000..a658f853 --- /dev/null +++ b/docs/faq/klipper_warnings/index.md @@ -0,0 +1,9 @@ +--- +layout: default +title: Klipper Warnings +parent: FAQ +nav_order: 10 +has_children: true +permalink: /faq/klipper_warnings +has_toc: false +--- diff --git a/package-lock.json b/package-lock.json index c56b1e35..8ec6fdb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "object-assign-deep": "^0.4.0", "sass-loader": "^10.2.0", "semver": "^7.3.5", + "uuid": "^8.3.2", "vue": "^2.6.14", "vue-class-component": "^7.2.6", "vue-context": "^6.0.0", @@ -47,6 +48,7 @@ "devDependencies": { "@mdi/font": "^6.2.95", "@types/semver": "^7.3.8", + "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.28.5", "@typescript-eslint/parser": "^4.29.3", "@vue/cli-plugin-babel": "^4.5.13", @@ -2238,6 +2240,12 @@ "node": ">=0.10.0" } }, + "node_modules/@types/uuid": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", + "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", + "dev": true + }, "node_modules/@types/webpack": { "version": "4.41.29", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.29.tgz", @@ -15133,6 +15141,16 @@ "node": ">= 6" } }, + "node_modules/request/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "devOptional": true, + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -16149,6 +16167,16 @@ "ms": "^2.1.1" } }, + "node_modules/sockjs/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -18037,13 +18065,11 @@ } }, "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "devOptional": true, + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "bin": { - "uuid": "bin/uuid" + "uuid": "dist/bin/uuid" } }, "node_modules/v8-compile-cache": { @@ -19471,6 +19497,16 @@ "node": ">= 6" } }, + "node_modules/webpack-log/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/webpack-merge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", @@ -22045,6 +22081,12 @@ } } }, + "@types/uuid": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.1.tgz", + "integrity": "sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==", + "dev": true + }, "@types/webpack": { "version": "4.41.29", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.29.tgz", @@ -32185,6 +32227,14 @@ "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "devOptional": true + } } }, "require-directory": { @@ -32988,6 +33038,14 @@ "faye-websocket": "^0.11.3", "uuid": "^3.4.0", "websocket-driver": "^0.7.4" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + } } }, "sockjs-client": { @@ -34522,10 +34580,9 @@ "dev": true }, "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "devOptional": true + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" }, "v8-compile-cache": { "version": "2.3.0", @@ -35677,6 +35734,14 @@ "requires": { "ansi-colors": "^3.0.0", "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + } } }, "webpack-merge": { diff --git a/package.json b/package.json index 449b8024..5f8dbe69 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@codemirror/state": "^0.19.1", "@codemirror/stream-parser": "^0.19.1", "@codemirror/view": "^0.19.1", + "@codemirror/search": "^0.19.2", "@sindarius/gcodeviewer": "^2.1.13", "axios": "^0.21.1", "core-js": "^3.16.0", @@ -33,6 +34,7 @@ "object-assign-deep": "^0.4.0", "sass-loader": "^10.2.0", "semver": "^7.3.5", + "uuid": "^8.3.2", "vue": "^2.6.14", "vue-class-component": "^7.2.6", "vue-context": "^6.0.0", @@ -53,6 +55,7 @@ "devDependencies": { "@mdi/font": "^6.2.95", "@types/semver": "^7.3.8", + "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.28.5", "@typescript-eslint/parser": "^4.29.3", "@vue/cli-plugin-babel": "^4.5.13", diff --git a/public/fonts/robotoMono-regular.woff b/public/fonts/robotoMono-regular.woff new file mode 100644 index 00000000..dbe7504e Binary files /dev/null and b/public/fonts/robotoMono-regular.woff differ diff --git a/src/assets/styles/fonts.css b/src/assets/styles/fonts.css index 0269f783..89491583 100644 --- a/src/assets/styles/fonts.css +++ b/src/assets/styles/fonts.css @@ -45,4 +45,12 @@ font-weight: 900; src: local('Roboto Black'), local('Roboto-Black'), url(/fonts/roboto-black.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +/* latin */ +@font-face { + font-family: 'Roboto Mono'; + font-style: normal; + font-weight: 400; + src: local('Roboto Mono'), local('Roboto-Mono'), url(/fonts/robotoMono-regular.woff) format('woff'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; } \ No newline at end of file diff --git a/src/components/TheEditor.vue b/src/components/TheEditor.vue index 5dcc24aa..271706f0 100644 --- a/src/components/TheEditor.vue +++ b/src/components/TheEditor.vue @@ -6,19 +6,19 @@ + + + + + + {{ $t('Editor.UnsavedChanges') }} + + + + mdi-close-thick + + + + + + +

{{ $t('Editor.UnsavedChangesMessage', {filename: filename}) }}

+

{{ $t('Editor.UnsavedChangesSubMessage') }}

+
+
+ + + + + {{ $t('Editor.Cancel') }} + + + {{ $t('Editor.DontSave') }} + + + + {{ $t('Editor.SaveClose') }} + + +
+
+
+
@@ -65,16 +107,23 @@ import {Component, Mixins} from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import {formatFilesize} from '@/plugins/helpers' import Codemirror from '@/components/inputs/Codemirror.vue' + @Component({ components: {Codemirror} }) export default class TheEditor extends Mixins(BaseMixin) { + private dialogConfirmChange = false + formatFilesize = formatFilesize refs!: { editor: any } + get changed() { + return this.$store.state.editor.changed ? '*' : '' + } + get show() { return this.$store.state.editor.bool ?? false } @@ -146,11 +195,33 @@ export default class TheEditor extends Mixins(BaseMixin) { this.$store.dispatch('editor/cancelLoad') } + escClose() { + if (this.$store.state.gui.editor.escToClose) + this.close() + } + close() { + if (this.$store.state.gui.editor.confirmUnsavedChanges) + this.promptUnsavedChanges() + else + this.$store.dispatch('editor/close') + } + + discardChanges() { + this.dialogConfirmChange = false this.$store.dispatch('editor/close') } + promptUnsavedChanges() { + if (!this.$store.state.editor.changed) + this.$store.dispatch('editor/close') + else + this.dialogConfirmChange = true + } + save(restartServiceName: string | null = null) { + this.dialogConfirmChange = false + this.$store.dispatch('editor/saveFile', { content: this.sourcecode, restartServiceName: restartServiceName diff --git a/src/components/TheSettingsMenu.vue b/src/components/TheSettingsMenu.vue index 90f0b4c4..e55860d1 100644 --- a/src/components/TheSettingsMenu.vue +++ b/src/components/TheSettingsMenu.vue @@ -35,7 +35,7 @@ - + @@ -59,6 +59,8 @@ import SettingsRemotePrintersTab from '@/components/settings/SettingsRemotePrint import SettingsThemeTab from '@/components/settings/SettingsThemeTab.vue' import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue' import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue' +import SettingsEditorTab from '@/components/settings/SettingsEditorTab.vue' + import Panel from '@/components/ui/Panel.vue' @Component({ components: { @@ -72,7 +74,8 @@ import Panel from '@/components/ui/Panel.vue' SettingsWebcamTab, SettingsGeneralTab, SettingsDashboardTab, - SettingsGCodeViewerTab + SettingsGCodeViewerTab, + SettingsEditorTab } }) export default class TheSettingsMenu extends Mixins(BaseMixin) { @@ -134,12 +137,21 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) { icon: 'mdi-video-3d', name: 'g-code-viewer', title: this.$t('Settings.GCodeViewerTab.GCodeViewer') + }, + { + icon: 'mdi-file-document-edit-outline', + name: 'editor', + title: this.$t('Settings.EditorTab.Editor') } ] } @Watch('activeTab') activeTabWatch() { + this.scrollToTop() + } + + scrollToTop() { if (this.$refs.settingsScroll) this.$refs.settingsScroll.$el.scrollTop = 0 } } diff --git a/src/components/console/ConsoleTableEntry.vue b/src/components/console/ConsoleTableEntry.vue index 60ec6f42..76445b6f 100644 --- a/src/components/console/ConsoleTableEntry.vue +++ b/src/components/console/ConsoleTableEntry.vue @@ -1,6 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/components/inputs/MiscellaneousSlider.vue b/src/components/inputs/MiscellaneousSlider.vue index 46d4a49c..cd1f3dab 100644 --- a/src/components/inputs/MiscellaneousSlider.vue +++ b/src/components/inputs/MiscellaneousSlider.vue @@ -99,8 +99,6 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) { } increment() { - window.console.log(this.value) - this.value = this.value < 1.0 ? Math.round((this.value + 0.01) * 100) / 100 : 1.0 if (this.value < this.off_below) this.value = this.off_below this.sendCmd() diff --git a/src/components/mixins/dashboard.ts b/src/components/mixins/dashboard.ts new file mode 100644 index 00000000..3779474c --- /dev/null +++ b/src/components/mixins/dashboard.ts @@ -0,0 +1,87 @@ +import Component from 'vue-class-component' +import BaseMixin from '@/components/mixins/base' +import {allDashboardPanels} from '@/store/variables' +import {GuiStateMacrogroup} from '@/store/gui/types' +import {capitalize} from '@/plugins/helpers' + +@Component +export default class DashboardMixin extends BaseMixin { + + get macroMode() { + return this.$store.state.gui.dashboard.macroManagement ?? 'simple' + } + + get macrogroups() { + return this.$store.state.gui.dashboard.macrogroups ?? [] + } + + get missingPanelsMobile() { + const panels = [ + ...this.$store.state.gui.dashboard.mobileLayout, + ] + + return this.checkMissingPanels(panels) + } + + get missingPanelsTablet() { + const panels = [ + ...this.$store.state.gui.dashboard.tabletLayout1, + ...this.$store.state.gui.dashboard.tabletLayout2, + ] + + return this.checkMissingPanels(panels) + } + + get missingPanelsDesktop() { + const panels = [ + ...this.$store.state.gui.dashboard.desktopLayout1, + ...this.$store.state.gui.dashboard.desktopLayout2, + ] + + return this.checkMissingPanels(panels) + } + + get missingPanelsWidescreen() { + const panels = [ + ...this.$store.state.gui.dashboard.widescreenLayout1, + ...this.$store.state.gui.dashboard.widescreenLayout2, + ...this.$store.state.gui.dashboard.widescreenLayout3, + ] + + return this.checkMissingPanels(panels) + } + + checkMissingPanels(panels: any[]) { + let allPanels = [...allDashboardPanels] + const missingPanels: any[] = [] + + if (this.macroMode === 'expert') { + this.macrogroups.forEach((group: GuiStateMacrogroup) => { + allPanels.push('macrogroup_'+group.id) + }) + + allPanels = allPanels.filter((name) => name !== 'macros') + } + + allPanels.forEach((panelname) => { + if (!panels.find((panel) => panel.name === panelname)) + missingPanels.push({ + name: panelname, + visable: true + }) + }) + + return missingPanels + } + + getPanelName(name: string) { + if (name.startsWith('macrogroup_')) { + const groupId = name.split('_')[1] ?? '' + const group = this.macrogroups.find((group: GuiStateMacrogroup) => group.id === groupId) + + return (group) ? group.name : 'Macrogroup' + } + + return this.$t('Panels.'+capitalize(name)+'Panel.Headline') + } +} \ No newline at end of file diff --git a/src/components/panels/Machine/EndstopPanel.vue b/src/components/panels/Machine/EndstopPanel.vue index d4be18c7..d53c3cb6 100644 --- a/src/components/panels/Machine/EndstopPanel.vue +++ b/src/components/panels/Machine/EndstopPanel.vue @@ -79,7 +79,6 @@ export default class EndstopPanel extends Mixins(BaseMixin) { syncEndstops() { this.$socket.emit('printer.query_endstops.status', { }, { action: 'printer/getEndstopStatus', loading: 'queryEndstops' }) if (this.existProbe) { - window.console.log('exist probe') this.$store.dispatch('server/addEvent', { message: 'QUERY_PROBE', type: 'command' }) this.$socket.emit('printer.gcode.script', { script: 'QUERY_PROBE' }) } diff --git a/src/components/panels/Machine/UpdatePanel.vue b/src/components/panels/Machine/UpdatePanel.vue index 63884b53..c1e6d00d 100644 --- a/src/components/panels/Machine/UpdatePanel.vue +++ b/src/components/panels/Machine/UpdatePanel.vue @@ -475,8 +475,6 @@ export default class UpdatePanel extends Mixins(BaseMixin) { } this.commitsOverlay.bool = true - - window.console.log(this.commitsOverlay.groupedCommits) } } diff --git a/src/components/panels/MacrogroupPanel.vue b/src/components/panels/MacrogroupPanel.vue new file mode 100644 index 00000000..38f89b19 --- /dev/null +++ b/src/components/panels/MacrogroupPanel.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/components/panels/MacrosPanel.vue b/src/components/panels/MacrosPanel.vue index 645035d7..bdf907db 100644 --- a/src/components/panels/MacrosPanel.vue +++ b/src/components/panels/MacrosPanel.vue @@ -1,7 +1,3 @@ - -