Commit 3735743a authored by Jean Rabreau's avatar Jean Rabreau
Browse files

馃毟 notify created items count on import

parent ca8d766d
......@@ -272,8 +272,9 @@ export const en_US = {
export: "Datacite export",
import: {
button: "CSV import",
success: "Import succeed !",
error: "Items haven't been created.",
success: "\"{filename}\" import succeed !",
created: "@:item.count ajout茅 脿 l'ensemble. | @:item.count ajout茅s 脿 l'ensemble.",
error: "Items haven't been created from file \"{filename}\".",
launch: "Launch"
},
file: "File",
......
......@@ -279,8 +279,9 @@ export const fr_FR = {
export: "Export Datacite",
import: {
button: "Import CSV",
success: "Import r茅ussi !",
error: "Les objets n'ont pas pu 锚tre cr茅茅s.",
success: "Import du fichier \"{filename}\" r茅ussi !",
created: "@:item.count ajout茅s 脿 l'ensemble.",
error: "Les objets n'ont pas pu 锚tre cr茅茅s 脿 partir du fichier \"{filename}\".",
launch: "Lancer l'import"
},
file: "Fichier",
......
......@@ -334,7 +334,7 @@ const Item = {
{root: true}
))
},
itemCSVImport({commit, rootGetters}, file) {
itemCSVImport({rootGetters}, file) {
const setId = rootGetters['set/setId']
const formData = new FormData()
formData.append("Content-Type", file.type)
......@@ -343,9 +343,7 @@ const Item = {
return authority.post(
`items/import_csv/`,
formData
).then(response => {
commit('SET_ITEMS', response.data)
})
).then(response => response.data.createdItems)
},
/**
* Create a copy of current item in the same set
......
......@@ -60,10 +60,13 @@ export default {
this.loading = true
const filename = this.currentFile.name
this.$store.dispatch('item/itemCSVImport', this.currentFile)
.then(() => {
.then(createdItems => {
this.$router.push({ name: 'setItems' })
this.displayInfo(
this.$t('item.import.success', { filename }),
[
this.$t('item.import.success', { filename }),
this.$tc('item.import.created', createdItems)
]
)
}).catch(error => {
this.progress = 0
......
......@@ -32,8 +32,6 @@ export default {
}),
...mapGetters('set', [
'canContribute',
'setId',
'templateId',
]),
crudListButtons() {
return this.canContribute ? [{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment