From a09598cb10c7a713d00d0876a102121e60261ba6 Mon Sep 17 00:00:00 2001
From: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Date: Tue, 13 Oct 2020 14:37:33 +0200
Subject: 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
---
 sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'sdnr/wt/odlux/apps/networkMapApp/src/components/map.tsx')

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
-- 
cgit 1.2.3-korg

