Skip to content

Commit

Permalink
fix: Update file picker usage
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Jun 17, 2024
1 parent 4f26fe8 commit b6d4ed0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@nextcloud/auth": "^2.3.0",
"@nextcloud/axios": "^2.5.0",
"@nextcloud/event-bus": "^3.3.1",
"@nextcloud/files": "^3.1.1",
"@nextcloud/files": "^3.4.1",
"@nextcloud/initial-state": "^2.2.0",
"@nextcloud/l10n": "^3.1.0",
"@nextcloud/moment": "^1.3.1",
Expand Down
20 changes: 12 additions & 8 deletions src/modules/modals/Import.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,24 @@ export default {
this.result = null
this.loading = false
},
pickFile() {
async pickFile() {
const filePicker = getFilePickerBuilder(t('text', 'Select file for the import'))
.setMultiSelect(false)
.setMimeTypeFilter(this.mimeTypes)
.setType(FilePickerType.Choose)
.addButton({
label: t('tables', 'Import'),
callback: (nodes) => {
const fileInfo = nodes[0]
this.path = fileInfo.path === '/'
? `/${fileInfo.name}`
: `${fileInfo.path}/${fileInfo.name}`
},
type: 'primary',
})
.startAt(this.path)
.build()
filePicker.pick().then((file) => {
const client = OC.Files.getClient()
client.getFileInfo(file).then((_status, fileInfo) => {
this.path = fileInfo.path === '/' ? `/${fileInfo.name}` : `${fileInfo.path}/${fileInfo.name}`
})
})
await filePicker.pick()
},
selectUploadFile() {
this.$refs.uploadFileInput.click()
Expand Down

0 comments on commit b6d4ed0

Please sign in to comment.