Skip to content

Commit

Permalink
fixed save as functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed May 15, 2017
1 parent 3d8f362 commit 38e8535
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions web/client/components/maps/modals/MetadataModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const MetadataModal = React.createClass({
user: {
name: "Guest"
},
metadata: {name: "", description: ""},
options: {},
useModal: true,
closeGlyph: "",
Expand Down
12 changes: 9 additions & 3 deletions web/client/plugins/SaveAs.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2016, GeoSolutions Sas.
/*
* Copyright 2017, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
Expand All @@ -15,7 +15,7 @@ const Message = require('../components/I18N/Message');
// const {toggleControl} = require('../actions/controls');
const {loadMapInfo} = require('../actions/config');
const MetadataModal = require('../components/maps/modals/MetadataModal');
const {createMap, createThumbnail, onDisplayMetadataEdit} = require('../actions/maps');
const {createMap, createThumbnail, onDisplayMetadataEdit, metadataChanged} = require('../actions/maps');
const {editMap, updateCurrentMap, errorCurrentMap, resetCurrentMap} = require('../actions/currentMap');
const {mapSelector} = require('../selectors/map');
const stateSelector = state => state;
Expand All @@ -32,6 +32,7 @@ const selector = createSelector(mapSelector, stateSelector, layersSelector, (map
map,
user: state.security && state.security.user,
currentMap: state.currentMap,
metadata: state.maps.metadata,
layers
}));

Expand All @@ -44,6 +45,7 @@ const SaveAs = React.createClass({
mapType: React.PropTypes.string,
layers: React.PropTypes.array,
params: React.PropTypes.object,
metadata: React.PropTypes.object,
currentMap: React.PropTypes.object,
// CALLBACKS
onClose: React.PropTypes.func,
Expand All @@ -53,6 +55,7 @@ const SaveAs = React.createClass({
onSave: React.PropTypes.func,
editMap: React.PropTypes.func,
resetCurrentMap: React.PropTypes.func,
metadataChanged: React.PropTypes.func,
onMapSave: React.PropTypes.func,
loadMapInfo: React.PropTypes.func
},
Expand Down Expand Up @@ -88,6 +91,8 @@ const SaveAs = React.createClass({
let map = (this.state && this.state.loading) ? assign({updating: true}, this.props.currentMap) : this.props.currentMap;
return (
<MetadataModal ref="metadataModal"
metadataChanged={this.props.metadataChanged}
metadata={this.props.metadata}
displayPermissionEditor={false}
show={this.props.currentMap.displayMetadataEdit}
onEdit={this.props.editMap}
Expand Down Expand Up @@ -154,6 +159,7 @@ module.exports = {
onErrorCurrentMap: errorCurrentMap,
onMapSave: createMap,
loadMapInfo,
metadataChanged,
editMap,
resetCurrentMap,
onDisplayMetadataEdit,
Expand Down
4 changes: 2 additions & 2 deletions web/client/reducers/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ function maps(state = {
}
case EDIT_MAP: {
return assign({}, state, {
metadata: {name: action.map.name, description: action.map.description}
metadata: {name: action.map && action.map.name || "", description: action.map && action.map.description || ""}
});
}
case RESET_CURRENT_MAP: {
return assign({}, state, {
metadata: {name: null, description: null}
metadata: {name: "", description: ""}
});
}
case MAPS_LIST_LOADING:
Expand Down

0 comments on commit 38e8535

Please sign in to comment.