feature: disable power devices with attribute "locked_while_printing" in moonraker while printing

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2021-02-06 21:39:04 +01:00
parent 837f6641d0
commit aeb6ae1ec9

View File

@@ -31,7 +31,7 @@
<div v-if="countPowerDevices"> <div v-if="countPowerDevices">
<v-divider class="mt-0"></v-divider> <v-divider class="mt-0"></v-divider>
<v-subheader class="pt-2" style="height: auto;">Power Devices</v-subheader> <v-subheader class="pt-2" style="height: auto;">Power Devices</v-subheader>
<v-list-item v-for="(device, index) in devices" v-bind:key="index" class="minheight30" @click="changeSwitch(device, device.status)" :disabled="(device.status === 'error')"> <v-list-item v-for="(device, index) in devices" v-bind:key="index" class="minheight30" @click="changeSwitch(device, device.status)" :disabled="(device.status === 'error' || device.locked_while_printing && ['printing', 'paused'].includes(printer_state))">
<v-list-item-title> <v-list-item-title>
<v-icon class="mr-2" :color="device.status === 'on' ? '' : 'grey darken-2'">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>{{ device.device }} <v-icon class="mr-2" :color="device.status === 'on' ? '' : 'grey darken-2'">mdi-{{ device.status === 'on' ? 'toggle-switch' : 'toggle-switch-off' }}</v-icon>{{ device.device }}
</v-list-item-title> </v-list-item-title>
@@ -62,6 +62,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
printer_state: state => state.printer.print_stats.state,
devices: (state) => state.server.power.devices, devices: (state) => state.server.power.devices,
}), }),
countPowerDevices: { countPowerDevices: {