Skip to content

Commit

Permalink
feat: show filament sensor state even when it is disabled (mainsail-c…
Browse files Browse the repository at this point in the history
…rew#1656)

Co-authored-by: Stefan Dej <[email protected]>
  • Loading branch information
2 people authored and 4rnoP committed Dec 13, 2023
1 parent b192bd2 commit 20f5f4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
23 changes: 12 additions & 11 deletions src/components/inputs/FilamentSensor.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
<style scoped>
._filamentRunout-subheader {
height: auto;
}
</style>

<template>
<v-container class="px-0 py-2">
<v-row>
<v-col class="pb-3">
<v-subheader class="_filamentRunout-subheader">
<v-icon small class="mr-2">{{ mdiPrinter3dNozzleAlert }}</v-icon>
<span>{{ convertName(name) }}</span>
<v-spacer></v-spacer>
<v-spacer />
<small :class="'mr-3 ' + statusColor + '--text'">{{ statusText }}</small>
<v-icon @click="changeSensor">
{{ enabled ? mdiToggleSwitch : mdiToggleSwitchOffOutline }}
Expand Down Expand Up @@ -47,13 +41,14 @@ export default class FilamentSensor extends Mixins(BaseMixin) {
get statusColor() {
if (!this.enabled) return 'gray'
else if (this.filament_detected) return 'success'
else return 'danger'
return 'warning'
}
get statusText() {
if (!this.enabled) return this.$t('Panels.MiscellaneousPanel.RunoutSensor.Disabled')
else if (this.filament_detected) return this.$t('Panels.MiscellaneousPanel.RunoutSensor.Detected')
else return this.$t('Panels.MiscellaneousPanel.RunoutSensor.Empty')
if (this.filament_detected) return this.$t('Panels.MiscellaneousPanel.RunoutSensor.Detected')
return this.$t('Panels.MiscellaneousPanel.RunoutSensor.Empty')
}
changeSensor() {
Expand All @@ -63,3 +58,9 @@ export default class FilamentSensor extends Mixins(BaseMixin) {
}
}
</script>

<style scoped>
._filamentRunout-subheader {
height: auto;
}
</style>
3 changes: 1 addition & 2 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,7 @@
},
"RunoutSensor": {
"Detected": "erkannt",
"Disabled": "deaktiviert",
"Empty": "Leer"
"Empty": "leer"
}
},
"PowerControlPanel": {
Expand Down
3 changes: 1 addition & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,7 @@
},
"RunoutSensor": {
"Detected": "detected",
"Disabled": "disabled",
"Empty": "Empty"
"Empty": "empty"
}
},
"PowerControlPanel": {
Expand Down

0 comments on commit 20f5f4c

Please sign in to comment.