Fix behavior of config app 01/103301/1
authorherbert <herbert.eiselt@highstreet-technologies.com>
Fri, 6 Mar 2020 18:17:25 +0000 (19:17 +0100)
committerherbert <herbert.eiselt@highstreet-technologies.com>
Fri, 6 Mar 2020 18:18:03 +0000 (19:18 +0100)
behavior for list without key of config app

Issue-ID: SDNC-1111
Signed-off-by: herbert <herbert.eiselt@highstreet-technologies.com>
Change-Id: I7984efc9d2101ff9480e8361cd34a31c61c81b79

sdnr/wt/odlux/apps/configurationApp/src/yang/yangParser.ts

index 5322e1f..27859f7 100644 (file)
@@ -650,12 +650,14 @@ export class YangParser {
     const lists = this.extractNodes(statement, "list");
     if (lists && lists.length > 0) {
       subViews.push(...lists.reduce<ViewSpecification[]>((acc, cur) => {
+        let elmConfig = config;
         if (!cur.arg) {
           throw new Error(`Module: [${context.name}]${currentPath}. Found list without name.`);
         }
         const key = this.extractValue(cur, "key") || undefined;
-        if (config && !key) {
-          throw new Error(`Module: [${context.name}]${currentPath}. Found configurable list without key.`);
+        if (elmConfig && !key) {
+          console.error(new Error(`Module: [${context.name}]${currentPath}. Found configurable list without key.`));
+          elmConfig = false;
         }
         const [currentView, subViews] = this.extractSubViews(cur, currentId, context, `${currentPath}/${context.name}:${cur.arg}`);
         elements.push({
@@ -665,7 +667,7 @@ export class YangParser {
           uiType: "object",
           viewId: currentView.id,
           key: key,
-          config: config
+          config: elmConfig
         });
         acc.push(currentView, ...subViews);
         return acc;