diff options
author | 2021-04-08 12:39:48 +0000 | |
---|---|---|
committer | 2021-04-08 12:39:48 +0000 | |
commit | d702f00b71218c56af766363ce19f2459081d73c (patch) | |
tree | fafd0b1b622473745bebd767ccab55382d79b5df /sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts | |
parent | f3969004c6ccac18e742c5fc48c844e315991023 (diff) | |
parent | 21e4a946cd24b8a03ea577352f0271ebf7669ffa (diff) |
Merge "update odlux for notification change"
Diffstat (limited to 'sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts')
-rw-r--r-- | sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts b/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts index a3bdc6828..a83e00239 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts +++ b/sdnr/wt/odlux/apps/connectApp/src/actions/commonNetworkElementsActions.ts @@ -23,13 +23,13 @@ import { Action } from '../../../../framework/src/flux/action'; import { Dispatch } from '../../../../framework/src/flux/store'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; -import { networkElementsReloadAction, networkElementsReloadActionAsync } from '../handlers/networkElementsHandler'; +import { networkElementsReloadAction } from '../handlers/networkElementsHandler'; import { connectionStatusLogReloadAction } from '../handlers/connectionStatusLogHandler'; import { PanelId } from '../models/panelId'; import { guiCutThrough } from '../models/guiCutTrough'; -import connectService from '../services/connectService'; -import { NetworkElementConnection } from '../models/networkElementConnection'; +import { connectService} from '../services/connectService'; + export class SetPanelAction extends Action { constructor(public panelId: PanelId) { @@ -38,7 +38,7 @@ export class SetPanelAction extends Action { } export class AddWebUriList extends Action { - constructor(public searchedElements: guiCutThrough[], public notSearchedElements: string[], public unsupportedElements: string[], public newlySearchedElements?: string[] ) { + constructor(public searchedElements: guiCutThrough[], public notSearchedElements: string[], public unsupportedElements: string[], public newlySearchedElements?: string[]) { super(); } } @@ -60,49 +60,47 @@ export class SetWeburiSearchBusy extends Action { } let isBusy = false; -export const findWebUrisForGuiCutThroughAsyncAction = (networkElements: NetworkElementConnection[]) => async (dispatcher: Dispatch, getState: () => IApplicationStoreState) => { +export const findWebUrisForGuiCutThroughAsyncAction = (networkElementIds: string[]) => async (dispatcher: Dispatch, getState: () => IApplicationStoreState) => { // keep method from executing simultanously; state not used because change of iu isn't needed - if (isBusy) - return; - isBusy = true; - const { connect: { guiCutThrough } } = getState(); + + const { connect: { guiCutThrough, networkElements } } = getState(); let notConnectedElements: string[] = []; let elementsToSearch: string[] = []; let prevFoundElements: string[] = []; - let unsupportedElements: string[]= []; + let unsupportedElements: string[] = []; - - networkElements.forEach(item => { - const id = item.id as string; + networkElementIds.forEach(id => { + const item = networkElements.rows.find((ne) => ne.id === id); + if (item) { if (item.status === "Connected") { - if(item.coreModelCapability!== "Unsupported"){ + // if (item.coreModelCapability !== "Unsupported") { // element is connected and is added to search list, if it doesn't exist already - const exists = guiCutThrough.searchedElements.filter(element => element.nodeId === id).length > 0; + const exists = guiCutThrough.searchedElements.filter(element => element.id === id).length > 0; if (!exists) { elementsToSearch.push(id); - + //element was found previously, but wasn't connected if (guiCutThrough.notSearchedElements.length > 0 && guiCutThrough.notSearchedElements.includes(id)) { prevFoundElements.push(id); } - } - }else{ - // element does not support core model and must not be searched for a weburi - const id = item.id as string; - const exists = guiCutThrough.unsupportedElements.filter(element => element === id).length > 0; - if(!exists){ - unsupportedElements.push(id); - - //element was found previously, but wasn't connected - if (guiCutThrough.notSearchedElements.length > 0 && guiCutThrough.notSearchedElements.includes(id)) { - prevFoundElements.push(id); - } } - } + // } else { + // // element does not support core model and must not be searched for a weburi + // const id = item.id as string; + // const exists = guiCutThrough.unsupportedElements.filter(element => element === id).length > 0; + // if (!exists) { + // unsupportedElements.push(id); + + // //element was found previously, but wasn't connected + // if (guiCutThrough.notSearchedElements.length > 0 && guiCutThrough.notSearchedElements.includes(id)) { + // prevFoundElements.push(id); + // } + // } + // } } else { // element isn't connected and cannot be searched for a weburi @@ -110,25 +108,25 @@ export const findWebUrisForGuiCutThroughAsyncAction = (networkElements: NetworkE notConnectedElements.push(item.id as string); } } + } }); - - if (elementsToSearch.length > 0 || notConnectedElements.length > 0 || unsupportedElements.length>0 ) { - const result = await connectService.getAllWebUriExtensionsForNetworkElementListAsync(elementsToSearch); - dispatcher(new AddWebUriList(result, notConnectedElements, unsupportedElements, prevFoundElements)); + + if (elementsToSearch.length > 0 || notConnectedElements.length > 0 || unsupportedElements.length > 0) { + const result = await connectService.getAllWebUriExtensionsForNetworkElementListAsync(elementsToSearch); + dispatcher(new AddWebUriList(result, notConnectedElements, unsupportedElements, prevFoundElements)); } - isBusy = false; } export const setPanelAction = (panelId: PanelId) => { return new SetPanelAction(panelId); } -export const updateCurrentViewAsyncAction = () => async (dispatch: Dispatch, getState: () => IApplicationStoreState) => { +export const updateCurrentViewAsyncAction = () => (dispatch: Dispatch, getState: () => IApplicationStoreState) => { const { connect: { currentOpenPanel } } = getState(); if (currentOpenPanel === "NetworkElements") { - return await dispatch(networkElementsReloadActionAsync); + return dispatch(networkElementsReloadAction); } else { return dispatch(connectionStatusLogReloadAction); |