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: fix case sensibility for printer power device #1827

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading