Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions app/components/events/view/export/download-zip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import Component from '@ember/component';
import { action } from '@ember/object';

export default Component.extend({
});
export default class extends Component {
@action
async exportEventDownload(eventDownloadUrl) {
this.set('isLoading', true);
try {
const res = await this.loader.downloadFile(`${eventDownloadUrl}`);
const anchor = document.createElement('a');
anchor.style.display = 'none';
anchor.href = URL.createObjectURL(new Blob([res], { type: 'octet/stream' }));
anchor.download = 'EventExport.zip';
anchor.click();
this.notify.success(this.l10n.t('Exported Event Downloaded successfully.'));
} catch (e) {
console.error(e);
this.notify.error(this.l10n.t(e));
}
this.set('isLoading', false);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<button class="ui blue button" {{action startGeneration}}>
{{t 'Start'}}
</button>
<a href="{{eventDownloadUrl}}" class="ui button {{if isDownloadDisabled 'disabled' ''}}">
<a href="#" class="ui button {{if isDownloadDisabled 'disabled' ''}}" {{action exportEventDownload eventDownloadUrl }}>
{{t 'Download'}}
</a>
<div class="hidden divider"></div>
Expand Down