Skip to content

Commit

Permalink
Fixes #1045: error shown if config cannot be loaded (#1086)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto authored Oct 5, 2016
1 parent 3862034 commit a0c1df3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
18 changes: 16 additions & 2 deletions web/client/plugins/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -109,6 +110,18 @@ const MapPlugin = React.createClass({
</plugins.Map>
);
}
if (this.props.loadingError) {
return (<div style={{
width: "100%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center"
}} className="mapErrorMessage">
<Message msgId="map.loadingerror"/>:
{this.props.loadingError}
</div>);
}
return (<div style={{
width: "100%",
height: "100%",
Expand All @@ -128,9 +141,10 @@ const {mapSelector} = require('../selectors/map');
const {layerSelectorWithMarkers} = require('../selectors/layers');

const selector = createSelector(
[mapSelector, layerSelectorWithMarkers], (map, layers) => ({
[mapSelector, layerSelectorWithMarkers, (state) => state.mapInitialConfig && state.mapInitialConfig.loadingError && state.mapInitialConfig.loadingError.data], (map, layers, loadingError) => ({
map,
layers
layers,
loadingError
})
);
module.exports = {
Expand Down
5 changes: 5 additions & 0 deletions web/client/product/assets/css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -573,3 +573,8 @@ html, body, #container, .fill {
color: white;
font-size: 90%;
}

.mapErrorMessage {
font-size: 16px;
color: red;
}
4 changes: 3 additions & 1 deletion web/client/stores/StandardStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.en-US
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
},
"map": {
"loading": "Loading...",
"loadingerror": "Error in loading",
"name": "Name",
"description": "Description",
"namePlaceholder": "Map Name",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.fr-FR
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
},
"map": {
"loading": "Chargement...",
"loadingerror": "Erreur de chargement",
"name": "Nom",
"description": "Description",
"namePlaceholder": "Nom de la carte",
Expand Down
1 change: 1 addition & 0 deletions web/client/translations/data.it-IT
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
},
"map": {
"loading": "In caricamento...",
"loadingerror": "Errore di caricamento",
"name": "Nome",
"description": "Descrizione",
"namePlaceholder": "Nome Mappa",
Expand Down

0 comments on commit a0c1df3

Please sign in to comment.