Browse Source
Merge pull request #192 from maneo/features/download_progress
improvement in responsivness of download view
pull/200/head
Hiroki Nakayama
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
0 deletions
-
app/server/static/js/download.pug
-
app/server/static/js/mixin.js
|
|
@ -19,4 +19,5 @@ div.columns(v-cloak="") |
|
|
|
style="margin-top: 1em;" |
|
|
|
type="submit" |
|
|
|
v-on:click="download()" |
|
|
|
v-bind:class="{'is-loading': isLoading}" |
|
|
|
) Download |
|
|
@ -254,6 +254,7 @@ export const uploadMixin = { |
|
|
|
}, |
|
|
|
|
|
|
|
download() { |
|
|
|
this.isLoading = true; |
|
|
|
const headers = {}; |
|
|
|
if (this.format === 'csv') { |
|
|
|
headers.Accept = 'text/csv; charset=utf-8'; |
|
|
@ -276,8 +277,10 @@ export const uploadMixin = { |
|
|
|
link.href = url; |
|
|
|
link.setAttribute('download', 'file.' + this.format); // or any other extension
|
|
|
|
document.body.appendChild(link); |
|
|
|
this.isLoading = false; |
|
|
|
link.click(); |
|
|
|
}).catch((error) => { |
|
|
|
this.isLoading = false; |
|
|
|
this.handleError(error); |
|
|
|
}); |
|
|
|
}, |
|
|
|