Skip to content

Commit

Permalink
Fixes geosolutions-it#1788: configurability of SettingModal showEleva…
Browse files Browse the repository at this point in the history
…tionChart
  • Loading branch information
mbarto committed May 8, 2017
1 parent b7479ce commit 3d19843
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions web/client/components/TOC/fragments/SettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const SettingsModal = React.createClass({
closeText: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]),
options: React.PropTypes.object,
chartStyle: React.PropTypes.object,
showElevationChart: React.PropTypes.bool,
buttonSize: React.PropTypes.string,
closeGlyph: React.PropTypes.string,
panelStyle: React.PropTypes.object,
Expand Down Expand Up @@ -135,6 +136,7 @@ const SettingsModal = React.createClass({
return (<Elevation
elevationText={this.props.elevationText}
chartStyle={this.props.chartStyle}
showElevationChart={this.props.showElevationChart}
element={this.props.element}
elevations={elevationDim}
appState={this.state || {}}
Expand Down
10 changes: 6 additions & 4 deletions web/client/components/TOC/fragments/settings/Elevation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ module.exports = React.createClass({
elevations: React.PropTypes.object,
onChange: React.PropTypes.func,
appState: React.PropTypes.object,
chartStyle: React.PropTypes.object
chartStyle: React.PropTypes.object,
showElevationChart: React.PropTypes.bool
},
getDefaultProps() {
return {
onChange: () => {}
onChange: () => {},
showElevationChart: true
};
},
shouldComponentUpdate(nextProps) {
return this.props.element.id !== nextProps.element.id;
},
renderElevationsChart(elevations) {
if (this.props.elevations.showChart) {
if (this.props.showElevationChart) {
return (
<ElevationChart
elevations={elevations}
Expand Down Expand Up @@ -66,7 +68,7 @@ module.exports = React.createClass({
}
}
}}
tooltips={!this.props.elevations.showChart}
tooltips={!this.props.showElevationChart}
onChange={(value) => {
this.props.onChange("params", Object.assign({}, {
[this.props.elevations.name]: value[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ describe('test Layer Properties Elevation component', () => {
name: "ELEVATION",
units: "Meters",
positive: false,
showChart: true,
values: ["1.5", "5.0", "10.0", "15.0", "20.0", "25.0", "30.0"]
}
};
Expand Down
1 change: 0 additions & 1 deletion web/client/utils/LayersUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const getElevationDimension = (dimensions = []) => {
return dimensions.reduce((previous, dim) => {
return (dim.name.toLowerCase() === 'elevation' || dim.name.toLowerCase() === 'depth') ?
assign({
showChart: true,
positive: dim.name.toLowerCase() === 'elevation'
}, dim, {
name: dim.name.toLowerCase() === 'elevation' ? dim.name : 'DIM_' + dim.name
Expand Down

0 comments on commit 3d19843

Please sign in to comment.