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

fixed save as functionality #1825

Merged
merged 2 commits into from
May 15, 2017
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
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
7 changes: 5 additions & 2 deletions web/client/reducers/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ 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 || state && state.metadata && state.metadata.name || "",
description: action.map && action.map.description || state && state.metadata && state.metadata.description || ""
}
});
}
case RESET_CURRENT_MAP: {
return assign({}, state, {
metadata: {name: null, description: null}
metadata: {name: "", description: ""}
});
}
case MAPS_LIST_LOADING:
Expand Down