Former-commit-id: 3bb6cc662da9e9255bd61fef42430c271002fd49 [formerly eaf1785c4f85522e4eb66d00a6ae9dd9ecc4fcb4] [formerly addd3ffe1396e6df84cdc3e8787d57ffb2be3dc6 [formerly 800693ad49]]
Former-commit-id: 6c24d30f26529457202f470620a0ea1d31772b13 [formerly 384d2af17fe100b9db91462eb41337f9dff855f4]
Former-commit-id: 94f4933e12f97ee7468c884f041612498e07ba32
42 lines
1.0 KiB
Vue
42 lines
1.0 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'
|
|
import api from '@/utils/api'
|
|
|
|
export default {
|
|
name: 'download',
|
|
computed: {
|
|
...mapState(['selected', 'req']),
|
|
...mapGetters(['selectedCount'])
|
|
},
|
|
methods: {
|
|
download: function (format) {
|
|
if (this.selectedCount === 0) {
|
|
api.download(format, this.$route.path)
|
|
} else {
|
|
let files = []
|
|
|
|
for (let i of this.selected) {
|
|
files.push(this.req.items[i].url)
|
|
}
|
|
|
|
api.download(format, ...files)
|
|
}
|
|
|
|
this.$store.commit('closeHovers')
|
|
}
|
|
}
|
|
}
|
|
</script>
|