From 7e746ca86c5e96f1b52dc7e2d15d6c93ae8dba60 Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Fri, 14 Oct 2016 18:13:39 +0200 Subject: [PATCH] Fix #1151 added proper keys and property types. - Fixed also persistance of catalog configuration #1145 --- web/client/components/TOC/DefaultLayer.jsx | 1 + web/client/components/TOC/fragments/LayersTool.jsx | 4 ++-- web/client/components/maps/MapGrid.jsx | 8 ++++---- web/client/components/misc/Dialog.jsx | 2 +- web/client/plugins/CreateNewMap.jsx | 2 +- web/client/plugins/MetadataExplorer.jsx | 5 +++-- web/client/plugins/containers/ToolsContainer.jsx | 8 ++++---- web/client/reducers/catalog.js | 4 ++-- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/web/client/components/TOC/DefaultLayer.jsx b/web/client/components/TOC/DefaultLayer.jsx index 191b27da84..86e554ddde 100644 --- a/web/client/components/TOC/DefaultLayer.jsx +++ b/web/client/components/TOC/DefaultLayer.jsx @@ -106,6 +106,7 @@ var DefaultLayer = React.createClass({ <InlineSpinner loading={this.props.node.loading}/> <LayersTool key="loadingerror" + id={"loadingError" + this.props.node.id} style={{"display": this.props.node.loadingError ? "block" : "none", color: "red", cursor: "default"}} glyph="ban-circle" tooltip="toc.loadingerror" diff --git a/web/client/components/TOC/fragments/LayersTool.jsx b/web/client/components/TOC/fragments/LayersTool.jsx index d8e757172f..ad1490190a 100644 --- a/web/client/components/TOC/fragments/LayersTool.jsx +++ b/web/client/components/TOC/fragments/LayersTool.jsx @@ -19,7 +19,7 @@ const LayersTool = React.createClass({ onClick: React.PropTypes.func, style: React.PropTypes.object, glyph: React.PropTypes.string, - tooltip: React.PropTypes.tooltip + tooltip: React.PropTypes.string }, getDefaultProps() { return { @@ -32,7 +32,7 @@ const LayersTool = React.createClass({ glyph={this.props.glyph} onClick={(options) => this.props.onClick(this.props.node, options || {})}/>); return this.props.tooltip ? ( - <OverlayTrigger placement="bottom" overlay={(<Tooltip><strong><Message msgId={this.props.tooltip}/></strong></Tooltip>)}> + <OverlayTrigger placement="bottom" overlay={(<Tooltip id={"tooltip-" + (this.props.node && this.props.node.id)}><strong><Message msgId={this.props.tooltip}/></strong></Tooltip>)}> {tool} </OverlayTrigger>) : tool; diff --git a/web/client/components/maps/MapGrid.jsx b/web/client/components/maps/MapGrid.jsx index eeaf7ca5f1..b5a07896a7 100644 --- a/web/client/components/maps/MapGrid.jsx +++ b/web/client/components/maps/MapGrid.jsx @@ -36,7 +36,7 @@ var MapGrid = React.createClass({ deleteMap: React.PropTypes.func, resetCurrentMap: React.PropTypes.func, updatePermissions: React.PropTypes.func, - metadataModal: React.PropTypes.object + metadataModal: React.PropTypes.func }, getDefaultProps() { return { @@ -90,7 +90,7 @@ var MapGrid = React.createClass({ renderMetadataModal() { if (this.props.metadataModal) { let MetadataModal = this.props.metadataModal; - return (<MetadataModal ref="metadataModal" show={this.props.currentMap && this.props.currentMap.displayMetadataEdit} onHide={this.props.resetCurrentMap} + return (<MetadataModal key="metadataModal" ref="metadataModal" show={this.props.currentMap && this.props.currentMap.displayMetadataEdit} onHide={this.props.resetCurrentMap} onClose={this.props.resetCurrentMap} map={this.props.currentMap} onSaveAll={this.props.saveAll} @@ -105,10 +105,10 @@ var MapGrid = React.createClass({ render: function() { return ( <Grid fluid={this.props.fluid}> - <Row> + <Row key="maps"> {this.props.loading && this.props.maps.length === 0 ? this.renderLoading() : this.renderMaps(this.props.maps || [], this.props.mapType)} </Row> - <Row> + <Row key="bottom"> {this.props.bottom} </Row> {this.renderMetadataModal()} diff --git a/web/client/components/misc/Dialog.jsx b/web/client/components/misc/Dialog.jsx index 80f8058279..35abfe23a8 100644 --- a/web/client/components/misc/Dialog.jsx +++ b/web/client/components/misc/Dialog.jsx @@ -70,7 +70,7 @@ const Dialog = React.createClass({ return React.Children.toArray(this.props.children).filter((child) => child.props.role === role); }, render() { - const dialog = (<Draggable className="modal-content" start={this.props.start} handle=".draggable-header, .draggable-header *"> + const dialog = (<Draggable start={this.props.start} handle=".draggable-header, .draggable-header *"> <div id={this.props.id} style={{zIndex: 3, ...this.props.style}} className={this.props.className + " modal-dialog-container"}> <div className={this.props.headerClassName + " draggable-header"}> {this.renderRole('header')} diff --git a/web/client/plugins/CreateNewMap.jsx b/web/client/plugins/CreateNewMap.jsx index 77c7001343..ebd3a65fdb 100644 --- a/web/client/plugins/CreateNewMap.jsx +++ b/web/client/plugins/CreateNewMap.jsx @@ -51,6 +51,6 @@ const CreateNewMap = React.createClass({ module.exports = { CreateNewMapPlugin: connect((state) => ({ mapType: (state.maps && state.maps.mapType) || (state.home && state.home.mapType), - isLoggedIn: state && state.security && state.security.user + isLoggedIn: !!(state && state.security && state.security.user) }))(CreateNewMap) }; diff --git a/web/client/plugins/MetadataExplorer.jsx b/web/client/plugins/MetadataExplorer.jsx index 004068270f..b917860dec 100644 --- a/web/client/plugins/MetadataExplorer.jsx +++ b/web/client/plugins/MetadataExplorer.jsx @@ -55,7 +55,7 @@ const MetadataExplorerComponent = React.createClass({ panelClassName: React.PropTypes.string, toggleControl: React.PropTypes.func, closeGlyph: React.PropTypes.string, - buttonStyle: React.PropTypes.string, + buttonStyle: React.PropTypes.object, style: React.PropTypes.object }, getDefaultProps() { @@ -71,7 +71,8 @@ const MetadataExplorerComponent = React.createClass({ }, panelClassName: "toolbar-panel", toggleControl: () => {}, - closeGlyph: "" + closeGlyph: "", + buttonStyle: {} }; }, render() { diff --git a/web/client/plugins/containers/ToolsContainer.jsx b/web/client/plugins/containers/ToolsContainer.jsx index ac08ff74b2..f471a8dddc 100644 --- a/web/client/plugins/containers/ToolsContainer.jsx +++ b/web/client/plugins/containers/ToolsContainer.jsx @@ -100,7 +100,7 @@ const ToolsContainer = React.createClass({ })(this.props.tool); }, renderTools() { - return this.props.tools.map((tool) => { + return this.props.tools.map((tool, i) => { if (tool.element) { return tool.element; } @@ -110,7 +110,7 @@ const ToolsContainer = React.createClass({ const Tool = this.getTool(tool); return this.addTooltip( - <Tool tooltip={tooltip} btnSize={this.props.toolSize} bsStyle={this.props.toolStyle} help={help} key={tool.name} mapType={this.props.mapType} + <Tool tooltip={tooltip} btnSize={this.props.toolSize} bsStyle={this.props.toolStyle} help={help} key={tool.name || ("tool" + i)} mapType={this.props.mapType} {...tool.cfg} items={tool.items || []}> {(tool.cfg && tool.cfg.glyph) ? <Glyphicon glyph={tool.cfg.glyph}/> : tool.icon}{help} {tool.text} </Tool>, @@ -140,8 +140,8 @@ const ToolsContainer = React.createClass({ render() { const Container = this.props.container; return ( - <span id={this.props.id}> - <Container id={this.props.id + "-container"} style={this.props.style} className={this.props.className}> + <span key={this.props.id} id={this.props.id}> + <Container key={this.props.id + "-container"} id={this.props.id + "-container"} style={this.props.style} className={this.props.className}> {this.renderTools()} </Container> {this.renderPanels()} diff --git a/web/client/reducers/catalog.js b/web/client/reducers/catalog.js index 28787752fc..ce599bc8a8 100644 --- a/web/client/reducers/catalog.js +++ b/web/client/reducers/catalog.js @@ -19,12 +19,12 @@ function catalog(state = null, action) { layerError: null }); case CATALOG_RESET: { - return { + return assign({}, state, { result: null, loadingError: null, format: action.format, layerError: null - }; + }); } case RECORD_LIST_LOAD_ERROR: return assign({}, state, {