From c18ee252044f32bfc5e8d44d0da2f7574bf9b7b0 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Mon, 18 Sep 2023 14:24:33 -0500 Subject: [PATCH 1/6] WIP: log value --- src/providers/fault-mgmt-providers/utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index 7a04795f..a1b4d5d8 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -21,6 +21,8 @@ *****************************************************************************/ function faultModelConvertor(faultData, type) { + console.log({faultData, type}); + return { type: type || faultData?.type, fault: { From 746fb4ba5ac8e49d0986070b37c39fbb539d5383 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Mon, 18 Sep 2023 15:31:58 -0500 Subject: [PATCH 2/6] WIP: added float value to double and logged current / trigger values --- src/providers/fault-mgmt-providers/utils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index a1b4d5d8..a489ad8a 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -21,14 +21,20 @@ *****************************************************************************/ function faultModelConvertor(faultData, type) { - console.log({faultData, type}); + + console.log('current', faultData?.parameterDetail?.currentValue); + console.log('trigger', faultData?.parameterDetail?.triggerValue); + + const currentValue = faultData?.parameterDetail?.currentValue?.engValue?.doubleValue || faultData?.parameterDetail?.currentValue?.engValue?.floatValue; + const triggerValue = faultData?.parameterDetail?.triggerValue?.engValue?.doubleValue || faultData?.parameterDetail?.triggerValue?.currentValue?.engValue?.floatValue; + console.log({currentValue, triggerValue}); return { type: type || faultData?.type, fault: { acknowledged: Boolean(faultData?.acknowledged), currentValueInfo: { - value: faultData?.parameterDetail?.currentValue?.engValue?.doubleValue, + value: currentValue, rangeCondition: faultData?.parameterDetail?.currentValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.currentValue?.monitoringResult }, @@ -41,7 +47,7 @@ function faultModelConvertor(faultData, type) { shortDescription: faultData?.parameterDetail?.parameter?.shortDescription, triggerTime: faultData?.triggerTime, triggerValueInfo: { - value: faultData?.parameterDetail?.triggerValue?.engValue?.doubleValue, + value: triggerValue, rangeCondition: faultData?.parameterDetail?.triggerValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.triggerValue?.monitoringResult } From 2adbe189ef7081d646eca6cc9bbf8d8fd3c33bb8 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Tue, 19 Sep 2023 11:34:30 -0500 Subject: [PATCH 3/6] Imported getValue util and extract current and trigger values --- src/providers/fault-mgmt-providers/utils.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index a489ad8a..0f47b908 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -20,13 +20,15 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ +import { getValue } from '../utils.js'; + function faultModelConvertor(faultData, type) { console.log('current', faultData?.parameterDetail?.currentValue); console.log('trigger', faultData?.parameterDetail?.triggerValue); - const currentValue = faultData?.parameterDetail?.currentValue?.engValue?.doubleValue || faultData?.parameterDetail?.currentValue?.engValue?.floatValue; - const triggerValue = faultData?.parameterDetail?.triggerValue?.engValue?.doubleValue || faultData?.parameterDetail?.triggerValue?.currentValue?.engValue?.floatValue; + const currentValue = getValue(faultData?.parameterDetail?.currentValue); + const triggerValue = getValue(faultData?.parameterDetail?.triggerValue); console.log({currentValue, triggerValue}); return { @@ -34,7 +36,7 @@ function faultModelConvertor(faultData, type) { fault: { acknowledged: Boolean(faultData?.acknowledged), currentValueInfo: { - value: currentValue, + value: getValue(faultData?.parameterDetail?.currentValue), rangeCondition: faultData?.parameterDetail?.currentValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.currentValue?.monitoringResult }, @@ -47,7 +49,7 @@ function faultModelConvertor(faultData, type) { shortDescription: faultData?.parameterDetail?.parameter?.shortDescription, triggerTime: faultData?.triggerTime, triggerValueInfo: { - value: triggerValue, + value: getValue(faultData?.parameterDetail?.triggerValue), rangeCondition: faultData?.parameterDetail?.triggerValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.triggerValue?.monitoringResult } From c89a3fb282968aafadea719295b3c076a66a686f Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Tue, 19 Sep 2023 11:43:58 -0500 Subject: [PATCH 4/6] Correct path --- src/providers/fault-mgmt-providers/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index 0f47b908..295e3a70 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -20,7 +20,7 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ -import { getValue } from '../utils.js'; +import { getValue } from '../../utils.js'; function faultModelConvertor(faultData, type) { From 9a7ea0a1fb292b8ff604f4ee4989efddd7a369aa Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Wed, 20 Sep 2023 11:27:03 -0500 Subject: [PATCH 5/6] Short circuit if falsey to prevent getValue error --- src/providers/fault-mgmt-providers/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index 295e3a70..6dd0d684 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -27,8 +27,8 @@ function faultModelConvertor(faultData, type) { console.log('current', faultData?.parameterDetail?.currentValue); console.log('trigger', faultData?.parameterDetail?.triggerValue); - const currentValue = getValue(faultData?.parameterDetail?.currentValue); - const triggerValue = getValue(faultData?.parameterDetail?.triggerValue); + const currentValue = faultData?.parameterDetail?.currentValue && getValue(faultData.parameterDetail.currentValue); + const triggerValue = faultData?.parameterDetail?.triggerValue && getValue(faultData?.parameterDetail?.triggerValue); console.log({currentValue, triggerValue}); return { @@ -36,7 +36,7 @@ function faultModelConvertor(faultData, type) { fault: { acknowledged: Boolean(faultData?.acknowledged), currentValueInfo: { - value: getValue(faultData?.parameterDetail?.currentValue), + value: currentValue, rangeCondition: faultData?.parameterDetail?.currentValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.currentValue?.monitoringResult }, @@ -49,7 +49,7 @@ function faultModelConvertor(faultData, type) { shortDescription: faultData?.parameterDetail?.parameter?.shortDescription, triggerTime: faultData?.triggerTime, triggerValueInfo: { - value: getValue(faultData?.parameterDetail?.triggerValue), + value: triggerValue, rangeCondition: faultData?.parameterDetail?.triggerValue?.rangeCondition, monitoringResult: faultData?.parameterDetail?.triggerValue?.monitoringResult } From 70bc4c7e825880314fbf13293bf5a094d92635e6 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Wed, 20 Sep 2023 11:42:31 -0500 Subject: [PATCH 6/6] Remove logging and cleanup --- src/providers/fault-mgmt-providers/utils.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/providers/fault-mgmt-providers/utils.js b/src/providers/fault-mgmt-providers/utils.js index 6dd0d684..b5319483 100644 --- a/src/providers/fault-mgmt-providers/utils.js +++ b/src/providers/fault-mgmt-providers/utils.js @@ -24,12 +24,10 @@ import { getValue } from '../../utils.js'; function faultModelConvertor(faultData, type) { - console.log('current', faultData?.parameterDetail?.currentValue); - console.log('trigger', faultData?.parameterDetail?.triggerValue); - - const currentValue = faultData?.parameterDetail?.currentValue && getValue(faultData.parameterDetail.currentValue); - const triggerValue = faultData?.parameterDetail?.triggerValue && getValue(faultData?.parameterDetail?.triggerValue); - console.log({currentValue, triggerValue}); + const currentValue = faultData?.parameterDetail?.currentValue + && getValue(faultData.parameterDetail.currentValue); + const triggerValue = faultData?.parameterDetail?.triggerValue + && getValue(faultData.parameterDetail.triggerValue); return { type: type || faultData?.type,