mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Fix FileItem value 'current' prop
This commit is contained in:
parent
76c6a0eb70
commit
97bd1564c4
2 changed files with 6 additions and 12 deletions
|
@ -9,7 +9,7 @@
|
|||
</b-button>
|
||||
|
||||
<b-form-file
|
||||
v-model="file"
|
||||
:value="value.file"
|
||||
ref="input-file"
|
||||
:id="id"
|
||||
:required="required"
|
||||
|
@ -33,7 +33,7 @@ export default {
|
|||
|
||||
props: {
|
||||
id: { type: String, default: null },
|
||||
value: { type: Object, default: () => ({}) },
|
||||
value: { type: Object, default: () => ({ file: null }) },
|
||||
placeholder: { type: String, default: 'Choose a file or drop it here...' },
|
||||
dropPlaceholder: { type: String, default: null },
|
||||
accept: { type: String, default: null },
|
||||
|
@ -42,12 +42,6 @@ export default {
|
|||
name: { type: String, default: null }
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
file: this.value.file
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
_placeholder: function () {
|
||||
return this.value.file === null ? this.placeholder : this.value.file.name
|
||||
|
@ -59,7 +53,7 @@ export default {
|
|||
const value = {
|
||||
file,
|
||||
content: '',
|
||||
currentfile: false,
|
||||
current: false,
|
||||
removed: false
|
||||
}
|
||||
// Update the value with the new File and an empty content for now
|
||||
|
@ -76,7 +70,7 @@ export default {
|
|||
this.$emit('input', {
|
||||
file: null,
|
||||
content: '',
|
||||
current_file: false,
|
||||
current: false,
|
||||
removed: true
|
||||
})
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ export function formatYunoHostArgument (arg) {
|
|||
// in case of already defined file, we receive only the file path (not the actual file)
|
||||
file: value ? new File([''], value) : null,
|
||||
content: '',
|
||||
current_file: !!value,
|
||||
current: !!value,
|
||||
removed: false
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ export function formatFormDataValue (value, key = null) {
|
|||
// File has to be deleted
|
||||
if (value.removed) result = ''
|
||||
// File has not changed (will not be sent)
|
||||
else if (value.current_file || value.file === null) result = null
|
||||
else if (value.current || value.file === null) result = null
|
||||
else {
|
||||
return getFileContent(value.file, { base64: true }).then(content => {
|
||||
return {
|
||||
|
|
Loading…
Add table
Reference in a new issue