From 451d9c1b581ce54228039fa8e3ada9005f0d6545 Mon Sep 17 00:00:00 2001 From: saidaipparla Date: Tue, 11 Oct 2016 16:17:59 +0200 Subject: [PATCH] Catalog status (#1119) * fix #1095 changed modal layout for both on startup and empty results * fix #1095 missed file * fix #1080 resetted the status for catalog widget * fix #1080 changed the name and added px --- web/client/actions/catalog.js | 11 ++++++++++- web/client/jsapi/mapstore2.css | 5 +---- web/client/plugins/MetadataExplorer.jsx | 13 +++++++++++-- web/client/product/assets/css/viewer.css | 5 +---- web/client/reducers/catalog.js | 10 +++++++++- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/web/client/actions/catalog.js b/web/client/actions/catalog.js index 6aba32a54f..0f9c96f602 100644 --- a/web/client/actions/catalog.js +++ b/web/client/actions/catalog.js @@ -15,6 +15,7 @@ const RECORD_LIST_LOADED = 'RECORD_LIST_LOADED'; const RECORD_LIST_LOAD_ERROR = 'RECORD_LIST_LOAD_ERROR'; const CHANGE_CATALOG_FORMAT = 'CHANGE_CATALOG_FORMAT'; const ADD_LAYER_ERROR = 'ADD_LAYER_ERROR'; +const CATALOG_RESET = 'CATALOG_RESET'; function recordsLoaded(options, result) { return { @@ -83,13 +84,21 @@ function addLayerError(error) { }; } +function catalogReset() { + return { + type: CATALOG_RESET + }; +} + module.exports = { RECORD_LIST_LOADED, RECORD_LIST_LOAD_ERROR, CHANGE_CATALOG_FORMAT, ADD_LAYER_ERROR, + CATALOG_RESET, getRecords, textSearch, changeCatalogFormat, - addLayerError + addLayerError, + catalogReset }; diff --git a/web/client/jsapi/mapstore2.css b/web/client/jsapi/mapstore2.css index 8147d2b650..fe5c03b9f9 100644 --- a/web/client/jsapi/mapstore2.css +++ b/web/client/jsapi/mapstore2.css @@ -446,10 +446,7 @@ #mapstore-catalog-panel { width: auto; - position: absolute; - right: 200px; - margin-top: 100px; - display: inline-block; + margin: 100px; } #mapstore-catalog-panel .record-item { diff --git a/web/client/plugins/MetadataExplorer.jsx b/web/client/plugins/MetadataExplorer.jsx index 28416eb34a..6066a425b7 100644 --- a/web/client/plugins/MetadataExplorer.jsx +++ b/web/client/plugins/MetadataExplorer.jsx @@ -11,7 +11,7 @@ const {connect} = require('react-redux'); const assign = require('object-assign'); const {createSelector} = require("reselect"); const {Glyphicon, Panel} = require('react-bootstrap'); -const {textSearch, changeCatalogFormat, addLayerError} = require("../actions/catalog"); +const {textSearch, changeCatalogFormat, addLayerError, catalogReset} = require("../actions/catalog"); const {addLayer} = require("../actions/layers"); const {zoomToExtent} = require("../actions/map"); const {toggleControl} = require("../actions/controls"); @@ -29,6 +29,14 @@ const catalogSelector = createSelector([ records: CatalogUtils.getCatalogRecords(format, result, options) })); +const catalogClose = () => { + return (dispatch) => { + dispatch(toggleControl('metadataexplorer')); + dispatch(catalogReset()); + }; +}; + + const Catalog = connect(catalogSelector, { // add layer action to pass to the layers onZoomToExtent: zoomToExtent @@ -55,6 +63,7 @@ const MetadataExplorerComponent = React.createClass({ id: "mapstore-metadata-explorer", active: false, wrap: false, + modal: true, wrapWithPanel: true, panelStyle: { minWidth: "300px", @@ -99,7 +108,7 @@ const MetadataExplorerPlugin = connect((state) => ({ }), { onSearch: textSearch, onLayerAdd: addLayer, - toggleControl: toggleControl.bind(null, 'metadataexplorer', null), + toggleControl: catalogClose, onChangeFormat: changeCatalogFormat, onError: addLayerError })(MetadataExplorerComponent); diff --git a/web/client/product/assets/css/viewer.css b/web/client/product/assets/css/viewer.css index 37af5e4a0a..92d0fa3a1a 100644 --- a/web/client/product/assets/css/viewer.css +++ b/web/client/product/assets/css/viewer.css @@ -391,10 +391,7 @@ html, body, #container, .fill { #mapstore-catalog-panel { width: auto; - position: absolute; - right: 200px; - margin-top: 100px; - display: inline-block; + margin: 100px; } #mapstore-catalog-panel .record-item { diff --git a/web/client/reducers/catalog.js b/web/client/reducers/catalog.js index 9d83ba63c4..28787752fc 100644 --- a/web/client/reducers/catalog.js +++ b/web/client/reducers/catalog.js @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -const {RECORD_LIST_LOADED, RECORD_LIST_LOAD_ERROR, CHANGE_CATALOG_FORMAT, ADD_LAYER_ERROR} = require('../actions/catalog'); +const {RECORD_LIST_LOADED, RECORD_LIST_LOAD_ERROR, CHANGE_CATALOG_FORMAT, ADD_LAYER_ERROR, CATALOG_RESET} = require('../actions/catalog'); const assign = require('object-assign'); function catalog(state = null, action) { @@ -18,6 +18,14 @@ function catalog(state = null, action) { loadingError: null, layerError: null }); + case CATALOG_RESET: { + return { + result: null, + loadingError: null, + format: action.format, + layerError: null + }; + } case RECORD_LIST_LOAD_ERROR: return assign({}, state, { result: null,