From 431ac74d788535c29c97a6f7f9746b16af37afa8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20Molakvo=C3=A6?= Date: Wed, 8 Nov 2023 17:50:20 +0100 Subject: [PATCH] feat(files): disable upload button if quota is reached MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/src/views/FilesList.vue | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 6aeb308677c..2fabbc7c5fa 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -25,6 +25,7 @@ + + + + + {{ t('files', 'Add') }} + + - @@ -122,6 +138,7 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import NcEmptyContent from '@nextcloud/vue/dist/Components/NcEmptyContent.js' import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js' import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' +import PlusIcon from 'vue-material-design-icons/Plus.vue' import ShareVariantIcon from 'vue-material-design-icons/ShareVariant.vue' import ViewGridIcon from 'vue-material-design-icons/ViewGrid.vue' @@ -155,6 +172,7 @@ export default defineComponent({ NcEmptyContent, NcIconSvgWrapper, NcLoadingIcon, + PlusIcon, ShareVariantIcon, UploadPicker, ViewGridIcon, @@ -360,6 +378,15 @@ export default defineComponent({ canUpload() { return this.currentFolder && (this.currentFolder.permissions & Permission.CREATE) !== 0 }, + isQuotaExceeded() { + return this.currentFolder?.attributes?.['quota-available-bytes'] === 0 + }, + cantUploadLabel() { + if (this.isQuotaExceeded) { + return this.t('files', 'Your have used your space quota and cannot upload files anymore') + } + return this.t('files', 'You don’t have permission to upload or create files here') + }, /** * Check if current folder has share permissions -- 2.39.5