Testing: add fallback for testing old attachments
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -23,6 +23,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<AttachmentDragAndDrop :card-id="cardId" class="drop-upload--sidebar">
|
<AttachmentDragAndDrop :card-id="cardId" class="drop-upload--sidebar">
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
|
<button class="icon-upload" @click="uploadLocalFile()">
|
||||||
|
{{ t('deck', 'Upload local files') }}
|
||||||
|
</button>
|
||||||
<button class="icon-upload" @click="uploadNewFile()">
|
<button class="icon-upload" @click="uploadNewFile()">
|
||||||
{{ t('deck', 'Upload new files') }}
|
{{ t('deck', 'Upload new files') }}
|
||||||
</button>
|
</button>
|
||||||
@@ -30,11 +33,16 @@
|
|||||||
{{ t('deck', 'Share from Files') }}
|
{{ t('deck', 'Share from Files') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<input ref="localAttachments"
|
<input ref="filesAttachment"
|
||||||
type="file"
|
type="file"
|
||||||
style="display: none;"
|
style="display: none;"
|
||||||
multiple
|
multiple
|
||||||
@change="handleUploadFile">
|
@change="handleUploadFile">
|
||||||
|
<input ref="localAttachments"
|
||||||
|
type="file"
|
||||||
|
style="display: none;"
|
||||||
|
multiple
|
||||||
|
@change="handleLocalUploadFile">
|
||||||
<ul class="attachment-list">
|
<ul class="attachment-list">
|
||||||
<li v-for="attachment in uploadQueue" :key="attachment.name" class="attachment">
|
<li v-for="attachment in uploadQueue" :key="attachment.name" class="attachment">
|
||||||
<a class="fileicon" :style="mimetypeForAttachment()" />
|
<a class="fileicon" :style="mimetypeForAttachment()" />
|
||||||
@@ -195,11 +203,21 @@ export default {
|
|||||||
handleUploadFile(event) {
|
handleUploadFile(event) {
|
||||||
const files = event.target.files ?? []
|
const files = event.target.files ?? []
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
this.onLocalAttachmentSelected(file)
|
this.onLocalAttachmentSelected(file, 'file')
|
||||||
|
}
|
||||||
|
event.target.value = ''
|
||||||
|
},
|
||||||
|
handleLocalUploadFile(event) {
|
||||||
|
const files = event.target.files ?? []
|
||||||
|
for (const file of files) {
|
||||||
|
this.onLocalAttachmentSelected(file, 'deck_file')
|
||||||
}
|
}
|
||||||
event.target.value = ''
|
event.target.value = ''
|
||||||
},
|
},
|
||||||
uploadNewFile() {
|
uploadNewFile() {
|
||||||
|
this.$refs.filesAttachment.click()
|
||||||
|
},
|
||||||
|
uploadLocalFile() {
|
||||||
this.$refs.localAttachments.click()
|
this.$refs.localAttachments.click()
|
||||||
},
|
},
|
||||||
shareFromFiles() {
|
shareFromFiles() {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onLocalAttachmentSelected(file) {
|
async onLocalAttachmentSelected(file, type) {
|
||||||
if (this.maxUploadSize > 0 && file.size > this.maxUploadSize) {
|
if (this.maxUploadSize > 0 && file.size > this.maxUploadSize) {
|
||||||
showError(
|
showError(
|
||||||
t('deck', 'Failed to upload {name}', { name: file.name }) + ' - '
|
t('deck', 'Failed to upload {name}', { name: file.name }) + ' - '
|
||||||
@@ -45,7 +45,7 @@ export default {
|
|||||||
this.$set(this.uploadQueue, file.name, { name: file.name, progress: 0 })
|
this.$set(this.uploadQueue, file.name, { name: file.name, progress: 0 })
|
||||||
const bodyFormData = new FormData()
|
const bodyFormData = new FormData()
|
||||||
bodyFormData.append('cardId', this.cardId)
|
bodyFormData.append('cardId', this.cardId)
|
||||||
bodyFormData.append('type', 'file')
|
bodyFormData.append('type', type)
|
||||||
bodyFormData.append('file', file)
|
bodyFormData.append('file', file)
|
||||||
await queue.add(async() => {
|
await queue.add(async() => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user