mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
fix: adapt choices
data structure
This commit is contained in:
parent
4b33e67514
commit
94956c57ee
1 changed files with 9 additions and 2 deletions
|
@ -221,7 +221,7 @@ export function formatYunoHostArgument(arg) {
|
|||
label: arg.placeholder,
|
||||
})
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
if (typeof value === 'string' && value) {
|
||||
value = value.split(',')
|
||||
} else if (!value) {
|
||||
value = []
|
||||
|
@ -296,10 +296,17 @@ export function formatYunoHostArgument(arg) {
|
|||
prop = prop.split(':')
|
||||
const propName = prop[0]
|
||||
const argName = prop.slice(-1)[0]
|
||||
|
||||
if (argName in arg) {
|
||||
if (propName === 'choices') {
|
||||
field.props.props[propName] = Object.entries(arg[argName]).map(
|
||||
([value, text]) => ({ value, text }),
|
||||
)
|
||||
} else {
|
||||
field.props.props[propName] = arg[argName]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Required (no need for checkbox its value can't be null)
|
||||
if (
|
||||
|
|
Loading…
Add table
Reference in a new issue