Skip to content

Commit

Permalink
Catalog status (#1119)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
saidaipparla authored and offtherailz committed Oct 11, 2016
1 parent 103382c commit 451d9c1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
11 changes: 10 additions & 1 deletion web/client/actions/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
};
5 changes: 1 addition & 4 deletions web/client/jsapi/mapstore2.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 11 additions & 2 deletions web/client/plugins/MetadataExplorer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -55,6 +63,7 @@ const MetadataExplorerComponent = React.createClass({
id: "mapstore-metadata-explorer",
active: false,
wrap: false,
modal: true,
wrapWithPanel: true,
panelStyle: {
minWidth: "300px",
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions web/client/product/assets/css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion web/client/reducers/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 451d9c1

Please sign in to comment.