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,
|
label: arg.placeholder,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string' && value) {
|
||||||
value = value.split(',')
|
value = value.split(',')
|
||||||
} else if (!value) {
|
} else if (!value) {
|
||||||
value = []
|
value = []
|
||||||
|
@ -296,8 +296,15 @@ export function formatYunoHostArgument(arg) {
|
||||||
prop = prop.split(':')
|
prop = prop.split(':')
|
||||||
const propName = prop[0]
|
const propName = prop[0]
|
||||||
const argName = prop.slice(-1)[0]
|
const argName = prop.slice(-1)[0]
|
||||||
|
|
||||||
if (argName in arg) {
|
if (argName in arg) {
|
||||||
field.props.props[propName] = arg[argName]
|
if (propName === 'choices') {
|
||||||
|
field.props.props[propName] = Object.entries(arg[argName]).map(
|
||||||
|
([value, text]) => ({ value, text }),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
field.props.props[propName] = arg[argName]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue