TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.
TypeScript graphviewkanban-boardnodejsproductivityproject-managementself-hostedtasktask-managementtask-managertodoapp
wip: size message
Nikolai Gimanba311c9382b6
diff --git a/web/src/components/features/files/parts/FileUploadingTile.vue b/web/src/components/features/files/parts/FileUploadingTile.vueindex 07e3849..6b4a482 100644--- a/web/src/components/features/files/parts/FileUploadingTile.vue+++ b/web/src/components/features/files/parts/FileUploadingTile.vue@@ -22,10 +22,11 @@class="size-6 text-error"/><p class="text-xs text-error text-center">- {{ t(upload.errorKey ?? 'files.errors.uploadFailed') }}+ {{ errorText }}</p><div class="flex gap-1"><UButton+ v-if="!isTooLarge":label="t('files.retry')"size="xs"color="neutral"@@ -65,11 +66,13 @@</template><script setup lang="ts">+import { computed } from 'vue'import { useI18n } from 'vue-i18n'import type { FileUploadItem } from '@/types/files.types'import { useFileKind } from '@/composables/useFileKind'+import { FILE_TOO_LARGE_ERROR_KEY, useFilesStore } from '@/stores/files.store'-defineProps<{+const props = defineProps<{upload: FileUploadItem}>()@@ -80,4 +83,12 @@ const emit = defineEmits<{const { t } = useI18n()const { formatBytes } = useFileKind()+const filesStore = useFilesStore()++const isTooLarge = computed(() => props.upload.errorKey === FILE_TOO_LARGE_ERROR_KEY)+const errorText = computed(() => {+ const limit = filesStore.storage.maxFileSizeBytes+ if (isTooLarge.value && limit !== null) return t('files.errors.tooLargeLimit', { size: formatBytes(limit) })+ return t(props.upload.errorKey ?? 'files.errors.uploadFailed')+})</script>diff --git a/web/src/locales/de.ts b/web/src/locales/de.tsindex a50e50c..4ff6f76 100644--- a/web/src/locales/de.ts+++ b/web/src/locales/de.ts@@ -1490,6 +1490,7 @@ export default {},errors: {tooLarge: 'Datei ist zu groß',+ tooLargeLimit: 'Datei ist größer als {size}',forbidden: 'Keine Berechtigung zum Hochladen',notFound: 'Aufgabe nicht gefunden',uploadFailed: 'Hochladen fehlgeschlagen',diff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex f357c1c..d838f74 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -1504,6 +1504,7 @@ export default {},errors: {tooLarge: 'File is too large',+ tooLargeLimit: 'File is larger than {size}',forbidden: 'No permission to upload',notFound: 'Task not found',uploadFailed: 'Upload failed',diff --git a/web/src/locales/es.ts b/web/src/locales/es.tsindex 4c4c14f..dbab8e2 100644--- a/web/src/locales/es.ts+++ b/web/src/locales/es.ts@@ -1490,6 +1490,7 @@ export default {},errors: {tooLarge: 'El archivo es demasiado grande',+ tooLargeLimit: 'El archivo supera {size}',forbidden: 'Sin permiso para subir',notFound: 'Tarea no encontrada',uploadFailed: 'Error al subir',diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.tsindex 7e53e5b..154078d 100644--- a/web/src/locales/pt-br.ts+++ b/web/src/locales/pt-br.ts@@ -1501,6 +1501,7 @@ export default {},errors: {tooLarge: 'O arquivo é muito grande',+ tooLargeLimit: 'O arquivo é maior que {size}',forbidden: 'Sem permissão para enviar',notFound: 'Tarefa não encontrada',uploadFailed: 'Falha no envio',diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.tsindex 47b7630..c63f8f2 100644--- a/web/src/locales/ru.ts+++ b/web/src/locales/ru.ts@@ -1439,6 +1439,7 @@ export default {},errors: {tooLarge: 'Файл слишком большой',+ tooLargeLimit: 'Файл больше {size}',forbidden: 'Нет прав на загрузку',notFound: 'Задача не найдена',uploadFailed: 'Не удалось загрузить',diff --git a/web/src/stores/files.store.ts b/web/src/stores/files.store.tsindex 66390a8..b4c6df8 100644--- a/web/src/stores/files.store.ts+++ b/web/src/stores/files.store.ts@@ -11,6 +11,7 @@ import type {} from '@/types/files.types'const PAGE_SIZE = 50+export const FILE_TOO_LARGE_ERROR_KEY = 'files.errors.tooLarge'export const useFilesStore = defineStore('files', {state: (): FilesStoreState => ({@@ -95,6 +96,14 @@ export const useFilesStore = defineStore('files', {errorKey: null,controller: new AbortController(),}++ // The server enforces the limit too; checking here spares sending bytes that would be rejected anyway.+ const limit = this.storage.maxFileSizeBytes+ if (limit !== null && args.file.size > limit) {+ this.uploads.push({ ...item, status: 'error', errorKey: FILE_TOO_LARGE_ERROR_KEY })+ return null+ }+this.uploads.push(item)try {@@ -213,7 +222,7 @@ export const useFilesStore = defineStore('files', {errorKeyFor(err: unknown): string {const status = (err as { response?: { status?: number } })?.response?.status- if (status === 413) return 'files.errors.tooLarge'+ if (status === 413) return FILE_TOO_LARGE_ERROR_KEYif (status === 403) return 'files.errors.forbidden'if (status === 404) return 'files.errors.notFound'return 'files.errors.uploadFailed'