From 143f0ad18dbf25e1e172a2772b0a4c3f0c30c97d Mon Sep 17 00:00:00 2001 From: calvin_peyron Date: Fri, 13 Feb 2026 09:31:48 +0100 Subject: [PATCH] Fix flattened choice nodes Flattened nodes were not working Issue-ID: OAM-546 Change-Id: I26cb9384b860aed8c0ed925a964146b59f5d9699 Signed-off-by: calvin_peyron --- .../configurationApp/src/actions/deviceActions.ts | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/features/sdnr/odlux/odlux/apps/configurationApp/src/actions/deviceActions.ts b/features/sdnr/odlux/odlux/apps/configurationApp/src/actions/deviceActions.ts index 615faae..b944d20 100644 --- a/features/sdnr/odlux/odlux/apps/configurationApp/src/actions/deviceActions.ts +++ b/features/sdnr/odlux/odlux/apps/configurationApp/src/actions/deviceActions.ts @@ -455,7 +455,20 @@ export const updateDataActionAsyncCreator = (vPath: string, data: any) => async viewSpecification = views[+viewElement.viewId]; } } - + const elementsToCheck: string[] =[]; + + for(const i in viewSpecification.elements){ + if(viewSpecification.elements[i].module != viewSpecification.ns){ + const element = viewSpecification.elements[i]; + if(element.uiType=="choice"){ + for(let choiceCase in element.cases){ + for(let elt in element.cases[choiceCase].elements){ + elementsToCheck.push(element.cases[choiceCase].elements[elt].label); + } + } + } + }; + } // remove read-only elements const removeReadOnlyElements = (pViewSpecification: ViewSpecification, isList: boolean, pData: any) => { if (isList) { @@ -463,8 +476,12 @@ export const updateDataActionAsyncCreator = (vPath: string, data: any) => async } else { return Object.keys(pData).reduce<{ [key: string]: any }>((acc, cur)=>{ const [nsOrName, name] = cur.split(':', 1); - const element = pViewSpecification.elements[cur] || pViewSpecification.elements[nsOrName] || pViewSpecification.elements[name]; - if (!element && process.env.NODE_ENV === 'development' ) { + var element; + if(elementsToCheck.find(el => el === cur)){ + acc[cur] = pData[cur]; + } else { + element = pViewSpecification.elements[cur] || pViewSpecification.elements[nsOrName] || pViewSpecification.elements[name]; + } if (!element && process.env.NODE_ENV === 'development' ) { throw new Error('removeReadOnlyElements: Could not determine element for data.'); } if (element && element.config) { -- 2.16.6