File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
components/events/view/export
templates/components/events/view/export Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 11import Component from '@ember/component' ;
2+ import { action } from '@ember/object' ;
23
3- export default Component . extend ( {
4- } ) ;
4+ export default class extends Component {
5+ @action
6+ async exportEventDownload ( eventDownloadUrl ) {
7+ this . set ( 'isLoading' , true ) ;
8+ try {
9+ const res = await this . loader . downloadFile ( `${ eventDownloadUrl } ` ) ;
10+ const anchor = document . createElement ( 'a' ) ;
11+ anchor . style . display = 'none' ;
12+ anchor . href = URL . createObjectURL ( new Blob ( [ res ] , { type : 'octet/stream' } ) ) ;
13+ anchor . download = 'EventExport.zip' ;
14+ anchor . click ( ) ;
15+ this . notify . success ( this . l10n . t ( 'Exported Event Downloaded successfully.' ) ) ;
16+ } catch ( e ) {
17+ console . error ( e ) ;
18+ this . notify . error ( this . l10n . t ( e ) ) ;
19+ }
20+ this . set ( 'isLoading' , false ) ;
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 2525 <button class =" ui blue button" {{ action startGeneration }} >
2626 {{ t ' Start' }}
2727 </button >
28- <a href =" {{ eventDownloadUrl }} " class =" ui button {{ if isDownloadDisabled ' disabled' ' ' }} " >
28+ <a href =" # " class =" ui button {{ if isDownloadDisabled ' disabled' ' ' }} " {{ action exportEventDownload eventDownloadUrl }} >
2929 {{ t ' Download' }}
3030 </a >
3131 <div class =" hidden divider" ></div >
You can’t perform that action at this time.
0 commit comments