From 53a0e88ad2ea12ea062a89243e6eff67e748050f Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Thu, 1 Aug 2024 17:08:50 +0100 Subject: [PATCH] refactor: use list and add pretty naming Signed-off-by: Pedro Lamas --- .../runout-sensors/RunoutSensorsCard.vue | 53 ++++++++++--------- src/store/printer/getters.ts | 1 + 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/components/widgets/runout-sensors/RunoutSensorsCard.vue b/src/components/widgets/runout-sensors/RunoutSensorsCard.vue index 25642537a9..ad829bcf97 100644 --- a/src/components/widgets/runout-sensors/RunoutSensorsCard.vue +++ b/src/components/widgets/runout-sensors/RunoutSensorsCard.vue @@ -20,32 +20,36 @@ - - + - - - {{ item.name }} - - - {{ (item.filament_detected) ? '$checkedCircle' : '$alertCircle' }} - - - - - - + + {{ item.prettyName }} + + + + $checkedCircle + + + $alertCircle + + + + + + + @@ -64,8 +68,7 @@ export default class RunoutSensorsCard extends Mixins(StateMixin) { } changeSensor (item: RunoutSensor, value: boolean) { - const enable: number = (value) ? 1 : 0 - this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${item.name} ENABLE=${enable}`) + this.sendGcode(`SET_FILAMENT_SENSOR SENSOR=${item.name} ENABLE=${+value}`) } } diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index 15a7712303..3918fe044d 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -425,6 +425,7 @@ export const getters: GetterTree = { const sensor = get(state.printer, item, undefined) sensors.push({ name, + prettyName: Vue.$filters.prettyCase(name), ...sensor }) }