mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
add modified_on to files
This commit is contained in:
@@ -35,6 +35,10 @@ columns:
|
||||
type: timestamp
|
||||
nullable: false
|
||||
default: '$now'
|
||||
modified_on:
|
||||
type: timestamp
|
||||
nullable: false
|
||||
default: '$now'
|
||||
charset:
|
||||
type: string
|
||||
length: 50
|
||||
|
||||
@@ -91,3 +91,9 @@ fields:
|
||||
- collection: directus_files
|
||||
field: filesize
|
||||
display: filesize
|
||||
- collection: directus_files
|
||||
field: modified_on
|
||||
interface: dateTime
|
||||
locked: true
|
||||
special: date-updated
|
||||
width: full
|
||||
@@ -36,6 +36,11 @@
|
||||
<dd>{{ creationDate }}</dd>
|
||||
</div>
|
||||
|
||||
<div v-if="modificationDate">
|
||||
<dt>{{ $t('modified') }}</dt>
|
||||
<dd>{{ modificationDate }}</dd>
|
||||
</div>
|
||||
|
||||
<div v-if="file.checksum" class="checksum">
|
||||
<dt>{{ $t('checksum') }}</dt>
|
||||
<dd>{{ file.checksum }}</dd>
|
||||
@@ -123,14 +128,15 @@ export default defineComponent({
|
||||
return bytes(props.file.filesize, { decimalPlaces: 2, unitSeparator: ' ' }); // { locale: i18n.locale.split('-')[0] }
|
||||
});
|
||||
|
||||
const { creationDate } = useCreationDate();
|
||||
const { creationDate, modificationDate } = useDates();
|
||||
const { user } = useUser();
|
||||
const { folder } = useFolder();
|
||||
|
||||
return { readableMimeType, size, creationDate, user, folder, marked };
|
||||
return { readableMimeType, size, creationDate, modificationDate, user, folder, marked };
|
||||
|
||||
function useCreationDate() {
|
||||
function useDates() {
|
||||
const creationDate = ref<string | null>(null);
|
||||
const modificationDate = ref<string | null>(null);
|
||||
|
||||
watch(
|
||||
() => props.file,
|
||||
@@ -141,11 +147,18 @@ export default defineComponent({
|
||||
new Date(props.file.uploaded_on),
|
||||
String(i18n.t('date-fns_date_short'))
|
||||
);
|
||||
|
||||
if(props.file.modified_on) {
|
||||
modificationDate.value = await localizedFormat(
|
||||
new Date(props.file.modified_on),
|
||||
String(i18n.t('date-fns_date_short'))
|
||||
);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
return { creationDate };
|
||||
return { creationDate, modificationDate };
|
||||
}
|
||||
|
||||
function useUser() {
|
||||
|
||||
@@ -274,6 +274,7 @@ export default defineComponent({
|
||||
'checksum',
|
||||
'uploaded_by',
|
||||
'uploaded_on',
|
||||
'modified_on',
|
||||
'duration',
|
||||
'folder',
|
||||
'charset',
|
||||
|
||||
Reference in New Issue
Block a user