diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2020-10-13 14:37:33 +0200 |
---|---|---|
committer | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2020-10-13 14:37:33 +0200 |
commit | a09598cb10c7a713d00d0876a102121e60261ba6 (patch) | |
tree | 7fd43815bbd6fd5b2daf85922a6c4e58edc7de68 /sdnr/wt/odlux | |
parent | f8196fc099fd35947d3903051ad543aa3cefccbb (diff) |
NetworkMap bugfix
Fix tile connection error displayed incorrectly
Issue-ID: CCSDK-2905
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: Id9619944f1330fde5ede94054162c7c5b1c044c9
Diffstat (limited to 'sdnr/wt/odlux')
3 files changed, 17 insertions, 9 deletions
diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/actions/connectivityAction.ts b/sdnr/wt/odlux/apps/networkMapApp/src/actions/connectivityAction.ts index 448ae8386..889480dff 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/actions/connectivityAction.ts +++ b/sdnr/wt/odlux/apps/networkMapApp/src/actions/connectivityAction.ts @@ -42,9 +42,16 @@ export const verifyResponse = (response: Response) =>{ } } -export const handleConnectionError = (error: Error) => (dispatcher: Dispatch, getState: () => IApplicationStoreState)=>{ +export const setTopologyReachableAction = (error: Error) => (dispatcher: Dispatch, getState: () => IApplicationStoreState)=>{ const {network:{connectivity: {isToplogyServerAvailable}}} = getState(); if(isToplogyServerAvailable){ dispatcher(new IsTopologyServerReachableAction(false)) } +} + +export const setTileServerReachableAction = (isReachable: boolean) => (dispatcher: Dispatch, getState: () => IApplicationStoreState)=>{ + const {network:{connectivity: {isTileServerAvailable}}} = getState(); + if(isReachable !== isTileServerAvailable){ + dispatcher(new IsTileServerReachableAction(isReachable)) + } }
\ No newline at end of file diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx b/sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx index 8db279a35..1bc2ed49a 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx +++ b/sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx @@ -33,7 +33,7 @@ import { addDistance, getUniqueFeatures, increaseBoundingBox } from '../utils/ma import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { IDispatcher, Connect } from '../../../../framework/src/flux/connect'; import SearchBar from './searchBar'; -import { verifyResponse, IsTileServerReachableAction, handleConnectionError } from '../actions/connectivityAction'; +import { verifyResponse, setTopologyReachableAction, setTileServerReachableAction } from '../actions/connectivityAction'; import ConnectionInfo from './connectionInfo' import { showIconLayers, addBaseLayers, addBaseSources, addIconLayers } from '../utils/mapLayers'; import Statistics from './statistics'; @@ -71,14 +71,15 @@ class Map extends React.Component<mapProps, { isPopupOpen: boolean }> { .then(res => { if (res.ok) { this.setupMap(); + this.props.setTileServerLoaded(true); } else { this.props.setTileServerLoaded(false); - console.error("tileserver " + URL_TILE_API + "can't be reached.") + console.error("tileserver " + URL_TILE_API + " can't be reached."); } }) .catch(err => { this.props.setTileServerLoaded(false); - console.error("tileserver " + URL_TILE_API + "can't be reached.") + console.error("tileserver " + URL_TILE_API + " can't be reached."); }); fetch(URL_API + "/info") @@ -119,7 +120,7 @@ class Map extends React.Component<mapProps, { isPopupOpen: boolean }> { }else{ addBaseLayers(map, this.props.selectedSite, this.props.selectedLink); } - }); + }); const boundingBox = map.getBounds(); @@ -579,8 +580,8 @@ const mapDispatchToProps = (dispatcher: IDispatcher) => ({ highlightSite: (site: site) => dispatcher.dispatch(new HighlightSiteAction(site)), updateMapPosition: (lat: number, lon: number, zoom: number) => dispatcher.dispatch(new SetCoordinatesAction(lat, lon, zoom)), setStatistics: (linkCount: string, siteCount: string) => dispatcher.dispatch(new SetStatistics(siteCount, linkCount)), - setTileServerLoaded: (reachable: boolean) => dispatcher.dispatch(new IsTileServerReachableAction(reachable)), - handleConnectionError: (error: Error) => dispatcher.dispatch(handleConnectionError(error)) + setTileServerLoaded: (reachable: boolean) => dispatcher.dispatch(setTileServerReachableAction(reachable)), + handleConnectionError: (error: Error) => dispatcher.dispatch(setTopologyReachableAction(error)) }) export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Map));
\ No newline at end of file diff --git a/sdnr/wt/odlux/apps/networkMapApp/src/components/mapPopup.tsx b/sdnr/wt/odlux/apps/networkMapApp/src/components/mapPopup.tsx index 040024760..cdc77b217 100644 --- a/sdnr/wt/odlux/apps/networkMapApp/src/components/mapPopup.tsx +++ b/sdnr/wt/odlux/apps/networkMapApp/src/components/mapPopup.tsx @@ -25,7 +25,7 @@ import { URL_API } from '../config'; import { HighlightLinkAction, HighlightSiteAction } from '../actions/mapActions'; import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore'; import connect, { IDispatcher, Connect } from '../../../../framework/src/flux/connect'; -import { verifyResponse, handleConnectionError } from '../actions/connectivityAction'; +import { verifyResponse, setTopologyReachableAction } from '../actions/connectivityAction'; @@ -86,7 +86,7 @@ const mapDispatchToProps = (dispatcher: IDispatcher) => ({ clearDetailsHistory:()=> dispatcher.dispatch(new ClearHistoryAction()), highlightLink: (link: link) => dispatcher.dispatch(new HighlightLinkAction(link)), highlightSite: (site: site) => dispatcher.dispatch(new HighlightSiteAction(site)), - handleConnectionError: (error:Error) => dispatcher.dispatch(handleConnectionError(error)), + handleConnectionError: (error:Error) => dispatcher.dispatch(setTopologyReachableAction(error)), clearDetails: () => dispatcher.dispatch(new ClearDetailsAction()), }); |