Skip to content

Commit f1789e5

Browse files
committed
OCVN-400 Now giving a direct link for excel download
1 parent 5a1cd22 commit f1789e5

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

ui/oce/index.jsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -298,22 +298,22 @@ class OCApp extends React.Component{
298298
}
299299

300300
exportBtn(){
301-
if(this.state.exporting){
302-
return (
303-
<div className="filters">
304-
<div className="progress">
305-
<div className="progress-bar progress-bar-danger" role="progressbar" style={{width: "100%"}}>
306-
{this.t('export:exporting')}
307-
</div>
308-
</div>
309-
</div>
310-
)
301+
const { filters, selectedYears, locale, selectedMonths } = this.state;
302+
let url = new URI('/api/ocds/excelExport')
303+
.addSearch(filters.toJS())
304+
.addSearch('year', selectedYears.toArray())
305+
.addSearch('language', locale);
306+
307+
if(selectedYears.count() == 1){
308+
url = url.addSearch('month', selectedMonths && selectedMonths.toJS())
309+
.addSearch('monthly', true);
311310
}
312-
return <div className="filters" onClick={e => this.downloadExcel()}>
311+
312+
return <a className="filters" href={url} download="export.zip">
313313
<img className="top-nav-icon" src="assets/icons/export.svg" width="100%" height="100%"/>
314314
{this.t('export:export')}
315315
<i className="glyphicon glyphicon-menu-down"></i>
316-
</div>
316+
</a>
317317
}
318318

319319
toggleDashboardSwitcher(e){

ui/oce/style.less

+5
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@
6363
}
6464
}
6565
}
66+
67+
a.filters{
68+
text-decoration: none;
69+
color: white;
70+
}

0 commit comments

Comments
 (0)