[files max50mb, autocomplete fix]

This commit is contained in:
romankko2 committed 2023-04-04 18:10:31 +02:00
1 parent 356dd12566
commit ebc27a9ae2
3 files changed
+12 -3

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ const options: Options = {
'GET v1/overview/teams': true, 'GET v1/overview/teams': true,
'GET v1/overview/tasks': true, 'GET v1/overview/tasks': true,
'GET v1/search': true, // 'GET v1/search': true,
} }
} }
} }
@@ -71,7 +71,7 @@ export default {
const filteredOptions = this.options.filter(option => { const filteredOptions = this.options.filter(option => {
const normalizedValue = this._normalize(option.value) const normalizedValue = this._normalize(option.value)
return normalizedSearch == normalizedValue.slice(0, normalizedSearch.length) return normalizedValue.includes(normalizedSearch)
}) })
if (!filteredOptions[0]) if (!filteredOptions[0])
@@ -17,6 +17,7 @@
<v-chip class="mt-2"> <v-chip class="mt-2">
{{ file.name }} {{ file.name }}
<v-icon class="mx-1" icon="mdi-paperclip"></v-icon> <v-icon class="mx-1" icon="mdi-paperclip"></v-icon>
<p>{{ (file.size / (1024 * 1024)).toFixed(2) }} MB</p>
<v-icon size="small" icon="mdi-close" @click.stop="remove(uploadedFiles.indexOf(file))"></v-icon> <v-icon size="small" icon="mdi-close" @click.stop="remove(uploadedFiles.indexOf(file))"></v-icon>
</v-chip> </v-chip>
</div> </div>
@@ -47,7 +48,15 @@ export default {
methods: { methods: {
onChange() { onChange() {
this.uploadedFiles = [...this.uploadedFiles, ...this.$refs.fileUpload.files] const files = [...this.$refs.fileUpload.files]
const maxSize = 50 * 1024 * 1024
const oversizedFiles = files.filter(file => file.size > maxSize)
if (oversizedFiles.length > 0) {
this.$toast.error('File is too large. Maximum file size is 50 MB.')
return
}
this.uploadedFiles = [...this.uploadedFiles, ...files]
this.$emit('files-uploaded', this.uploadedFiles) this.$emit('files-uploaded', this.uploadedFiles)
}, },