Skip to content

Commit cf9a7a8

Browse files
authored
Merge pull request #3464 from Vizzuality/fix/download-global-data
Fix: download global data
2 parents adf0884 + 633cdc6 commit cf9a7a8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

app/javascript/pages/dashboards/header/header-component.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ class Header extends PureComponent {
2626
payload,
2727
forestAtlasLink,
2828
sentence,
29-
query
29+
query,
30+
downloadLink
3031
} = this.props;
3132

3233
return (
@@ -35,9 +36,7 @@ class Header extends PureComponent {
3536
<div className="share-buttons">
3637
<Button
3738
className="theme-button-small theme-button-grey square"
38-
extLink={`http://gfw2-data.s3.amazonaws.com/country/umd_country_stats/iso/tree_cover_stats_2016_${
39-
payload.country
40-
}.xlsx`}
39+
extLink={downloadLink}
4140
trackingData={{
4241
title: 'download',
4342
...location
@@ -180,7 +179,8 @@ Header.propTypes = {
180179
payload: PropTypes.object.isRequired,
181180
forestAtlasLink: PropTypes.object,
182181
sentence: PropTypes.object,
183-
query: PropTypes.object
182+
query: PropTypes.object,
183+
downloadLink: PropTypes.string
184184
};
185185

186186
export default Header;

app/javascript/pages/dashboards/header/header.js

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const mapStateToProps = ({ countryData, location, header, widgets, cache }) => {
3232
externalLinks.find(l =>
3333
deburrUpper(l.title).indexOf(deburrUpper('forest atlas'))
3434
);
35+
const downloadLink = `http://gfw2-data.s3.amazonaws.com/country/umd_country_stats${
36+
country ? '/iso' : ''
37+
}/tree_cover_stats_2016${country ? `_${country}` : ''}.xlsx`;
3538
const locationOptions = { ...countryData };
3639
const locationNames = getAdminsSelected({ ...countryData, ...location });
3740
const cacheLoading = cache.cacheListLoading;
@@ -40,6 +43,7 @@ const mapStateToProps = ({ countryData, location, header, widgets, cache }) => {
4043
...header,
4144
loading: countryDataLoading || header.loading,
4245
cacheLoading,
46+
downloadLink,
4347
forestAtlasLink,
4448
externalLinks,
4549
locationNames,

0 commit comments

Comments
 (0)