Bug 38466: Fix error messages in KBART import

Test plan:
1) Download the file attached to this bug and save it as a .txt file
2) In the ERM module, create a local package
3) Go to the local titles page and click Import from KBART file
4) Select your package and the saved file and click import
5) The import will fail with just a console error
6) Apply patch and run a restart_all and a yarn js:build
7) Repeat step 4, it should now display an error saying the file must be either TSV or CSV
8) Convert the file to either of those two formats and repeat step 4
9) The file should now import successfully, with a message saying that there is an additional column "bestppn" that will not be imported

Signed-off-by: msaby <mathsabypro@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-11-18 11:49:01 +00:00 committed by Katrin Fischer
parent 186824d9a6
commit 68be4dd747
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 5 additions and 4 deletions

View File

@ -285,7 +285,7 @@ sub import_from_kbart_file {
if ( $file->{filename} !~ /\.csv$/ && $file->{filename} !~ /\.tsv$/ ) {
return $c->render(
status => 201,
openapi => { invalid_filetype => 1 }
openapi => { warnings => { invalid_filetype => 1 } }
);
}

View File

@ -86,9 +86,10 @@ import { ref, inject } from "vue"
export default {
setup() {
const { setMessage } = inject("mainStore")
const { setMessage, setWarning } = inject("mainStore")
return {
setMessage,
setWarning,
}
},
data() {
@ -171,11 +172,11 @@ export default {
)}</p>`
this.setMessage(message, true)
}
if (success.invalid_filetype) {
if (success.warnings.invalid_filetype) {
message += `<p>${this.$__(
"The file must be in .tsv or .csv format, please convert your file and try again."
)}</p>`
setWarning(message)
this.setWarning(message)
}
},
error => {}