From 714fb1cce9f2e2f988d9b6c579b59355956f749a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 16 Jun 2024 17:19:18 +0200 Subject: [PATCH 1/3] fix(files_versions): Use `NcDateTime` to ensure date is transalted properly Also do not use filters, filters are deprecated and will make migration to Vue 3 harder. Signed-off-by: Ferdinand Thiessen --- .../files_versions/src/components/Version.vue | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/apps/files_versions/src/components/Version.vue b/apps/files_versions/src/components/Version.vue index 1afe28250c682..4f478fe6915f0 100644 --- a/apps/files_versions/src/components/Version.vue +++ b/apps/files_versions/src/components/Version.vue @@ -58,10 +58,12 @@ @@ -130,6 +132,7 @@ import Pencil from 'vue-material-design-icons/Pencil.vue' import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js' import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js' import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js' +import NcDateTime from '@nextcloud/vue/dist/Components/NcDateTime.js' import NcListItem from '@nextcloud/vue/dist/Components/NcListItem.js' import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js' @@ -151,6 +154,7 @@ export default defineComponent({ NcActionLink, NcActionButton, NcAvatar, + NcDateTime, NcListItem, BackupRestore, Download, @@ -164,20 +168,6 @@ export default defineComponent({ tooltip: Tooltip, }, - created() { - this.fetchDisplayName() - }, - - filters: { - humanReadableSize(bytes: number): string { - return formatFileSize(bytes) - }, - - humanDateFromNow(timestamp: number): string { - return moment(timestamp).fromNow() - }, - }, - props: { version: { type: Object as PropType, @@ -221,6 +211,10 @@ export default defineComponent({ }, computed: { + humanReadableSize() { + return formatFileSize(this.version.size) + }, + versionLabel(): string { const label = this.version.label ?? '' @@ -247,10 +241,6 @@ export default defineComponent({ } }, - formattedDate(): string { - return moment(this.version.mtime).format('LLL') - }, - enableLabeling(): boolean { return this.capabilities.files.version_labeling === true }, @@ -286,6 +276,10 @@ export default defineComponent({ }, }, + created() { + this.fetchDisplayName() + }, + methods: { labelUpdate() { this.$emit('label-update-request') From 5a69a73b486634555ce97dc8365710401c2cc7b6 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 16 Jun 2024 17:20:32 +0200 Subject: [PATCH 2/3] fix(files_versions): Version name and date should be shrinkable to allow viewing on small screens Signed-off-by: Ferdinand Thiessen --- .../files_versions/src/components/Version.vue | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/apps/files_versions/src/components/Version.vue b/apps/files_versions/src/components/Version.vue index 4f478fe6915f0..c676ba0acb5da 100644 --- a/apps/files_versions/src/components/Version.vue +++ b/apps/files_versions/src/components/Version.vue @@ -41,9 +41,13 @@