Skip to content

Commit

Permalink
fix: fix case sensibility for printer power device
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou committed Mar 21, 2024
1 parent c859440 commit 5c5a6b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/components/mixins/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export default class BaseMixin extends Vue {
}

get printerPowerDevice(): string {
let deviceName = this.$store.state.gui.uiSettings.powerDeviceName ?? null
if (deviceName === null) deviceName = 'printer'
const deviceName = this.$store.state.gui.uiSettings.powerDeviceName ?? null
if (deviceName !== null) return deviceName

return deviceName
const devices = this.$store.getters['server/power/getDevices'] ?? []
return (
devices.find((device: ServerPowerStateDevice) => device.device.toLowerCase() === 'printer')?.device ??
'printer'
)
}

get isPrinterPowerOff() {
Expand Down
8 changes: 4 additions & 4 deletions src/components/settings/SettingsUiSettingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin) {
}
get autoPowerDevice() {
const autoIndex = this.powerDevices.findIndex((device: ServerPowerStateDevice) => device.device === 'printer')
if (autoIndex === -1) return '--'
return this.powerDevices[autoIndex].device
return (
this.powerDevices.find((device: ServerPowerStateDevice) => device.device.toLowerCase() === 'printer')
?.device ?? '--'
)
}
get powerDeviceName() {
Expand Down

0 comments on commit 5c5a6b9

Please sign in to comment.