2021-08-19 01:31:19 +02:00
|
|
|
<template>
|
|
|
|
<div class="w-full my-2">
|
2021-11-04 23:35:59 +01:00
|
|
|
<div class="w-full bg-primary px-4 md:px-6 py-2 flex items-center cursor-pointer" @click.stop="clickBar">
|
2022-03-11 01:45:02 +01:00
|
|
|
<p class="pr-2 md:pr-4">Library Files</p>
|
2021-11-04 23:35:59 +01:00
|
|
|
<div class="h-5 md:h-7 w-5 md:w-7 rounded-full bg-white bg-opacity-10 flex items-center justify-center">
|
2021-10-07 04:08:52 +02:00
|
|
|
<span class="text-sm font-mono">{{ files.length }}</span>
|
|
|
|
</div>
|
2021-08-19 01:31:19 +02:00
|
|
|
<div class="flex-grow" />
|
2021-11-04 23:35:59 +01:00
|
|
|
<ui-btn small :color="showFullPath ? 'gray-600' : 'primary'" class="mr-2 hidden md:block" @click.stop="showFullPath = !showFullPath">Full Path</ui-btn>
|
2021-08-19 01:31:19 +02:00
|
|
|
<div class="cursor-pointer h-10 w-10 rounded-full hover:bg-black-400 flex justify-center items-center duration-500" :class="showFiles ? 'transform rotate-180' : ''">
|
|
|
|
<span class="material-icons text-4xl">expand_more</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<transition name="slide">
|
|
|
|
<div class="w-full" v-show="showFiles">
|
|
|
|
<table class="text-sm tracksTable">
|
|
|
|
<tr class="font-book">
|
2021-10-07 04:08:52 +02:00
|
|
|
<th class="text-left px-4">Path</th>
|
2022-03-13 00:45:32 +01:00
|
|
|
<th class="text-left w-24 min-w-24">Size</th>
|
2021-10-09 00:30:20 +02:00
|
|
|
<th class="text-left px-4 w-24">Filetype</th>
|
2021-10-16 03:31:00 +02:00
|
|
|
<th v-if="userCanDownload && !isMissing" class="text-center w-20">Download</th>
|
2021-08-19 01:31:19 +02:00
|
|
|
</tr>
|
2022-03-11 01:45:02 +01:00
|
|
|
<template v-for="file in files">
|
2021-08-19 01:31:19 +02:00
|
|
|
<tr :key="file.path">
|
2022-03-13 00:45:32 +01:00
|
|
|
<td class="font-book px-4">
|
2022-03-11 01:45:02 +01:00
|
|
|
{{ showFullPath ? file.metadata.path : file.metadata.relPath }}
|
2021-08-19 01:31:19 +02:00
|
|
|
</td>
|
2022-03-13 00:45:32 +01:00
|
|
|
<td class="font-mono">
|
|
|
|
{{ $bytesPretty(file.metadata.size) }}
|
|
|
|
</td>
|
2021-08-19 01:31:19 +02:00
|
|
|
<td class="text-xs">
|
2021-10-16 03:31:00 +02:00
|
|
|
<div class="flex items-center">
|
2022-03-13 00:45:32 +01:00
|
|
|
<p>{{ file.fileType }}</p>
|
2021-10-16 03:31:00 +02:00
|
|
|
</div>
|
2021-08-19 01:31:19 +02:00
|
|
|
</td>
|
2021-10-16 03:31:00 +02:00
|
|
|
<td v-if="userCanDownload && !isMissing" class="text-center">
|
2022-03-26 23:41:26 +01:00
|
|
|
<a :href="`/s/item/${libraryItemId}/${$encodeUriPath(file.metadata.relPath).replace(/^\//, '')}?token=${userToken}`" download><span class="material-icons icon-text">download</span></a>
|
2021-10-09 00:30:20 +02:00
|
|
|
</td>
|
2021-08-19 01:31:19 +02:00
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
files: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
},
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItemId: String,
|
2022-04-13 15:26:43 +02:00
|
|
|
isMissing: Boolean,
|
|
|
|
expanded: Boolean // start expanded
|
2021-08-19 01:31:19 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2021-10-07 04:08:52 +02:00
|
|
|
showFiles: false,
|
|
|
|
showFullPath: false
|
2021-08-19 01:31:19 +02:00
|
|
|
}
|
|
|
|
},
|
2021-10-09 00:30:20 +02:00
|
|
|
computed: {
|
|
|
|
userToken() {
|
|
|
|
return this.$store.getters['user/getToken']
|
|
|
|
},
|
|
|
|
userCanDownload() {
|
|
|
|
return this.$store.getters['user/getUserCanDownload']
|
|
|
|
}
|
|
|
|
},
|
2021-08-19 01:31:19 +02:00
|
|
|
methods: {
|
|
|
|
clickBar() {
|
|
|
|
this.showFiles = !this.showFiles
|
|
|
|
}
|
|
|
|
},
|
2022-04-13 15:26:43 +02:00
|
|
|
mounted() {
|
|
|
|
this.showFiles = this.expanded
|
|
|
|
}
|
2021-08-19 01:31:19 +02:00
|
|
|
}
|
|
|
|
</script>
|