From 4bd84bebdaa0c2d82050fbedd1fa8260eb62146d Mon Sep 17 00:00:00 2001
From: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Date: Thu, 27 Aug 2020 09:01:53 +0200
Subject: Add link calculation app

Add link calculation app to odlux

Issue-ID: CCSDK-2562
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: Ifc0a5b2a8bb974dfd85d70a9f05990b1f11925a3
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
---
 .../configurationApp/src/views/configurationApplication.tsx    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'sdnr/wt/odlux/apps/configurationApp/src/views')

diff --git a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
index 385f3b52f..6465feb4e 100644
--- a/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
+++ b/sdnr/wt/odlux/apps/configurationApp/src/views/configurationApplication.tsx
@@ -284,8 +284,12 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
   private renderUIElement = (uiElement: ViewElement, viewData: { [key: string]: any }, keyProperty: string | undefined, editMode: boolean, isNew: boolean) => {
     const isKey = (uiElement.label === keyProperty);
     const canEdit = editMode && (isNew || (uiElement.config && !isKey));
-    if (isViewElementEmpty(uiElement)) {
+    
+    // do not show elements w/o any value from the backend
+    if (viewData[uiElement.id] == null && !editMode) {
       return null;
+    } else  if (isViewElementEmpty(uiElement)) {
+      return null;  
     } else if (isViewElementSelection(uiElement)) {
 
       return <UiElementSelection
@@ -300,7 +304,7 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
     } else if (isViewElementBoolean(uiElement)) {
       return <UiElementBoolean
         key={uiElement.id}
-        inputValue={viewData[uiElement.id] || ''}
+        inputValue={viewData[uiElement.id] == null ? '' : viewData[uiElement.id]}
         value={uiElement}
         readOnly={!canEdit}
         disabled={editMode && !canEdit}
@@ -309,7 +313,7 @@ class ConfigurationApplicationComponent extends React.Component<ConfigurationApp
     } else if (isViewElementString(uiElement)) {
       return <UiElementString
         key={uiElement.id}
-        inputValue={viewData[uiElement.id] || ''}
+        inputValue={viewData[uiElement.id] == null ? '' : viewData[uiElement.id]}
         value={uiElement}
         isKey={isKey}
         readOnly={!canEdit}
-- 
cgit