@@ -124,7 +124,16 @@ class Toolbar extends React.Component {
124124 isLoading = ( ) => {
125125 return head ( this . props . selectedLayers . filter ( l => l . loading ) ) ;
126126 }
127-
127+ /**
128+ * retrieve current status based on selected layers and groups
129+ * 'DESELECT' no selection
130+ * 'LAYER' single layer selection
131+ * 'LAYERS' multiple layer selection
132+ * 'GROUP' single group selection, it select also children layers
133+ * 'GROUPS' multiple group selection, it select also children layers
134+ * 'LAYER_LOAD_ERROR' single layer selection with error
135+ * 'LAYERS_LOAD_ERROR' multiple layer selection with error, all selected layer have an error
136+ */
128137 getStatus = ( ) => {
129138 const { selectedLayers, selectedGroups} = this . props ;
130139 const isSingleGroup = this . isNestedGroup ( ) ;
@@ -133,7 +142,7 @@ class Toolbar extends React.Component {
133142 status = isSingleGroup ? 'GROUP' : status ;
134143 status = selectedLayers . length > 1 & selectedGroups . length === 0 ? 'LAYERS' : status ;
135144 status = selectedGroups . length > 1 && ! isSingleGroup ? 'GROUPS' : status ;
136- status = this . props . selectedLayers . length > 0 && this . props . selectedLayers . filter ( l => l . loadingError === 'Error' ) . length === this . props . selectedLayers . length ? 'LAYERS_LOAD_ERROR' : status ;
145+ status = this . props . selectedLayers . length > 0 && this . props . selectedLayers . filter ( l => l . loadingError === 'Error' ) . length === this . props . selectedLayers . length ? ` ${ status } _LOAD_ERROR` : status ;
137146 return status ;
138147 }
139148
@@ -176,11 +185,11 @@ class Toolbar extends React.Component {
176185 </ Button >
177186 </ OverlayTrigger >
178187 : null }
179- { this . props . activateTool . activateSettingsTool && ( status === 'LAYER' || status === 'GROUP' ) && ! this . props . layerMetadata . expanded && ! this . props . wfsdownload . expanded ?
188+ { this . props . activateTool . activateSettingsTool && ( status === 'LAYER' || status === 'GROUP' || status === 'LAYER_LOAD_ERROR' ) && ! this . props . layerMetadata . expanded && ! this . props . wfsdownload . expanded ?
180189 < OverlayTrigger
181190 key = "settings"
182191 placement = "top"
183- overlay = { < Tooltip id = "toc-tooltip-settings" > { this . props . text . settingsTooltip [ status ] } </ Tooltip > } >
192+ overlay = { < Tooltip id = "toc-tooltip-settings" > { this . props . text . settingsTooltip [ status ? 'LAYER_LOAD_ERROR' && 'LAYER' : status ] } </ Tooltip > } >
184193 < Button active = { this . props . settings . expanded } bsStyle = { this . props . settings . expanded ? 'success' : 'primary' } className = "square-button-md" onClick = { ( ) => { this . showSettings ( status ) ; } } >
185194 < Glyphicon glyph = "wrench" />
186195 </ Button >
@@ -196,7 +205,7 @@ class Toolbar extends React.Component {
196205 </ Button >
197206 </ OverlayTrigger >
198207 : null }
199- { this . props . activateTool . activateRemoveLayer && ( status === 'LAYER' || status === 'GROUP' || status === 'LAYERS' || status === 'GROUPS' || status === 'LAYERS_LOAD_ERROR' ) && this . props . selectedLayers . length > 0 && ! this . props . settings . expanded && ! this . props . layerMetadata . expanded && ! this . props . wfsdownload . expanded ?
208+ { this . props . activateTool . activateRemoveLayer && ( status === 'LAYER' || status === 'GROUP' || status === 'LAYERS' || status === 'GROUPS' || status === 'LAYER_LOAD_ERROR' || status === ' LAYERS_LOAD_ERROR') && this . props . selectedLayers . length > 0 && ! this . props . settings . expanded && ! this . props . layerMetadata . expanded && ! this . props . wfsdownload . expanded ?
200209 < OverlayTrigger
201210 key = "removeNode"
202211 placement = "top"
@@ -206,7 +215,7 @@ class Toolbar extends React.Component {
206215 </ Button >
207216 </ OverlayTrigger >
208217 : null }
209- { ! this . isLoading ( ) && status === 'LAYERS_LOAD_ERROR' ?
218+ { ! this . isLoading ( ) && status === 'LAYER_LOAD_ERROR' || status === ' LAYERS_LOAD_ERROR' ?
210219 < OverlayTrigger
211220 key = "reload"
212221 placement = "top"
@@ -299,7 +308,7 @@ class Toolbar extends React.Component {
299308
300309 showSettings = ( status ) => {
301310 if ( ! this . props . settings . expanded ) {
302- if ( status === 'LAYER' ) {
311+ if ( status === 'LAYER' || status === 'LAYER_LOAD_ERROR' ) {
303312 this . props . onToolsActions . onSettings ( this . props . selectedLayers [ 0 ] . id , 'layers' , { opacity : parseFloat ( this . props . selectedLayers [ 0 ] . opacity !== undefined ? this . props . selectedLayers [ 0 ] . opacity : 1 ) } ) ;
304313 } else if ( status === 'GROUP' ) {
305314 this . props . onToolsActions . onSettings ( this . props . selectedGroups [ this . props . selectedGroups . length - 1 ] . id , 'groups' , { } ) ;
0 commit comments