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

fix: max_power setting in miscellaneous panel #953

Merged
merged 8 commits into from
Jul 10, 2022
Prev Previous commit
Next Next commit
refactor: fix some code/ide issues
Signed-off-by: Stefan Dej <meteyou@gmail.com>
meteyou committed Jul 9, 2022
commit f64fdfb8ee560e09a04ed66587348be0bc67e3a6
17 changes: 10 additions & 7 deletions src/components/inputs/MiscellaneousSlider.vue
Original file line number Diff line number Diff line change
@@ -11,12 +11,7 @@
</v-icon>
<span>{{ convertName(name) }}</span>
<v-spacer></v-spacer>
<small
v-if="rpm || rpm === 0"
:class="`mr-3 mt-1 ${controllable && pwm ? '_rpm' : ''}
${rpm === 0 && value > 0 ? 'red--text' : ''}`">
{{ Math.round(rpm ?? 0) }} RPM
</small>
<small v-if="rpm || rpm === 0" :class="rpmClasses">{{ Math.round(rpm ?? 0) }} RPM</small>
<span v-if="!controllable" class="font-weight-bold">
{{ Math.round(parseFloat(value) * 100) }} %
</span>
@@ -43,7 +38,7 @@
<transition v-if="controllable && pwm" name="fade">
<!-- display errors -->
<div v-show="errors.length > 0" class="_error-msg d-flex justify-end">
{{ errors[0] }}
{{ errors[0] ?? '' }}
</div>
</transition>
<v-card-text v-if="controllable && pwm" class="py-0 pb-2 d-flex align-center">
@@ -260,6 +255,14 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
return errors
}
get rpmClasses() {
const output = ['mr-3', 'mt-1']
if (this.controllable && this.pwm) output.push('_rpm')
if (this.rpm && this.value > 0) output.push('red--text')
return output
}
submitInput(): void {
if (this.errors.length > 0) return