Former-commit-id: afa0c349648f9e8fe9eb2dbfd5214454f8dcc048 [formerly 21ea1d1edc1cb396c38a4e9d95778929e66c590f] [formerly d0d88d46de21a489e3e19d239e23147bbf018d16 [formerly e0f3687b26]]
Former-commit-id: 24e6f33d7bcb0f9306f8d4953c7af4de39adff5f [formerly e0ec0773fff43ba2243a8687ae33b373a3fd4e1a]
Former-commit-id: 5f96744de512d3cc6affa99eebb869354f62605b
46 lines
1.2 KiB
Vue
46 lines
1.2 KiB
Vue
<template>
|
|
<div class="prompt" id="download">
|
|
<h3>Download files</h3>
|
|
<p>Choose the format you want to download.</p>
|
|
<button @click="download('zip')" autofocus>zip</button>
|
|
<button @click="download('tar')" autofocus>tar</button>
|
|
<button @click="download('targz')" autofocus>tar.gz</button>
|
|
<button @click="download('tarbz2')" autofocus>tar.bz2</button>
|
|
<button @click="download('tarxz')" autofocus>tar.xz</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapGetters, mapState} from 'vuex'
|
|
|
|
export default {
|
|
name: 'download',
|
|
computed: {
|
|
...mapState(['selected', 'req']),
|
|
...mapGetters(['selectedCount'])
|
|
},
|
|
methods: {
|
|
download: function (format) {
|
|
let uri = this.$route.params[0]
|
|
uri = this.$store.state.baseURL + '/api/download/' + uri
|
|
uri += `?token=${this.$store.state.jwt}`
|
|
uri += `&format=${format}`
|
|
|
|
if (this.selectedCount > 0) {
|
|
let files = ''
|
|
|
|
for (let i of this.selected) {
|
|
files += this.req.items[i].url.replace(window.location.pathname, '') + ','
|
|
}
|
|
|
|
files = files.substring(0, files.length - 1)
|
|
files = encodeURIComponent(files)
|
|
uri += `&files=${files}`
|
|
}
|
|
|
|
window.open(uri)
|
|
}
|
|
}
|
|
}
|
|
</script>
|