From a0c1df3e4d41975a9c72370ffd981702297dd68d Mon Sep 17 00:00:00 2001 From: mbarto Date: Wed, 5 Oct 2016 17:50:40 +0200 Subject: [PATCH] Fixes #1045: error shown if config cannot be loaded (#1086) --- web/client/plugins/Map.jsx | 18 ++++++++++++++++-- web/client/product/assets/css/viewer.css | 5 +++++ web/client/stores/StandardStore.js | 4 +++- web/client/translations/data.en-US | 1 + web/client/translations/data.fr-FR | 1 + web/client/translations/data.it-IT | 1 + 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/web/client/plugins/Map.jsx b/web/client/plugins/Map.jsx index a216e61d01..5deb11a528 100644 --- a/web/client/plugins/Map.jsx +++ b/web/client/plugins/Map.jsx @@ -25,6 +25,7 @@ const MapPlugin = React.createClass({ zoomControl: React.PropTypes.bool, mapLoadingMessage: React.PropTypes.string, loadingSpinner: React.PropTypes.bool, + loadingError: React.PropTypes.string, tools: React.PropTypes.array, options: React.PropTypes.object, toolsOptions: React.PropTypes.object, @@ -109,6 +110,18 @@ const MapPlugin = React.createClass({ ); } + if (this.props.loadingError) { + return (
+ : + {this.props.loadingError} +
); + } return (
({ + [mapSelector, layerSelectorWithMarkers, (state) => state.mapInitialConfig && state.mapInitialConfig.loadingError && state.mapInitialConfig.loadingError.data], (map, layers, loadingError) => ({ map, - layers + layers, + loadingError }) ); module.exports = { diff --git a/web/client/product/assets/css/viewer.css b/web/client/product/assets/css/viewer.css index 97649913e0..37af5e4a0a 100644 --- a/web/client/product/assets/css/viewer.css +++ b/web/client/product/assets/css/viewer.css @@ -573,3 +573,8 @@ html, body, #container, .fill { color: white; font-size: 90%; } + +.mapErrorMessage { + font-size: 16px; + color: red; +} diff --git a/web/client/stores/StandardStore.js b/web/client/stores/StandardStore.js index 6f02e746da..5ee43d734a 100644 --- a/web/client/stores/StandardStore.js +++ b/web/client/stores/StandardStore.js @@ -43,7 +43,9 @@ module.exports = (initialState = {defaultState: {}, mobile: {}}, appReducers = { let newState = { ...allReducers(state, action), map: mapState && mapState.map ? map(mapState.map, action) : null, - mapInitialConfig: mapState ? mapState.mapInitialConfig : null, + mapInitialConfig: (mapState && mapState.mapInitialConfig) || (mapState && mapState.loadingError && { + loadingError: mapState.loadingError + }) || null, layers: mapState ? layers(mapState.layers, action) : null }; if (action && action.type === CHANGE_BROWSER_PROPERTIES && newState.browser.mobile) { diff --git a/web/client/translations/data.en-US b/web/client/translations/data.en-US index 1ef977f50a..fae031c146 100644 --- a/web/client/translations/data.en-US +++ b/web/client/translations/data.en-US @@ -121,6 +121,7 @@ }, "map": { "loading": "Loading...", + "loadingerror": "Error in loading", "name": "Name", "description": "Description", "namePlaceholder": "Map Name", diff --git a/web/client/translations/data.fr-FR b/web/client/translations/data.fr-FR index 93a45887fe..7b3ca8a552 100644 --- a/web/client/translations/data.fr-FR +++ b/web/client/translations/data.fr-FR @@ -122,6 +122,7 @@ }, "map": { "loading": "Chargement...", + "loadingerror": "Erreur de chargement", "name": "Nom", "description": "Description", "namePlaceholder": "Nom de la carte", diff --git a/web/client/translations/data.it-IT b/web/client/translations/data.it-IT index 0739937c1d..22c96031ac 100644 --- a/web/client/translations/data.it-IT +++ b/web/client/translations/data.it-IT @@ -121,6 +121,7 @@ }, "map": { "loading": "In caricamento...", + "loadingerror": "Errore di caricamento", "name": "Nome", "description": "Descrizione", "namePlaceholder": "Nome Mappa",