From 6209172991f0843b905fc47b3da1c956f03688c9 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 13 Jul 2023 21:25:01 +0200 Subject: [PATCH 1/8] refactor: extract Presets and Settings from TemperaturePanel Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelPresets.vue | 105 +++++++++++++ .../Temperature/TemperaturePanelSettings.vue | 55 +++++++ src/components/panels/TemperaturePanel.vue | 141 ++---------------- 3 files changed, 169 insertions(+), 132 deletions(-) create mode 100644 src/components/panels/Temperature/TemperaturePanelPresets.vue create mode 100644 src/components/panels/Temperature/TemperaturePanelSettings.vue diff --git a/src/components/panels/Temperature/TemperaturePanelPresets.vue b/src/components/panels/Temperature/TemperaturePanelPresets.vue new file mode 100644 index 000000000..fb3b6f881 --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelPresets.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/src/components/panels/Temperature/TemperaturePanelSettings.vue b/src/components/panels/Temperature/TemperaturePanelSettings.vue new file mode 100644 index 000000000..df1a73be7 --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelSettings.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/components/panels/TemperaturePanel.vue b/src/components/panels/TemperaturePanel.vue index 50d4702e0..1aaf0efea 100644 --- a/src/components/panels/TemperaturePanel.vue +++ b/src/components/panels/TemperaturePanel.vue @@ -3,80 +3,13 @@ - + - + @@ -228,7 +161,7 @@ mode="hexa" :value="editHeater.color" class="mx-auto" - @update:color="setChartColor"> + @update:color="setChartColor" /> @@ -242,7 +175,6 @@ import Component from 'vue-class-component' import { Mixins } from 'vue-property-decorator' import { capitalize, convertName } from '@/plugins/helpers' import { Debounce } from 'vue-debounce-decorator' -import { GuiPresetsStatePreset } from '@/store/gui/presets/types' import { PrinterStateAdditionalSensor, PrinterStateTemperatureObject } from '@/store/printer/types' import BaseMixin from '@/components/mixins/base' import ControlMixin from '@/components/mixins/control' @@ -250,17 +182,15 @@ import TempChart from '@/components/charts/TempChart.vue' import TemperatureInput from '@/components/inputs/TemperatureInput.vue' import Panel from '@/components/ui/Panel.vue' import Responsive from '@/components/ui/Responsive.vue' -import { mdiCloseThick, mdiCog, mdiSnowflake, mdiFire, mdiMenuDown, mdiThermometerLines } from '@mdi/js' +import { mdiCloseThick, mdiCog, mdiThermometerLines } from '@mdi/js' +import TemperaturePanelPresets from '@/components/panels/Temperature/TemperaturePanelPresets.vue' @Component({ - components: { Panel, TempChart, TemperatureInput, Responsive }, + components: { Panel, TempChart, TemperatureInput, Responsive, TemperaturePanelPresets }, }) export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) { - mdiSnowflake = mdiSnowflake mdiCloseThick = mdiCloseThick mdiCog = mdiCog - mdiFire = mdiFire - mdiMenuDown = mdiMenuDown mdiThermometerLines = mdiThermometerLines convertName = convertName @@ -278,64 +208,16 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) { color: '', } - get presets(): GuiPresetsStatePreset[] { - return this.$store.getters['gui/presets/getPresets'] ?? [] - } - - get cooldownGcode(): string { - return this.$store.getters['gui/presets/getCooldownGcode'] - } - get boolTempchart(): boolean { return this.$store.state.gui.view.tempchart.boolTempchart ?? false } - set boolTempchart(newVal: boolean) { - this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.boolTempchart', value: newVal }) - } - - get autoscaleTempchart(): boolean { - return this.$store.state.gui.view.tempchart.autoscale ?? false - } - - set autoscaleTempchart(newVal: boolean) { - this.$store.dispatch('gui/saveSetting', { name: 'view.tempchart.autoscale', value: newVal }) - } - get temperatureObjects() { const sensors = this.$store.getters['printer/getTemperatureObjects'] ?? [] return sensors.filter((sensor: PrinterStateTemperatureObject) => !sensor.name.startsWith('_')) } - preheat(preset: GuiPresetsStatePreset): void { - for (const [name, attributes] of Object.entries(preset.values)) { - if (attributes.bool) { - let gcode = `SET_HEATER_TEMPERATURE HEATER=${name} TARGET=${attributes.value}` - - if (attributes.type === 'temperature_fan') { - const fanName = name.replace('temperature_fan ', '') - gcode = `SET_TEMPERATURE_FAN_TARGET temperature_fan=${fanName} TARGET=${attributes.value}` - } - - this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' }) - this.$socket.emit('printer.gcode.script', { script: gcode }) - } - } - - if (preset.gcode !== '') { - setTimeout(() => { - this.$store.dispatch('server/addEvent', { message: preset.gcode, type: 'command' }) - this.$socket.emit('printer.gcode.script', { script: preset.gcode }) - }, 100) - } - } - - cooldown(): void { - this.$store.dispatch('server/addEvent', { message: this.cooldownGcode, type: 'command' }) - this.$socket.emit('printer.gcode.script', { script: this.cooldownGcode }) - } - openHeater(object: PrinterStateTemperatureObject): void { this.editHeater.name = object.name this.editHeater.icon = object.icon @@ -383,11 +265,6 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) { border-radius: 10px !important; } -._preset-title { - font-size: 0.8125rem; - font-weight: 500; -} - .v-icon._no-focus-style:focus::after { opacity: 0 !important; } From 91542e849f6a8a605722fb73d35fb76d64c82719 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 13 Jul 2023 21:25:22 +0200 Subject: [PATCH 2/8] refactor: Panel.vue CSS settings Signed-off-by: Stefan Dej --- src/components/ui/Panel.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/ui/Panel.vue b/src/components/ui/Panel.vue index 15f6284f9..e54c3b40f 100644 --- a/src/components/ui/Panel.vue +++ b/src/components/ui/Panel.vue @@ -96,6 +96,15 @@ export default class Panel extends Mixins(BaseMixin) { .icon-rotate-90 { transform: rotate(90deg); } + +.panel-toolbar { + overflow-y: hidden; +} + +::v-deep .panel-toolbar .v-btn { + height: 100% !important; + max-height: none; +} diff --git a/src/components/panels/Temperature/TemperaturePanelListItem.vue b/src/components/panels/Temperature/TemperaturePanelListItem.vue new file mode 100644 index 000000000..b40810e74 --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItem.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/src/components/panels/Temperature/TemperaturePanelPresets.vue b/src/components/panels/Temperature/TemperaturePanelPresets.vue index fb3b6f881..f434e89cd 100644 --- a/src/components/panels/Temperature/TemperaturePanelPresets.vue +++ b/src/components/panels/Temperature/TemperaturePanelPresets.vue @@ -102,4 +102,12 @@ export default class TemperaturePanelPresets extends Mixins(BaseMixin) { font-size: 0.8125rem; font-weight: 500; } + +/* +workaround for fixing a transparency issue +which is assumingly a vuetify bug +*/ +._fix_transparency { + background-color: #1e1e1e; +} diff --git a/src/components/panels/TemperaturePanel.vue b/src/components/panels/TemperaturePanel.vue index 1aaf0efea..5aa9d755b 100644 --- a/src/components/panels/TemperaturePanel.vue +++ b/src/components/panels/TemperaturePanel.vue @@ -12,101 +12,7 @@ - - - + @@ -190,7 +96,6 @@ import TemperaturePanelPresets from '@/components/panels/Temperature/Temperature }) export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) { mdiCloseThick = mdiCloseThick - mdiCog = mdiCog mdiThermometerLines = mdiThermometerLines convertName = convertName @@ -268,43 +173,4 @@ export default class TemperaturePanel extends Mixins(BaseMixin, ControlMixin) { .v-icon._no-focus-style:focus::after { opacity: 0 !important; } - -.temperature-panel-table th, -.temperature-panel-table td { - padding-top: 5px !important; - padding-bottom: 5px !important; - height: auto !important; -} - -.temperature-panel-table tr:hover { - background: none !important; -} - -.temperature-panel-table .icon { - width: 24px; - padding-right: 0 !important; - text-align: center; -} - -.temperature-panel-table .state { - width: 100px; - text-align: right !important; -} - -.temperature-panel-table .current { - width: 100px; - text-align: right !important; -} - -.temperature-panel-table .target { - width: 140px; -} - -/* -workaround for fixing a transparency issue -which is assumingly a vuetify bug -*/ -._fix_transparency { - background-color: #1e1e1e; -} From 58f4d73d89530d51caad53a4513841503c55b016 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 13 Jul 2023 23:36:19 +0200 Subject: [PATCH 4/8] refactor: WIP Signed-off-by: Stefan Dej --- .../Temperature/TemperaturePanelList.vue | 3 +- .../Temperature/TemperaturePanelListItem.vue | 111 +++++++++++++++++- src/components/panels/TemperaturePanel.vue | 6 +- 3 files changed, 112 insertions(+), 8 deletions(-) diff --git a/src/components/panels/Temperature/TemperaturePanelList.vue b/src/components/panels/Temperature/TemperaturePanelList.vue index 74adf7fc5..837feb0f9 100644 --- a/src/components/panels/Temperature/TemperaturePanelList.vue +++ b/src/components/panels/Temperature/TemperaturePanelList.vue @@ -24,7 +24,8 @@ + :object-name="objectName" + :is-responsive-mobile="el.is.mobile ?? false" /> diff --git a/src/components/panels/Temperature/TemperaturePanelListItem.vue b/src/components/panels/Temperature/TemperaturePanelListItem.vue index b40810e74..70d756bd2 100644 --- a/src/components/panels/Temperature/TemperaturePanelListItem.vue +++ b/src/components/panels/Temperature/TemperaturePanelListItem.vue @@ -1,7 +1,41 @@ diff --git a/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue new file mode 100644 index 000000000..40f1afd7e --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensor.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue new file mode 100644 index 000000000..aadc033b1 --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemAdditionalSensorValue.vue @@ -0,0 +1,70 @@ + + + diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue new file mode 100644 index 000000000..ed96dfe05 --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemEdit.vue @@ -0,0 +1,93 @@ + + + diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue b/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue new file mode 100644 index 000000000..1c9d110bd --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemEditAdditionalSensor.vue @@ -0,0 +1,40 @@ + + + diff --git a/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue b/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue new file mode 100644 index 000000000..ddfbea12f --- /dev/null +++ b/src/components/panels/Temperature/TemperaturePanelListItemEditChartSerie.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/components/panels/Temperature/TemperaturePanelSettings.vue b/src/components/panels/Temperature/TemperaturePanelSettings.vue index df1a73be7..ad9cfc8a8 100644 --- a/src/components/panels/Temperature/TemperaturePanelSettings.vue +++ b/src/components/panels/Temperature/TemperaturePanelSettings.vue @@ -51,5 +51,3 @@ export default class TemperaturePanelSettings extends Mixins(BaseMixin) { } } - - diff --git a/src/components/panels/TemperaturePanel.vue b/src/components/panels/TemperaturePanel.vue index ae6b247b5..4acf4e9e8 100644 --- a/src/components/panels/TemperaturePanel.vue +++ b/src/components/panels/TemperaturePanel.vue @@ -1,87 +1,28 @@