Browse Source

Merge pull request #1714 from doccano/enhancement/datasetImportPage

[Enhancement] Dataset import page
pull/1716/head
Hiroki Nakayama 2 years ago
committed by GitHub
parent
commit
b98c679a16
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions
  1. 18
      frontend/pages/projects/_id/dataset/import.vue
  2. 5
      frontend/pages/projects/_id/dataset/index.vue

frontend/pages/projects/_id/upload/index.vue → frontend/pages/projects/_id/dataset/import.vue

@ -59,8 +59,8 @@
:accepted-file-types="acceptedFileTypes" :accepted-file-types="acceptedFileTypes"
:server="server" :server="server"
:files="myFiles" :files="myFiles"
@processfile="handleFilePondProcessfile"
@removefile="handleFilePondRemovefile"
@processfile="handleFilePondProcessFile"
@removefile="handleFilePondRemoveFile"
/> />
<file-pond <file-pond
v-if="selected && acceptedFileTypes === '*'" v-if="selected && acceptedFileTypes === '*'"
@ -70,8 +70,8 @@
:allow-multiple="true" :allow-multiple="true"
:server="server" :server="server"
:files="myFiles" :files="myFiles"
@processfile="handleFilePondProcessfile"
@removefile="handleFilePondRemovefile"
@processfile="handleFilePondProcessFile"
@removefile="handleFilePondRemoveFile"
/> />
<v-data-table <v-data-table
v-if="errors.length > 0" v-if="errors.length > 0"
@ -81,9 +81,8 @@
></v-data-table> ></v-data-table>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer />
<v-btn <v-btn
class='text-capitalize me-2 primary'
class='text-capitalize ms-2 primary'
:disabled="isDisabled" :disabled="isDisabled"
@click="importDataset" @click="importDataset"
> >
@ -220,12 +219,12 @@ export default {
}, },
methods: { methods: {
handleFilePondProcessfile(error, file) {
handleFilePondProcessFile(error, file) {
console.log(error) console.log(error)
this.uploadedFiles.push(file) this.uploadedFiles.push(file)
this.$nextTick() this.$nextTick()
}, },
handleFilePondRemovefile(error, file) {
handleFilePondRemoveFile(error, file) {
console.log(error) console.log(error)
const index = this.uploadedFiles.findIndex(item => item.id === file.id) const index = this.uploadedFiles.findIndex(item => item.id === file.id)
if (index > -1) { if (index > -1) {
@ -252,6 +251,9 @@ export default {
this.myFiles = [] this.myFiles = []
this.uploadedFiles = [] this.uploadedFiles = []
this.isImporting = false this.isImporting = false
if (this.errors.length === 0) {
this.$router.push(`/projects/${this.$route.params.id}/dataset`)
}
} }
} }
}, 3000) }, 3000)

5
frontend/pages/projects/_id/dataset/index.vue

@ -2,7 +2,7 @@
<v-card> <v-card>
<v-card-title v-if="isProjectAdmin"> <v-card-title v-if="isProjectAdmin">
<action-menu <action-menu
@upload="upload"
@upload="$router.push('dataset/import')"
@download="dialogDownload=true" @download="dialogDownload=true"
/> />
<v-btn <v-btn
@ -173,9 +173,6 @@ export default Vue.extend({
this.dialogDeleteAll = false this.dialogDeleteAll = false
this.selected = [] this.selected = []
}, },
upload() {
this.$router.push(`/projects/${this.projectId}/upload`)
},
updateQuery(query: object) { updateQuery(query: object) {
this.$router.push(query) this.$router.push(query)
}, },

Loading…
Cancel
Save