summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/configurationApp/src/actions
diff options
context:
space:
mode:
authorAijana Schumann <aijana.schumann@highstreet-technologies.com>2020-10-07 16:36:59 +0200
committerAijana Schumann <aijana.schumann@highstreet-technologies.com>2020-10-07 16:36:59 +0200
commit3ef0d18fcb16931a0c93d91ae6fbf8edda09ecc9 (patch)
treeb4a731ec2311296e58280e0001ddc80ed26f9dac /sdnr/wt/odlux/apps/configurationApp/src/actions
parentaee5dc5c1a62ba13c792028e9eea5886a680eb79 (diff)
ConfigApp bugfix
Fix interface list is not visible Issue-ID: CCSDK-2880 Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com> Change-Id: I090a298a925ada52eda603c8a24cf6d577a7b5e6
Diffstat (limited to 'sdnr/wt/odlux/apps/configurationApp/src/actions')
-rw-r--r--sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts24
1 files changed, 18 insertions, 6 deletions
diff --git a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts
index 790d2515c..83134fc92 100644
--- a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts
+++ b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts
@@ -182,13 +182,25 @@ const resolveViewDescription = (defaultNS: string | null, vPath: string, view: V
// check if-feature | when | and resolve all references.
view = { ...view };
view.elements = Object.keys(view.elements).reduce<{ [name: string]: ViewElement }>((acc, cur) => {
- const elm = view.elements[cur];
+ const resolveHistory : ViewElement[] = [];
+ let elm = view.elements[cur];
const key = defaultNS && cur.replace(new RegExp(`^${defaultNS}:`, "i"),"") || cur;
- if (isViewElementReference(elm)) {
- acc[key] = { ...(elm.ref(vPath) || elm), id: key };
- } else {
- acc[key] = { ...elm, id: key };
- }
+ while (isViewElementReference(elm)) {
+ const result = (elm.ref(vPath));
+ if (result) {
+ const [referencedElement, referencedPath] = result;
+ if (resolveHistory.some(hist => hist === referencedElement)) {
+ console.error(`Circle reference found at: ${vPath}`, resolveHistory);
+ break;
+ }
+ elm = referencedElement;
+ vPath = referencedPath;
+ resolveHistory.push(elm);
+ }
+ }
+
+ acc[key] = { ...elm, id: key };
+
return acc;
}, {});
return view;