From 4b7087f0f9ca478f9b819094e9caaf29c3853246 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 18 Mar 2023 12:24:03 +0100 Subject: [PATCH] webapp: Only mark values in Pininfo as red if they are different and enabled. --- webapp/src/components/PinInfo.vue | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/webapp/src/components/PinInfo.vue b/webapp/src/components/PinInfo.vue index 189e7b1..e26bc6a 100644 --- a/webapp/src/components/PinInfo.vue +++ b/webapp/src/components/PinInfo.vue @@ -80,14 +80,25 @@ export default defineComponent({ return Array.from(new Set(total)).sort(); }, isEqual(category: string, prop: string): boolean { - if (!((this.selectedPinAssignment as Device)[category as keyof Device])) { - return false; + let comSel = 999999; + let comCur = 999999; + + if ((this.selectedPinAssignment as Device)[category as keyof Device]) { + comSel = (this.selectedPinAssignment as any)[category][prop]; } - if (!((this.currentPinAssignment as Device)[category as keyof Device])) { - return false; + if ((this.currentPinAssignment as Device)[category as keyof Device]) { + comCur = (this.currentPinAssignment as any)[category][prop]; } - return (this.selectedPinAssignment as any)[category][prop] == (this.currentPinAssignment as any)[category][prop]; + if (comSel == -1 || comSel == 255 || comSel == undefined) { + comSel = 999999; + } + + if (comCur == -1 || comCur == 255 || comSel == undefined) { + comCur = 999999; + } + + return comSel == comCur; }, capitalizeFirstLetter(value: string): string { return value.charAt(0).toUpperCase() + value.slice(1);