2020-01-24 10:27:35 +00:00
|
|
|
|
<template>
|
|
|
|
|
<div class="p-tab p-tab-photo-edit-files">
|
|
|
|
|
<v-data-table
|
|
|
|
|
:headers="listColumns"
|
|
|
|
|
:items="model.Files"
|
|
|
|
|
hide-actions
|
|
|
|
|
disable-initial-sort
|
2020-01-26 15:06:03 +00:00
|
|
|
|
class="elevation-0 p-files p-files-list p-results"
|
2020-01-24 10:27:35 +00:00
|
|
|
|
item-key="ID"
|
|
|
|
|
v-model="selected"
|
|
|
|
|
:no-data-text="this.$gettext('No files found')"
|
|
|
|
|
>
|
|
|
|
|
<template slot="items" slot-scope="props" class="p-file">
|
2020-04-21 08:23:27 +00:00
|
|
|
|
<td><v-btn v-if="props.item.FileType === 'jpg'" flat :ripple="false" icon small @click.stop.prevent="model.setPrimary(props.item.FileUUID)">
|
|
|
|
|
<v-icon v-if="props.item.FilePrimary" color="secondary-dark">radio_button_checked</v-icon>
|
|
|
|
|
<v-icon v-else color="secondary-dark">radio_button_unchecked</v-icon>
|
|
|
|
|
</v-btn></td>
|
2020-01-26 15:06:03 +00:00
|
|
|
|
<td>
|
2020-04-13 17:45:38 +00:00
|
|
|
|
<a :href="'/api/v1/download/' + props.item.FileHash" class="secondary-dark--text" target="_blank" v-if="$config.feature('download')">
|
2020-01-26 15:06:03 +00:00
|
|
|
|
{{ props.item.FileName }}
|
|
|
|
|
</a>
|
2020-04-13 17:45:38 +00:00
|
|
|
|
<span v-else>
|
|
|
|
|
{{ props.item.FileName }}
|
|
|
|
|
</span>
|
2020-01-26 15:06:03 +00:00
|
|
|
|
</td>
|
2020-04-21 08:23:27 +00:00
|
|
|
|
<td class="hidden-sm-and-down">{{ fileDimensions(props.item) }}</td>
|
|
|
|
|
<td class="hidden-xs-only">{{ fileSize(props.item) }}</td>
|
2020-01-29 18:12:31 +00:00
|
|
|
|
<td>{{ fileType(props.item) }}</td>
|
|
|
|
|
<td>{{ fileStatus(props.item) }}</td>
|
2020-01-24 10:27:35 +00:00
|
|
|
|
</template>
|
|
|
|
|
</v-data-table>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
name: 'p-tab-photo-edit-files',
|
|
|
|
|
props: {
|
|
|
|
|
model: Object,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
config: this.$config.values,
|
|
|
|
|
readonly: this.$config.getValue("readonly"),
|
|
|
|
|
selected: [],
|
|
|
|
|
listColumns: [
|
2020-04-21 08:23:27 +00:00
|
|
|
|
{text: this.$gettext('Primary'), value: 'FilePrimary', sortable: false, align: 'center', class: 'p-col-primary'},
|
2020-01-26 15:06:03 +00:00
|
|
|
|
{text: this.$gettext('Name'), value: 'FileName', sortable: false, align: 'left'},
|
2020-04-21 08:23:27 +00:00
|
|
|
|
{text: this.$gettext('Dimensions'), value: '', sortable: false, class: 'hidden-sm-and-down'},
|
|
|
|
|
{text: this.$gettext('Size'), value: 'FileSize', sortable: false, class: 'hidden-xs-only'},
|
2020-01-29 18:12:31 +00:00
|
|
|
|
{text: this.$gettext('Type'), value: '', sortable: false, align: 'left'},
|
|
|
|
|
{text: this.$gettext('Status'), value: '', sortable: false, align: 'left'},
|
2020-01-24 10:27:35 +00:00
|
|
|
|
],
|
|
|
|
|
};
|
|
|
|
|
},
|
2020-01-26 15:06:03 +00:00
|
|
|
|
computed: {},
|
2020-01-24 10:27:35 +00:00
|
|
|
|
methods: {
|
|
|
|
|
openPhoto() {
|
|
|
|
|
this.$viewer.show([this.model], 0)
|
|
|
|
|
},
|
2020-04-21 08:23:27 +00:00
|
|
|
|
fileDimensions(file) {
|
|
|
|
|
if(!file.FileWidth || !file.FileHeight) { return ""; }
|
|
|
|
|
|
|
|
|
|
return file.FileWidth + " × " + file.FileHeight;
|
|
|
|
|
},
|
|
|
|
|
fileSize(file) {
|
|
|
|
|
if (!file.FileSize) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
const kb = Number.parseFloat(file.FileSize) / 1048576;
|
|
|
|
|
|
|
|
|
|
return kb.toFixed(1) + " MB";
|
|
|
|
|
},
|
2020-01-29 18:12:31 +00:00
|
|
|
|
fileType(file) {
|
2020-04-21 08:23:27 +00:00
|
|
|
|
if (file.FileVideo) {
|
2020-01-29 18:12:31 +00:00
|
|
|
|
return this.$gettext("Video");
|
|
|
|
|
} else if (file.FileSidecar) {
|
|
|
|
|
return this.$gettext("Sidecar");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return file.FileType.toUpperCase();
|
|
|
|
|
},
|
|
|
|
|
fileStatus(file) {
|
|
|
|
|
if (file.FileMissing) {
|
|
|
|
|
return this.$gettext("Missing");
|
|
|
|
|
} else if (file.FileError) {
|
|
|
|
|
return file.FileError;
|
|
|
|
|
} else if (file.Duplicate) {
|
|
|
|
|
return this.$gettext("Duplicate");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "OK";
|
2020-01-24 10:27:35 +00:00
|
|
|
|
},
|
|
|
|
|
refresh() {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|