Former-commit-id: 46ef678067f79997b35a86931a324e8404d4db98 [formerly 16e52ff387b32d4dcbec9bfe6132ea71192f331a] [formerly 985b6e3050f66c3131f1c62aab9a5dbe025437f2 [formerly fc71509dd032eb5cdbbfeb8de9a25d836bb2d61c]] Former-commit-id: acffffe9de1e64b90cc0cc0eb2dff9e367c70d88 [formerly af4f7056c6fb45b96e115b182e7ab2303fc39159] Former-commit-id: 17d369064f83ebf81d7374b92245c9003f86efbe
47 lines
1.3 KiB
Vue
47 lines
1.3 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)
|
|
this.$store.commit('closePrompts')
|
|
}
|
|
}
|
|
}
|
|
</script>
|