mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
F OpenNebula/one#5469: Add support to object lists inputs (#1382)
This commit is contained in:
parent
15823008b3
commit
7daa2695a6
@ -27,7 +27,7 @@ export const FORM_FIELDS = inputs =>
|
||||
max_value: max,
|
||||
options
|
||||
}) => {
|
||||
const optionsValue = options?.join(',') ?? `${min}..${max}`
|
||||
const optionsValue = options ?? `${min}..${max}`
|
||||
|
||||
return {
|
||||
name,
|
||||
|
@ -21,13 +21,16 @@ const requiredSchema = (mandatory, name, schema) =>
|
||||
? schema.required(`${name} field is required`)
|
||||
: schema.notRequired().nullable()
|
||||
|
||||
const getRange = (options) =>
|
||||
options.split('..').map(option => parseFloat(option))
|
||||
const getRange = options => options?.split('..').map(option => parseFloat(option))
|
||||
|
||||
const getValuesFromArray = (options, separator = ';') => options?.split(separator)
|
||||
|
||||
const getOptionsFromList = (options, separator = ',') =>
|
||||
options?.split(separator).map(value => ({ text: value, value }))
|
||||
const getOptionsFromList = options => options
|
||||
?.map(option => typeof option === 'string'
|
||||
? ({ text: option, value: option })
|
||||
: option
|
||||
)
|
||||
?.filter(({ text, value } = {}) => text && value)
|
||||
|
||||
/**
|
||||
* @typedef {(
|
||||
|
Loading…
x
Reference in New Issue
Block a user