Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: temperature panel rework #748

Merged
merged 32 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a25e9d4
refactor(TemperatureInput.vue): rename ToolInput to TemperatureInput
dw-0 Apr 7, 2022
1031827
refactor(TemperatureInput.vue): remove unused CSS
dw-0 Apr 7, 2022
d50faa2
refactor(TemperaturePanel.vue): rename ToolsPanel to TemperaturePanel
dw-0 Apr 7, 2022
3b2f6af
fix(TemperaturePanel.vue): misaligned icons and text in preset dropdown
dw-0 Apr 7, 2022
df84c0b
refactor(TemperatureInput.vue): set min/max size of input field
dw-0 Apr 7, 2022
c9e732a
wip
dw-0 Apr 7, 2022
1a22146
refactor: improve temperature-panel layout
dw-0 Apr 8, 2022
d598a91
refactor(TemperatureInput): remove unused CSS
dw-0 Apr 8, 2022
00a186e
feat(TemperaturePanel): preset dropdown menu for each heater/temperat…
dw-0 Apr 8, 2022
f9048f9
refactor(TemperaturePanel): move preset dropdown menu from Temperatur…
dw-0 Apr 9, 2022
087fc08
wip layout
dw-0 Apr 9, 2022
2de83f1
chore: better responsiveness over all resolutions
dw-0 Apr 10, 2022
7facb3b
chore: further responsiveness improvements
dw-0 Apr 10, 2022
9b3727b
refactor(TemperatureInput.vue): rename ToolInput to TemperatureInput
dw-0 Apr 7, 2022
96284ba
refactor(TemperatureInput.vue): remove unused CSS
dw-0 Apr 7, 2022
ad14f16
refactor(TemperaturePanel.vue): rename ToolsPanel to TemperaturePanel
dw-0 Apr 7, 2022
a31fe40
fix(TemperaturePanel.vue): misaligned icons and text in preset dropdown
dw-0 Apr 7, 2022
880265f
refactor(TemperatureInput.vue): set min/max size of input field
dw-0 Apr 7, 2022
04e6577
wip
dw-0 Apr 7, 2022
f20d0d4
refactor: improve temperature-panel layout
dw-0 Apr 8, 2022
9aea2ba
refactor(TemperatureInput): remove unused CSS
dw-0 Apr 8, 2022
4aa95f1
feat(TemperaturePanel): preset dropdown menu for each heater/temperat…
dw-0 Apr 8, 2022
8fc4576
refactor(TemperaturePanel): move preset dropdown menu from Temperatur…
dw-0 Apr 9, 2022
5b842dc
wip layout
dw-0 Apr 9, 2022
00fc3d1
chore: better responsiveness over all resolutions
dw-0 Apr 10, 2022
5b46296
chore: further responsiveness improvements
dw-0 Apr 10, 2022
1673077
Merge remote-tracking branch 'origin/temperature-panel' into temperat…
dw-0 Apr 12, 2022
a25dbb1
Merge branch 'develop' into temperature-panel
dw-0 Apr 12, 2022
f650b3e
fix: remove preset button from tab order
dw-0 Apr 23, 2022
94d3c82
refactor: click on icons opens color picker
dw-0 Apr 23, 2022
1fc496b
fix: remove clickable icons from tab order
dw-0 Apr 23, 2022
4292a96
refactor: rework temperature panel table (#5)
meteyou Apr 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/charts/TempChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class TempChart extends Mixins(BaseMixin) {
},
yAxis: [
{
name: this.$t('Panels.ToolsPanel.TemperaturesInChart'),
name: this.$t('Panels.TemperaturePanel.TemperaturesInChart'),
type: 'value',
min: 0,
max: (value: any) => {
Expand Down
125 changes: 125 additions & 0 deletions src/components/inputs/TemperatureInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<style scoped>
._temp-input {
font-size: 0.875rem;
min-width: 4rem;
max-width: 5rem;
}

._temp-input >>> .v-input__slot {
min-height: 1rem !important;
padding-left: 8px !important;
padding-right: 8px !important;
}

._temp-input >>> .v-text-field__slot input {
padding: 4px 0 4px;
}

._preset {
font-size: 0.8125rem;
font-weight: 500;
}
</style>

<template>
<div class="d-flex align-center">
<v-text-field
v-model="value"
suffix="°C"
type="number"
dense
outlined
hide-details
hide-spin-buttons
class="_temp-input pr-1"
@blur="value = target"
@focus="$event.target.select()"
@keyup.enter="setTemps"></v-text-field>
<v-menu v-if="presets" :offset-y="true" left title="Preheat">
<template #activator="{ on, attrs }">
<v-btn
:disabled="['printing', 'paused'].includes(printer_state)"
tabindex="-1"
x-small
plain
v-bind="attrs"
class="pa-0"
style="min-width: 24px"
v-on="on">
<v-icon>{{ mdiMenuDown }}</v-icon>
</v-btn>
</template>
<v-list dense class="py-0">
<v-list-item
v-for="preset of presets"
:key="preset.index"
link
style="min-height: 32px"
@click="doSend(`${command} ${attributeName}=${name} TARGET=${preset.value}`)">
<div class="d-flex align-center _preset">
<v-icon v-if="preset.value === 0" else color="primary" small class="mr-1">
{{ mdiSnowflake }}
</v-icon>
<v-icon v-else small class="mr-1">{{ mdiFire }}</v-icon>
<span style="padding-top: 2px">{{ preset.value }}°C</span>
</div>
</v-list-item>
</v-list>
</v-menu>
</div>
</template>

<script lang="ts">
import Component from 'vue-class-component'
import { Mixins, Prop, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import ControlMixin from '@/components/mixins/control'
import { mdiSnowflake, mdiFire, mdiMenuDown } from '@mdi/js'

@Component
export default class TemperatureInput extends Mixins(BaseMixin, ControlMixin) {
mdiSnowflake = mdiSnowflake
mdiFire = mdiFire
mdiMenuDown = mdiMenuDown

private value: any = 0

@Prop({ type: String, required: true }) declare readonly name: string
@Prop({ type: Number, required: true, default: 0 }) declare readonly target: number
@Prop({ type: Number, required: true }) declare readonly min_temp: number
@Prop({ type: Number, required: true }) declare readonly max_temp: number
@Prop({ type: String, required: true }) declare readonly command: string
@Prop({ type: String, required: true }) declare readonly attributeName: string
@Prop({ type: Array, default: [] }) declare presets: number[]

setTemps(): void {
if (typeof this.value === 'object') this.value = this.value.value ?? 0
if (this.value === null) this.value = 0

if (this.value > this.max_temp) {
this.value = { value: this.target, text: this.target }
this.$toast.error(
this.$t('Panels.TemperaturePanel.TempTooHigh', { name: this.name, max: this.max_temp }) + ''
)
} else if (this.value < this.min_temp && this.value != 0) {
this.value = { value: this.target, text: this.target }
this.$toast.error(
this.$t('Panels.TemperaturePanel.TempTooLow', { name: this.name, min: this.min_temp }) + ''
)
} else if (this.target !== parseFloat(this.value)) {
const gcode = this.command + ' ' + this.attributeName + '=' + this.name + ' TARGET=' + this.value
this.$store.dispatch('server/addEvent', { message: gcode, type: 'command' })
this.$socket.emit('printer.gcode.script', { script: gcode })
}
}

mounted() {
this.value = this.target
}

@Watch('target')
targetChanged(newVal: number): void {
this.value = newVal
}
}
</script>
96 changes: 0 additions & 96 deletions src/components/inputs/ToolInput.vue

This file was deleted.

Loading