}
}
-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
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';
.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")
}else{
addBaseLayers(map, this.props.selectedSite, this.props.selectedLink);
}
- });
+ });
const boundingBox = map.getBounds();
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
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';
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()),
});