From d61e9a0cb35a0da5607084f25dbe17844c92706b Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Fri, 7 Nov 2025 16:19:46 +0200 Subject: [PATCH 1/2] fixes parse error --- .../widget/lib/rpc/led-indicator.component.ts | 13 +++++++++---- .../widget/lib/rpc/round-switch.component.ts | 13 +++++++++---- .../components/widget/lib/rpc/switch.component.ts | 13 +++++++++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts index d983a4ebfe..6cd91eadae 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts @@ -332,11 +332,16 @@ export class LedIndicatorComponent extends PageComponent implements OnInit, OnDe if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) { } + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts index 6990ff4264..3e483b498a 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts @@ -330,11 +330,16 @@ export class RoundSwitchComponent extends PageComponent implements OnInit, OnDes if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) { } + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts index c9807e5635..e9809cb61c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts @@ -373,11 +373,16 @@ export class SwitchComponent extends PageComponent implements AfterViewInit, OnD if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) { } + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } } From 0905d5d2548c1cc8ea23c55c40af7b88ff0d9f7c Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Mon, 10 Nov 2025 13:14:34 +0200 Subject: [PATCH 2/2] fixed lint problems --- .../home/components/widget/lib/rpc/led-indicator.component.ts | 2 +- .../home/components/widget/lib/rpc/round-switch.component.ts | 2 +- .../modules/home/components/widget/lib/rpc/switch.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts index 6cd91eadae..a59bbca537 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts @@ -335,7 +335,7 @@ export class LedIndicatorComponent extends PageComponent implements OnInit, OnDe let valueToParse = attrValue; try { valueToParse = JSON.parse(attrValue); - } catch (e) { } + } catch (e) {/**/} try { value = !!this.parseValueFunction(valueToParse); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts index 3e483b498a..8e64cc7100 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts @@ -333,7 +333,7 @@ export class RoundSwitchComponent extends PageComponent implements OnInit, OnDes let valueToParse = attrValue; try { valueToParse = JSON.parse(attrValue); - } catch (e) { } + } catch (e) {/**/} try { value = !!this.parseValueFunction(valueToParse); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts index e9809cb61c..7a8f4e0dd6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts @@ -376,7 +376,7 @@ export class SwitchComponent extends PageComponent implements AfterViewInit, OnD let valueToParse = attrValue; try { valueToParse = JSON.parse(attrValue); - } catch (e) { } + } catch (e) {/**/} try { value = !!this.parseValueFunction(valueToParse);