Skip to content

Commit

Permalink
Improved removeNode action to pass through the original node, not onl…
Browse files Browse the repository at this point in the history
…y the id
  • Loading branch information
mbarto committed Apr 28, 2017
1 parent 9c9d929 commit c5fb1c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions web/client/actions/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ function sortNode(node, order, sortLayers = null) {
};
}

function removeNode(node, type) {
function removeNode(node, type, properties) {
return {
type: REMOVE_NODE,
node: node,
nodeType: type
nodeType: type,
properties
};
}

Expand Down
2 changes: 1 addition & 1 deletion web/client/components/TOC/DefaultLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var DefaultLayer = React.createClass({
};
},
onConfirmDelete() {
this.props.removeNode(this.props.node.id, "layers");
this.props.removeNode(this.props.node.id, "layers", this.props.node);
this.closeDeleteDialog();
},
getInitialState: function() {
Expand Down
7 changes: 5 additions & 2 deletions web/client/components/maps/modals/ConfirmModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
const React = require('react');
const {Button} = require('react-bootstrap');
const Modal = require('../../misc/Modal');
const Spinner = require('react-spinkit');

/**
* A Modal window to show a confirmation dialog
Expand All @@ -28,7 +29,8 @@ const ConfirmModal = React.createClass({
body: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]),
titleText: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]),
confirmText: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]),
cancelText: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element])
cancelText: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]),
running: React.PropTypes.bool
},
getDefaultProps() {
return {
Expand All @@ -54,13 +56,14 @@ const ConfirmModal = React.createClass({
const footer = (<span role="footer"><div style={{"float": "left"}}></div>
<Button
ref="confirmButton"
disabled={this.props.running}
className={this.props.className}
key="confirmButton"
bsStyle="primary"
bsSize={this.props.buttonSize}
onClick={() => {
this.onConfirm();
}}>{this.props.confirmText}</Button>
}}>{this.props.running ? <Spinner spinnerName="circle" overrideSpinnerClassName="spinner" noFadeIn /> : null}{this.props.confirmText}</Button>
{this.props.includeCloseButton ? <Button
key="cancelButton"
ref="cancelButton"
Expand Down

0 comments on commit c5fb1c2

Please sign in to comment.