Skip to content

Commit

Permalink
Merge pull request #3415 from Vizzuality/fix/rank-defaults
Browse files Browse the repository at this point in the history
Default setting for ranked lists
  • Loading branch information
edbrett committed May 15, 2018
2 parents 4527860 + f2abcad commit cbc5b02
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class WidgetTreeLocated extends PureComponent {
data={parsedData}
settings={{
...settings,
format: settings.unit === '%' ? '.0f' : '.2s'
format: settings.unit === '%' ? '.2r' : '.3s'
}}
handlePageChange={change =>
setWidgetSettingsUrl({
Expand Down
24 changes: 10 additions & 14 deletions app/javascript/components/widgets/components/widget/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,17 @@ class WidgetContainer extends PureComponent {
getData,
getWidgetData,
widget,
data,
geostore
} = this.props;
if (isEmpty(data)) {
getWidgetData({
widget,
getData,
params: {
...payload,
...settings,
geostore
}
});
}
getWidgetData({
widget,
getData,
params: {
...payload,
...settings,
geostore
}
});
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -141,8 +138,7 @@ WidgetContainer.propTypes = {
getData: PropTypes.func,
getWidgetData: PropTypes.func,
widget: PropTypes.string,
geostore: PropTypes.object,
data: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
geostore: PropTypes.object
};

export default connect(mapStateToProps, null)(WidgetContainer);
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
indicator: 'gadm28',
threshold: 30,
extentYear: 2010,
unit: 'ha',
unit: '%',
weeks: 4,
pageSize: 5,
page: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
settings: {
indicator: 'gadm28',
threshold: 50,
unit: 'ha',
unit: '%',
extentYear: 2010,
layers: ['forestgain']
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default {
settings: {
indicator: 'gadm28',
threshold: 30,
unit: 'ha',
unit: '%',
extentYear: 2000,
pageSize: 5,
page: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
indicator: 'gadm28',
threshold: 30,
extentYear: 2000,
unit: 'ha',
unit: '%',
pageSize: 5,
page: 0,
startYear: 2001,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const initialState = {
threshold: 50,
startYear: 2001,
endYear: 2016,
unit: 'ha',
unit: '%',
extentYear: 2000,
layers: ['loss']
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default {
threshold: 30,
extentYear: 2010,
layers: ['forest2010'],
unit: 'ha',
unit: '%',
pageSize: 5,
page: 0
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default {
settings: {
indicator: 'gadm28',
threshold: 30,
unit: 'ha',
unit: '%',
extentYear: 2000,
layers: ['forest2010']
},
Expand Down

0 comments on commit cbc5b02

Please sign in to comment.