Merge remote-tracking branch 'meteyou/master' into feature/gcodeviewer

This commit is contained in:
Juan Rosario committed 2021-08-06 13:58:29 -05:00
commit 9437da4444
8 files changed
+151 -71

No files matched your search

@@ -1,9 +1,5 @@
<style scoped lang="scss">
.consoleTable.mini {
max-height: 300px;
overflow-y: auto;
overflow-x: hidden;
}
</style>
<template>
@@ -29,7 +25,7 @@
import Component from "vue-class-component";
import Vue from "vue";
import {Prop} from "vue-property-decorator";
import ConsoleTableEntry from "@/components/ConsoleTableEntry.vue";
import ConsoleTableEntry from "@/components/console/ConsoleTableEntry.vue";
@Component({
components: {ConsoleTableEntry}
})
+46 -15
View File
@@ -6,13 +6,13 @@
</style>
<template>
<v-card v-if="socketIsConnected" class="mb-9">
<v-toolbar flat dense>
<v-card v-if="socketIsConnected" class="mb-6 d-flex flex-column">
<v-toolbar flat dense class="order-0">
<v-toolbar-title>
<span class="subheading"><v-icon left>mdi-console-line</v-icon>{{ $t("Panels.MiniconsolePanel.Headline") }}</span>
</v-toolbar-title>
</v-toolbar>
<v-card-text>
<v-card-text :class="consoleDirection === 'table' ? 'order-1' : 'order-2'">
<v-row>
<v-col>
<v-textarea
@@ -41,7 +41,7 @@
<command-help-modal @onCommand="gcode = $event" ></command-help-modal>
<v-menu :offset-y="true" :close-on-content-click="false" :title="$t('Panels.MiniconsolePanel.SetupConsole')">
<template v-slot:activator="{ on, attrs }">
<v-btn class="px-2 minwidth-0" color="grey darken-3 ml-3" v-bind="attrs" v-on="on"><v-icon>mdi-cog</v-icon></v-btn>
<v-btn class="px-2 minwidth-0" color="grey darken-3 ml-3" v-bind="attrs" v-on="on"><v-icon>mdi-filter</v-icon></v-btn>
</template>
<v-list>
<v-list-item class="minHeight36">
@@ -55,14 +55,17 @@
</v-col>
</v-row>
</v-card-text>
<v-card-text class="pa-0">
<v-card-text :class="(consoleDirection === 'table' ? 'order-2' : 'order-1') + ' pa-0'">
<v-row>
<v-col class="pb-0">
<console-table ref="console"
:events="events"
:is-mini="true"
@command-click="commandClick"
/>
<v-col>
<perfect-scrollbar ref="miniConsoleScroll" :class="'d-flex flex-column '+(consoleDirection === 'shell' ? 'justify-end' : '')" :style="'height: '+consoleHeight+'px;'">
<console-table ref="console"
:events="events"
:is-mini="true"
@command-click="commandClick"
/>
<v-divider></v-divider>
</perfect-scrollbar>
</v-col>
</v-row>
</v-card-text>
@@ -71,11 +74,12 @@
<script lang="ts">
import { strLongestEqual, reverseString} from "@/plugins/helpers"
import { Component, Mixins } from 'vue-property-decorator'
import {Component, Mixins, Watch} from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import {CommandHelp, VTextareaType} from "@/store/printer/types";
import ConsoleTable from "@/components/ConsoleTable.vue";
import ConsoleTable from "@/components/console/ConsoleTable.vue";
import CommandHelpModal from "@/components/CommandHelpModal.vue";
import Vue from "vue";
@Component({
components: {
@@ -86,7 +90,8 @@ import CommandHelpModal from "@/components/CommandHelpModal.vue";
export default class MiniconsolePanel extends Mixins(BaseMixin) {
$refs!: {
gcodeCommandField: VTextareaType,
console: ConsoleTable
console: ConsoleTable,
miniConsoleScroll: any
}
private gcode = ""
@@ -99,8 +104,21 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
return this.$store.state.printer.helplist ?? []
}
get consoleDirection() {
return this.$store.state.gui.console.direction ?? 'table'
}
get consoleHeight() {
return this.$store.state.gui.console.height ?? 300
}
get events() {
return this.$store.getters["server/getConsoleEvents"].slice(0, 250)
return this.$store.getters["server/getConsoleEvents"](this.consoleDirection === 'table', 250)
}
@Watch('events')
eventsChanged() {
if (this.consoleDirection === 'shell') this.scrollToBottom()
}
get hideWaitTemperatures(): boolean {
@@ -208,5 +226,18 @@ export default class MiniconsolePanel extends Mixins(BaseMixin) {
toggleFilter(filter: string) {
this.$store.dispatch('gui/updateConsoleFilter', filter)
}
mounted() {
if (this.consoleDirection === 'shell') this.scrollToBottom()
}
scrollToBottom() {
this.$nextTick(() => {
if (this.$refs.miniConsoleScroll) {
const perfectScroll = ((this.$refs.miniConsoleScroll as Vue).$el as HTMLDivElement)
perfectScroll.scrollTop = perfectScroll.scrollHeight
}
})
}
}
</script>
+49 -7
View File
@@ -6,8 +6,12 @@
<div>
<v-card flat v-if="!form.bool">
<v-card-text>
<settings-row :title="$t('Settings.ConsoleTab.ShowOnDashboard')" :dynamic-slot-width="true">
<v-switch v-model="boolShowOnDashboard" hide-details class="mt-0"></v-switch>
<settings-row :title="$t('Settings.ConsoleTab.Direction')">
<v-select v-model="consoleDirection" :items="availableDirections" hide-details outlined dense></v-select>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.ConsoleTab.Height')">
<v-slider v-model="consoleHeightTmp" @change="updateConsoleHeight" hide-details :min="200" :max="900" :step="10" :label="consoleHeightTmp+'px'" ></v-slider>
</settings-row>
<v-divider class="my-2"></v-divider>
<settings-row :title="$t('Settings.ConsoleTab.HideTemperatures')" :dynamic-slot-width="true">
@@ -71,9 +75,10 @@
<script lang="ts">
import {Component, Mixins} from "vue-property-decorator";
import {Component, Mixins, Watch} from "vue-property-decorator";
import BaseMixin from "../mixins/base";
import SettingsRow from "@/components/settings/SettingsRow.vue";
import {Debounce} from "vue-debounce-decorator";
interface consoleForm {
bool: boolean
@@ -100,16 +105,53 @@ export default class SettingsConsoleTab extends Mixins(BaseMixin) {
unique: (value: string) => !this.existsPresetName(value) || 'Name already exists',
}
private consoleHeightTmp = 300
mounted() {
this.consoleHeightTmp = this.consoleHeight
}
get consoleFilters() {
return this.$store.getters["gui/getConsoleFilters"] ?? []
}
get boolShowOnDashboard() {
return this.$store.state.gui.console.boolDashboard
get availableDirections() {
return [
{
text: this.$t('Settings.ConsoleTab.DirectionTable'),
value: 'table'
}, {
text: this.$t('Settings.ConsoleTab.DirectionShell'),
value: 'shell'
}
]
}
set boolShowOnDashboard(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.boolDashboard', value: newVal })
get consoleDirection() {
return this.$store.state.gui.console.direction ?? 'table'
}
set consoleDirection(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.direction', value: newVal })
}
get consoleHeight() {
return this.$store.state.gui.console.height ?? 300
}
set consoleHeight(newVal) {
this.$store.dispatch('gui/saveSetting', { name: 'console.height', value: newVal })
}
@Watch('consoleHeight')
consoleHeightChanged(newVal: number) {
this.consoleHeightTmp = newVal
}
@Debounce(500)
updateConsoleHeight(newVal: number) {
window.console.log("updateConsoleHeight", newVal)
this.consoleHeight = newVal
}
get hideWaitTemperatures() {