Unverified Commit 0ce5ae91 authored by Alberto Nale's avatar Alberto Nale Committed by GitHub
Browse files

[KNOWAGE-6958]

Bugfix KNOWAGE-6958
parents c6f74a0b 2ca68a83
......@@ -44,5 +44,5 @@ export interface iMetadata {
generalMetadata: { name: string, value: string }[],
shortText: { id: number, name: string, value: string }[],
longText: { id: number, name: string, value: string }[],
file: { id: number, name: string, value: string }[]
file: { id: number, name: string, value: string, fileToSave?: { file: {}, fileName: string } }[],
}
\ No newline at end of file
......@@ -812,10 +812,10 @@ export default defineComponent({
async onMetadataSave(metadata: any) {
this.loading = true
const jsonMeta = [] as any[]
const properties = ['shortText', 'longText']
const properties = ['shortText', 'longText', 'file']
properties.forEach((property: string) =>
metadata[property].forEach((el: any) => {
if (el.value) {
if (el.value || (property === 'file' && el.fileToSave)) {
jsonMeta.push(el)
}
})
......
......@@ -153,6 +153,7 @@ export default defineComponent({
title: this.$t('common.uploadFile'),
msg: this.$t('common.uploadFileSuccess')
})
this.updateMetadataFile(meta.id, this.uploadedFiles[meta.id].name)
})
.catch((error: any) =>
this.$store.commit('setError', {
......@@ -163,10 +164,17 @@ export default defineComponent({
this.loading = false
}
},
updateMetadataFile(fileId: number, fileName: string) {
if (!this.metadata) return
const index = this.metadata?.file.findIndex((tempFile: any) => tempFile.id === fileId)
if (index !== -1) this.metadata.file[index].fileToSave = { file: {}, fileName: fileName }
},
cleanFile(meta: any) {
const temp = this.$refs[meta.id] as any
if (temp) {
if (temp && this.metadata) {
temp.resetInput()
const index = this.metadata.file.findIndex((tempFile: any) => tempFile.id === meta.id)
if (index !== -1) delete this.metadata.file[index].fileToSave
}
},
closeDialog() {
......
Supports Markdown
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