Table.vue 2.97 KB
Newer Older
1
<template>
2
  <table class="ui compact very basic fixed single line unstackable table">
3
4
5
6
    <thead>
      <tr>
        <th></th>
        <th></th>
7
        <th colspan="6"><translate>Title</translate></th>
Renon's avatar
Renon committed
8
9
10
        <th colspan="4"><translate>Artist</translate></th>
        <th colspan="4"><translate>Album</translate></th>
        <th colspan="4"><translate>Duration</translate></th>
11
12
13
14
        <th></th>
      </tr>
    </thead>
    <tbody>
15
16
17
      <track-row
        :display-position="displayPosition"
        :track="track"
18
        :artist="artist"
19
20
        :key="index + '-' + track.id"
        v-for="(track, index) in tracks"></track-row>
21
    </tbody>
22
23
24
    <tfoot class="full-width">
      <tr>
        <th colspan="3">
Bat's avatar
Bat committed
25
          <button @click="showDownloadModal = !showDownloadModal" class="ui basic button">
26
             <translate>Download</translate>
Bat's avatar
Bat committed
27
          </button>
28
          <modal :show.sync="showDownloadModal">
29
            <div class="header"><translate>Download tracks</translate></div>
30
31
            <div class="content">
              <div class="description">
32
33
                <p><translate>There is currently no way to download directly multiple tracks from funkwhale as a ZIP archive. However, you can use a command line tools such as cURL to easily download a list of tracks.</translate></p>
                 <translate>Simply copy paste the snippet below into a terminal to launch the download.</translate>
Eliot Berriot's avatar
Eliot Berriot committed
34
                <div class="ui warning message">
35
                   <translate>Keep your PRIVATE_TOKEN secret as it gives access to your account.</translate>
Eliot Berriot's avatar
Eliot Berriot committed
36
                </div>
37
                <pre>
38
export PRIVATE_TOKEN="{{ $store.state.auth.token }}"
39
<template v-for="track in tracks"><template v-if="track.files.length > 0">
40
curl -G -o "{{ track.files[0].filename }}" <template v-if="$store.state.auth.authenticated">--header "Authorization: JWT $PRIVATE_TOKEN"</template> "{{ $store.getters['instance/absoluteUrl'](track.files[0].path) }}"</template></template>
41
42
43
44
</pre>
              </div>
            </div>
            <div class="actions">
45
              <div class="ui black deny button"><translate>Cancel</translate></div>
46
47
48
49
50
51
52
53
54
55
            </div>
          </modal>
        </th>
        <th></th>
        <th colspan="4"></th>
        <th colspan="6"></th>
        <th colspan="6"></th>
        <th></th>
      </tr>
    </tfoot>
56
57
58
59
60
61
  </table>
</template>

<script>
import backend from '@/audio/backend'

62
import TrackRow from '@/components/audio/track/Row'
63
64
import Modal from '@/components/semantic/Modal'

65
export default {
66
67
  props: {
    tracks: {type: Array, required: true},
68
    artist: {type: Object, required: false},
69
70
    displayPosition: {type: Boolean, default: false}
  },
71
  components: {
72
    Modal,
73
    TrackRow
74
75
76
  },
  data () {
    return {
77
78
      backend: backend,
      showDownloadModal: false
79
80
81
82
83
84
85
86
87
88
89
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

tr:not(:hover) .favorite-icon:not(.favorited) {
  display: none;
}
90
91
92
pre {
  overflow-x: scroll;
}
93
</style>