Skip to content

Commit

Permalink
fix: generic fans with off_below set now apply validators correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Jul 11, 2021
1 parent cc39708 commit a0e6234
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/widgets/outputs/OutputFan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,17 @@ export default class OutputFan extends Mixins(StateMixin) {
: undefined
}
get offBelow () {
const config = this.$store.getters['printer/getPrinterSettings'](this.fan.name) || {}
return config.off_below * 100 || 0
}
get isMobile () {
return this.$vuetify.breakpoint.mobile
}
rules = [
(v: string) => {
if (this.offBelow <= 0) return true
return (parseFloat(v) >= this.offBelow || parseFloat(v) === 0) || this.$t('app.general.simple_form.error.min_or_0', { min: this.offBelow })
(v: number) => {
const off_below = (this.fan.config?.off_below)
? this.fan.config.off_below * 100
: 0
if (!off_below) return true
return (v >= off_below || v === 0) || this.$t('app.general.simple_form.error.min_or_0', { min: off_below })
}
]
}
Expand Down

0 comments on commit a0e6234

Please sign in to comment.