diff --git a/src/components/dialogs/CoolDownDialog.vue b/src/components/dialogs/CoolDownDialog.vue new file mode 100644 index 000000000..2d9dfa4ef --- /dev/null +++ b/src/components/dialogs/CoolDownDialog.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/components/panels/Temperature/TemperaturePanelPresets.vue b/src/components/panels/Temperature/TemperaturePanelPresets.vue index 6f4fbdf4e..a54464573 100644 --- a/src/components/panels/Temperature/TemperaturePanelPresets.vue +++ b/src/components/panels/Temperature/TemperaturePanelPresets.vue @@ -25,7 +25,7 @@ - +
{{ mdiSnowflake }} {{ $t('Panels.TemperaturePanel.Cooldown') }} @@ -39,10 +39,11 @@ :text="$vuetify.breakpoint.mdAndUp" tile color="primary" - @click="cooldown"> + @click="btnCoolDown"> {{ mdiSnowflake }} {{ $t('Panels.TemperaturePanel.Cooldown') }} +
@@ -51,13 +52,19 @@ import Component from 'vue-class-component' import { Mixins } from 'vue-property-decorator' import BaseMixin from '@/components/mixins/base' import { GuiPresetsStatePreset } from '@/store/gui/presets/types' -import { mdiFire, mdiMenuDown, mdiSnowflake } from '@mdi/js' +import { mdiFire, mdiMenuDown, mdiSnowflake, mdiCloseThick } from '@mdi/js' +import CoolDownDialog from '@/components/dialogs/CoolDownDialog.vue' -@Component +@Component({ + components: { CoolDownDialog }, +}) export default class TemperaturePanelPresets extends Mixins(BaseMixin) { mdiFire = mdiFire mdiMenuDown = mdiMenuDown mdiSnowflake = mdiSnowflake + mdiCloseThick = mdiCloseThick + + showCoolDownDialog = false get presets(): GuiPresetsStatePreset[] { return this.$store.getters['gui/presets/getPresets'] ?? [] @@ -67,6 +74,10 @@ export default class TemperaturePanelPresets extends Mixins(BaseMixin) { return this.$store.getters['gui/presets/getCooldownGcode'] } + get confirmOnCoolDown(): boolean { + return this.$store.state.gui.uiSettings.confirmOnCoolDown + } + preheat(preset: GuiPresetsStatePreset): void { for (const [name, attributes] of Object.entries(preset.values)) { if (attributes.bool) { @@ -100,7 +111,17 @@ export default class TemperaturePanelPresets extends Mixins(BaseMixin) { } } + btnCoolDown(): void { + if (this.confirmOnCoolDown) { + this.showCoolDownDialog = true + return + } + + this.cooldown() + } + cooldown(): void { + this.showCoolDownDialog = false this.$store.dispatch('server/addEvent', { message: this.cooldownGcode, type: 'command' }) this.$socket.emit('printer.gcode.script', { script: this.cooldownGcode }) } diff --git a/src/components/settings/SettingsUiSettingsTab.vue b/src/components/settings/SettingsUiSettingsTab.vue index bd4ba51e2..96d4a7556 100644 --- a/src/components/settings/SettingsUiSettingsTab.vue +++ b/src/components/settings/SettingsUiSettingsTab.vue @@ -142,6 +142,13 @@ + + + + { lockSlidersOnTouchDevices: true, lockSlidersDelay: 1.5, confirmOnEmergencyStop: false, + confirmOnCoolDown: false, confirmOnPowerDeviceChange: false, boolBigThumbnail: true, bigThumbnailBackground: defaultBigThumbnailBackground, diff --git a/src/store/gui/types.ts b/src/store/gui/types.ts index 930961603..7b4dfee09 100644 --- a/src/store/gui/types.ts +++ b/src/store/gui/types.ts @@ -105,6 +105,7 @@ export interface GuiState { lockSlidersOnTouchDevices: boolean lockSlidersDelay: number confirmOnEmergencyStop: boolean + confirmOnCoolDown: boolean confirmOnPowerDeviceChange: boolean boolBigThumbnail: boolean bigThumbnailBackground: string