chore: fix eslint rules and update from develop

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-08-28 20:47:58 +02:00
1 parent b2447ee9d9
commit fb0bc9755e
7 files changed
+732 -732

No files matched your search

+1 -1
View File
@@ -62,7 +62,7 @@ import SettingsPresetsTab from '@/components/settings/SettingsPresetsTab.vue'
import SettingsRemotePrintersTab from '@/components/settings/SettingsRemotePrintersTab.vue'
import SettingsThemeTab from '@/components/settings/SettingsThemeTab.vue'
import SettingsDashboardTab from '@/components/settings/SettingsDashboardTab.vue'
import SettingsGCodeViewerTab from "@/components/settings/SettingsGCodeViewerTab.vue"
import SettingsGCodeViewerTab from '@/components/settings/SettingsGCodeViewerTab.vue'
@Component({
components: {
SettingsThemeTab,
File diff suppressed because it is too large. Load diff
+176 -176
View File
@@ -1,212 +1,212 @@
<template>
<div>
<v-card flat>
<v-card-text>
<settings-row :title="$t('Settings.GCodeViewerTab.ShowCursor')" class="my-2">
<v-switch class="mt-0" hide-details v-model="showCursor"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ShowAxes')" class="my-2">
<v-switch class="mt-0" hide-details v-model="showAxes"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ColorMode')">
<v-select :items="colorModes" dense hide-details outlined selected v-model="colorMode"></v-select>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ProgressColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="progressColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="progressColor" @update:color="updateColorValue('progressColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.BackgroundColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="backgroundColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="backgroundColor" @update:color="updateColorValue('backgroundColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.GridColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="gridColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="gridColor" @update:color="updateColorValue('gridColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ExtruderColor')" class="my-2">
<v-row no-gutters>
<v-menu :close-on-content-click="false" :key="index" bottom left offset-y v-for="(extruderColor, index) in extruderColors">
<template v-slot:activator="{ on, attrs }">
<v-col align="right" class="mt-1" cols="12">
<span class="mr-2">{{index}}</span>
<v-btn :color="extruderColors[index]" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</v-col>
</template>
<v-color-picker :value="extruderColors[index]" @update:color="colorsUpdated($event, index)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</v-row>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MinFeed')">
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="minFeed"></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MinColor')">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="minFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="minFeedColor" @update:color="updateColorValue('minFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MaxFeed')">
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="maxFeed"></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MaxColor')">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="maxFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="maxFeedColor" @update:color="updateColorValue('maxFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
</v-card-text>
</v-card>
</div>
<div>
<v-card flat>
<v-card-text>
<settings-row :title="$t('Settings.GCodeViewerTab.ShowCursor')" class="my-2">
<v-switch class="mt-0" hide-details v-model="showCursor"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ShowAxes')" class="my-2">
<v-switch class="mt-0" hide-details v-model="showAxes"></v-switch>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ColorMode')">
<v-select :items="colorModes" dense hide-details outlined selected v-model="colorMode"></v-select>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ProgressColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="progressColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="progressColor" @update:color="updateColorValue('progressColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.BackgroundColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="backgroundColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="backgroundColor" @update:color="updateColorValue('backgroundColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.GridColor')" class="my-2">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="gridColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="gridColor" @update:color="updateColorValue('gridColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.ExtruderColor')" class="my-2">
<v-row no-gutters>
<v-menu :close-on-content-click="false" :key="index" bottom left offset-y v-for="(extruderColor, index) in extruderColors">
<template v-slot:activator="{ on, attrs }">
<v-col align="right" class="mt-1" cols="12">
<span class="mr-2">{{index}}</span>
<v-btn :color="extruderColors[index]" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</v-col>
</template>
<v-color-picker :value="extruderColors[index]" @update:color="colorsUpdated($event, index)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</v-row>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MinFeed')">
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="minFeed"></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MinColor')">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="minFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="minFeedColor" @update:color="updateColorValue('minFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MaxFeed')">
<v-text-field :rules="[v => v > 0 || 'Minimum speed is 1']" @blur="feedBlur" dense hide-details="auto" outlined suffix="mm/s" type="number" v-model="maxFeed"></v-text-field>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.GCodeViewerTab.MaxColor')">
<v-menu :close-on-content-click="false" bottom left offset-y>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="maxFeedColor" class="minwidth-0 px-5" small v-bind="attrs" v-on="on"></v-btn>
</template>
<v-color-picker :value="maxFeedColor" @update:color="updateColorValue('maxFeedColor', $event)" hide-mode-switch mode="rgba"></v-color-picker>
</v-menu>
</settings-row>
</v-card-text>
</v-card>
</div>
</template>
<script lang="ts">
import {Component, Mixins, Watch} from 'vue-property-decorator';
import BaseMixin from '@/components/mixins/base';
import SettingsRow from '@/components/settings/SettingsRow.vue';
import {Debounce} from 'vue-debounce-decorator';
import Vue from 'vue';
import {Component, Mixins} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import SettingsRow from '@/components/settings/SettingsRow.vue'
import {Debounce} from 'vue-debounce-decorator'
import Vue from 'vue'
@Component({
components: {SettingsRow},
components: {SettingsRow},
})
export default class SettingsGCodeViewerTab extends Mixins(BaseMixin) {
get showCursor(): boolean {
return this.$store.state.gui.gcodeViewer.showCursor;
}
get showCursor(): boolean {
return this.$store.state.gui.gcodeViewer.showCursor
}
set showCursor(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showCursor', value: newVal});
}
set showCursor(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showCursor', value: newVal})
}
get showAxes(): boolean {
return this.$store.state.gui.gcodeViewer.showAxes;
}
get showAxes(): boolean {
return this.$store.state.gui.gcodeViewer.showAxes
}
set showAxes(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showAxes', value: newVal});
}
set showAxes(newVal: boolean) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.showAxes', value: newVal})
}
get extruderColors(): Array<string> {
return this.$store.state.gui.gcodeViewer.extruderColors;
}
get extruderColors(): Array<string> {
return this.$store.state.gui.gcodeViewer.extruderColors
}
@Debounce(500)
colorsUpdated(value: any, index: number): void {
let colors = this.extruderColors;
colors[index] = value.hex;
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.extruderColors', value: colors});
}
@Debounce(500)
colorsUpdated(value: any, index: number): void {
let colors = this.extruderColors
colors[index] = value.hex
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.extruderColors', value: colors})
}
colorModes = [
{text: 'Extruder', value: 'extruder'},
{text: 'Feed Rate', value: 'feedrate'},
];
colorModes = [
{text: 'Extruder', value: 'extruder'},
{text: 'Feed Rate', value: 'feedrate'},
];
get colorMode(): string {
return this.$store.state.gui.gcodeViewer.colorMode;
}
get colorMode(): string {
return this.$store.state.gui.gcodeViewer.colorMode
}
set colorMode(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.colorMode', value: newVal});
}
set colorMode(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.colorMode', value: newVal})
}
get backgroundColor(): string {
return this.$store.state.gui.gcodeViewer.backgroundColor;
}
get backgroundColor(): string {
return this.$store.state.gui.gcodeViewer.backgroundColor
}
set backgroundColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.backgroundColor', value: newVal});
}
set backgroundColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.backgroundColor', value: newVal})
}
get gridColor(): string {
return this.$store.state.gui.gcodeViewer.gridColor;
}
get gridColor(): string {
return this.$store.state.gui.gcodeViewer.gridColor
}
set gridColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.gridColor', value: newVal});
}
set gridColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.gridColor', value: newVal})
}
@Debounce(500)
updateColorValue(colorElement: string, newVal: any): void {
Vue.set(this, colorElement, this.clearColorObject(newVal));
}
@Debounce(500)
updateColorValue(colorElement: string, newVal: any): void {
Vue.set(this, colorElement, this.clearColorObject(newVal))
}
clearColorObject(color: any): string {
if (typeof color === 'object' && 'hex' in color) color = color.hex;
if (color.length > 7) color = color.substr(0, 7);
return color;
}
clearColorObject(color: any): string {
if (typeof color === 'object' && 'hex' in color) color = color.hex
if (color.length > 7) color = color.substr(0, 7)
return color
}
get minFeed(): number {
return this.$store.state.gui.gcodeViewer.minFeed;
}
get minFeed(): number {
return this.$store.state.gui.gcodeViewer.minFeed
}
set minFeed(newVal: number) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeed', value: newVal});
}
set minFeed(newVal: number) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeed', value: newVal})
}
get maxFeed(): number {
return this.$store.state.gui.gcodeViewer.maxFeed;
}
get maxFeed(): number {
return this.$store.state.gui.gcodeViewer.maxFeed
}
set maxFeed(newVal: number) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeed', value: newVal});
}
set maxFeed(newVal: number) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeed', value: newVal})
}
get minFeedColor(): string {
return this.$store.state.gui.gcodeViewer.minFeedColor;
}
get minFeedColor(): string {
return this.$store.state.gui.gcodeViewer.minFeedColor
}
set minFeedColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeedColor', value: newVal});
}
set minFeedColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.minFeedColor', value: newVal})
}
get maxFeedColor(): string {
return this.$store.state.gui.gcodeViewer.maxFeedColor;
}
get maxFeedColor(): string {
return this.$store.state.gui.gcodeViewer.maxFeedColor
}
set maxFeedColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeedColor', value: newVal});
}
set maxFeedColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.maxFeedColor', value: newVal})
}
feedBlur(): void {
if (this.minFeed < 1) this.minFeed = 1;
if (this.maxFeed < this.minFeed) this.maxFeed = this.minFeed + 1;
}
feedBlur(): void {
if (this.minFeed < 1) this.minFeed = 1
if (this.maxFeed < this.minFeed) this.maxFeed = this.minFeed + 1
}
get progressColor(): string {
return this.$store.state.gui.gcodeViewer.progressColor;
}
get progressColor(): string {
return this.$store.state.gui.gcodeViewer.progressColor
}
set progressColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.progressColor', value: newVal});
}
set progressColor(newVal: string) {
this.$store.dispatch('gui/saveSetting', {name: 'gcodeViewer.progressColor', value: newVal})
}
}
</script>
+3 -3
View File
@@ -1077,8 +1077,8 @@ export default class PageFiles extends Mixins(BaseMixin) {
})
}
view3D(item: FileStateFile) {
this.$router.push({path: '/viewer', query: {filename: this.currentPath + '/' + item.filename}});
}
view3D(item: FileStateFile) {
this.$router.push({path: '/viewer', query: {filename: this.currentPath + '/' + item.filename}})
}
}
</script>
+4 -4
View File
@@ -3,12 +3,12 @@
</template>
<script lang="ts">
import BaseMixin from '@/components/mixins/base';
import {Component, Mixins} from 'vue-property-decorator';
import Viewer from '@/components/gcodeviewer/Viewer.vue';
import BaseMixin from '@/components/mixins/base'
import {Component, Mixins} from 'vue-property-decorator'
import Viewer from '@/components/gcodeviewer/Viewer.vue'
@Component({
components: {Viewer},
components: {Viewer},
})
export default class PageGCodeViewer extends Mixins(BaseMixin) {}
</script>
+2 -2
View File
@@ -60,12 +60,12 @@ const routes: AppRoute[] = [
registeredDirectory: 'gcodes',
},
{
title: "G-Code Viewer",
title: 'G-Code Viewer',
path: '/viewer',
icon: 'video-3d',
component: Viewer,
alwaysShow: false,
showInNavi: true,
showInNavi: true,
},
{
title: 'History',
+15 -15
View File
@@ -164,21 +164,21 @@ export const getDefaultState = (): GuiState => {
//moonraker DB api dont accept camel case key names
remotePrinters: [],
presets: [],
cooldownGcode: 'TURN_OFF_HEATERS'
gcodeViewer: {
showCursor : true,
extruderColors : ['#00FFFFFF','#FF00FFFF','#FFFF00FF','#000000FF','#FFFFFFFF'],
gridColor : '#0000FF',
backgroundColor : '#000000',
colorMode : 'extruder',
showAxes : 'true',
minFeed : 20,
maxFeed : 100,
minFeedColor : "#0000FF",
maxFeedColor : "#FF0000",
forceLineRendering : false,
progressColor : "#FFFFFF"
}
cooldownGcode: 'TURN_OFF_HEATERS',
gcodeViewer: {
showCursor : true,
extruderColors : ['#00FFFFFF','#FF00FFFF','#FFFF00FF','#000000FF','#FFFFFFFF'],
gridColor : '#0000FF',
backgroundColor : '#000000',
colorMode : 'extruder',
showAxes : 'true',
minFeed : 20,
maxFeed : 100,
minFeedColor : '#0000FF',
maxFeedColor : '#FF0000',
forceLineRendering : false,
progressColor : '#FFFFFF'
}
}
}