diff options
author | 2020-04-08 19:16:45 +0000 | |
---|---|---|
committer | 2020-04-08 19:16:45 +0000 | |
commit | e8f2d78e408d56fe8efe96ad5958256502d6e5b0 (patch) | |
tree | 7e0b2eeab764597062ad5090c40534cf0548ae7b /sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts | |
parent | 3d6132e97fa3e37b5161d7cb6fdf00fc3d4f221f (diff) | |
parent | ae2f7c1ce61c12d5f9908fb91fd98f9df5df1f14 (diff) |
Merge "switched capability request source" into frankfurt
Diffstat (limited to 'sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts')
-rw-r--r-- | sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts index 5b4498df8..45cdfe64d 100644 --- a/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts +++ b/sdnr/wt/odlux/apps/configurationApp/src/actions/deviceActions.ts @@ -40,23 +40,19 @@ export class UpdatViewDescription extends Action { } export const updateNodeIdAsyncActionCreator = (nodeId: string) => async (dispatch: Dispatch, getState: () => IApplicationStoreState ) => { - const { configuration: { connectedNetworkElements : { rows }} } = getState(); - dispatch(new SetCollectingSelectionData(true)); - const networkElement = rows.find(r => r.nodeId === nodeId) || await restService.getMountedNetworkElementByMountId(nodeId); - if (!networkElement) { - console.error(new Error(`NetworkElement : [${nodeId}] does not exist.`)); - return dispatch(new UpdateDeviceDescription("", { }, [ ])); - } - if (!networkElement.nodeDetails || !networkElement.nodeDetails.availableCapabilities) { + const availableCapabilities = await restService.getCapabilitiesByMoutId(nodeId); + + if (!availableCapabilities || availableCapabilities.length <= 0) { throw new Error(`NetworkElement : [${nodeId}] has no capabilities.`); } + const parser = new YangParser(); const capParser = /^\(.*\?revision=(\d{4}-\d{2}-\d{2})\)(\S+)$/i; - for (let i = 0; i < networkElement.nodeDetails.availableCapabilities.length; ++i){ - const capRaw = networkElement.nodeDetails.availableCapabilities[i]; - const capMatch = capRaw && capParser.exec(capRaw); + for (let i = 0; i < availableCapabilities.length; ++i){ + const capRaw = availableCapabilities[i]; + const capMatch = capRaw && capParser.exec(capRaw.capability); try { capMatch && await parser.addCapability(capMatch[2], capMatch[1]); } catch (err) { |