Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog status #1119

Merged
merged 4 commits into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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