Skip to content

Commit

Permalink
Fix root folder links in the upload overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Apr 29, 2022
1 parent c993496 commit 3d5ba3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ export default defineComponent({
resource = buildResource(resource)
this.$uppyService.$emit('uploadedFileFetched', file, resource)
// Update table only if the file was uploaded to the current directory
if (fileIsInCurrentPath) {
this.UPSERT_RESOURCE(resource)
Expand Down
6 changes: 6 additions & 0 deletions packages/web-app-files/src/views/FilesDrop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default {
onMounted(() => {
uppyService.$on('filesSelected', instance.onFilesSelected)
uppyService.$on('uploadSuccess', instance.onFileSuccess)
uppyService.$on('uploadError', instance.onFileError)
uppyService.useDropTarget({
Expand All @@ -67,6 +68,7 @@ export default {
onUnmounted(() => {
uppyService.$off('filesSelected', instance.onFilesSelected)
uppyService.$off('uploadSuccess', instance.onFileSuccess)
uppyService.$off('uploadError', instance.onFileError)
})
Expand Down Expand Up @@ -165,6 +167,10 @@ export default {
this.$uppyService.uploadFiles(uppyResources)
},
onFileSuccess(uppyResource) {
this.$uppyService.$emit('uploadedFileFetched', uppyResource, { name: uppyResource.name })
},
onFileError(error) {
console.error(error)
this.showMessage({
Expand Down
18 changes: 5 additions & 13 deletions packages/web-runtime/src/components/UploadInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,10 @@ export default {
this.filesUploading = 0
this.uploadCancelled = true
})
this.$uppyService.$on('uploadSuccess', (file) => {
// @TODO we need the storage ID here... maybe fetch the file via DAV and call buildResources()?
let path = file.meta.currentFolder
if (file.meta.relativePath) {
path += file.meta.relativePath
}
path += file.name
this.$uppyService.$on('uploadedFileFetched', (uppyResource, fetchedFile) => {
this.successfulUploads.push({
...file,
path,
targetRoute: file.meta.route
...fetchedFile,
targetRoute: uppyResource.meta.route
})
})
},
Expand Down Expand Up @@ -169,7 +160,8 @@ export default {
name: targetRoute.name,
query: targetRoute.query,
params: {
...(storageId && path && { storageId })
...(storageId && path && { storageId }),
storage: targetRoute.params?.storage
}
}
Expand Down

0 comments on commit 3d5ba3a

Please sign in to comment.