fix(webui): series cover uploads (#729)

This commit is contained in:
Snd-R 2021-11-22 11:14:31 +03:00 committed by GitHub
parent 9199407644
commit 32f4d7f651
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -1,7 +1,7 @@
<template>
<label class="drop-zone" v-cloak @drop.prevent="dropHandler" @dragover.prevent>
<span class="file-input">Choose an image</span> - drag and drop
<input hidden aria-hidden="true" type="file" accept="image/*" multiple @change="dropHandler" >
<input ref="input" hidden aria-hidden="true" type="file" accept="image/*" multiple @change="dropHandler">
</label>
</template>
@ -25,6 +25,9 @@ export default Vue.extend({
this.$emit('on-input-change', Array.from(selectedFiles))
}
},
reset() {
(this.$refs.input as HTMLInputElement).value = ''
},
},
})
</script>

View file

@ -323,7 +323,7 @@
<!-- Upload -->
<v-row>
<v-col class="pa-1">
<drop-zone @on-input-change="addThumbnail" class="pa-8"/>
<drop-zone ref="thumbnailsUpload" @on-input-change="addThumbnail" class="pa-8"/>
</v-col>
</v-row>
@ -665,7 +665,7 @@ export default Vue.extend({
if (this.single && this.poster.uploadQueue.length > 0) {
const series = this.series as SeriesDto
let hadErrors = false
for (const file of this.poster.uploadQueue) {
for (const file of this.poster.uploadQueue.slice()) {
try {
await this.$komgaSeries.uploadThumbnail(series.id, file, file.name === this.poster.selectedThumbnail)
this.deleteThumbnail(file)
@ -716,6 +716,8 @@ export default Vue.extend({
}
}
}
(this.$refs.thumbnailsUpload as any).reset()
},
async getThumbnails(series: SeriesDto | SeriesDto[]) {
if (Array.isArray(series)) return
@ -752,7 +754,7 @@ export default Vue.extend({
this.poster.uploadQueue.splice(index, 1)
}
if (item.name === this.poster.selectedThumbnail) {
this.selectThumbnail(this.poster.seriesThumbnails.find(x => x.selected))
this.poster.selectedThumbnail = ''
}
} else {
// if thumbnail was marked for deletion, unmark it