args: reflect pydantic change of name to id

This commit is contained in:
axolotle 2023-04-24 18:04:12 +02:00 committed by Alexandre Aubin
parent 2d5649ea6d
commit 1fe4320bde

View file

@ -84,8 +84,8 @@ export function evaluateExpression (expression, forms) {
if (expression === '"false"') return false if (expression === '"false"') return false
const context = Object.values(forms).reduce((ctx, args) => { const context = Object.values(forms).reduce((ctx, args) => {
Object.entries(args).forEach(([name, value]) => { Object.entries(args).forEach(([id, value]) => {
ctx[name] = isObjectLiteral(value) && 'file' in value ? value.content : value ctx[id] = isObjectLiteral(value) && 'file' in value ? value.content : value
}) })
return ctx return ctx
}, {}) }, {})
@ -136,7 +136,7 @@ export function formatYunoHostArgument (arg) {
} }
} }
const defaultProps = ['id:name', 'placeholder:example'] const defaultProps = ['id', 'placeholder:example']
const components = [ const components = [
{ {
types: ['string', 'path'], types: ['string', 'path'],
@ -177,7 +177,7 @@ export function formatYunoHostArgument (arg) {
{ {
types: ['select', 'user', 'domain', 'app', 'group'], types: ['select', 'user', 'domain', 'app', 'group'],
name: 'SelectItem', name: 'SelectItem',
props: ['id:name', 'choices'], props: ['id', 'choices'],
callback: function () { callback: function () {
if (arg.type !== 'select') { if (arg.type !== 'select') {
field.props.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) } field.props.link = { name: arg.type + '-list', text: i18n.t(`manage_${arg.type}s`) }
@ -226,7 +226,7 @@ export function formatYunoHostArgument (arg) {
{ {
types: ['boolean'], types: ['boolean'],
name: 'CheckboxItem', name: 'CheckboxItem',
props: ['id:name', 'choices'], props: ['id', 'choices'],
callback: function () { callback: function () {
if (value !== null && value !== undefined) { if (value !== null && value !== undefined) {
value = ['1', 'yes', 'y', 'true'].includes(String(value).toLowerCase()) value = ['1', 'yes', 'y', 'true'].includes(String(value).toLowerCase())
@ -352,10 +352,10 @@ export function formatYunoHostArguments (args, forms) {
for (const arg of args) { for (const arg of args) {
const { value, field, validation, error } = formatYunoHostArgument(arg) const { value, field, validation, error } = formatYunoHostArgument(arg)
fields[arg.name] = field fields[arg.id] = field
form[arg.name] = value form[arg.id] = value
if (validation) validations[arg.name] = validation if (validation) validations[arg.id] = validation
errors[arg.name] = error errors[arg.id] = error
if ('visible' in arg && ![false, '"false"'].includes(arg.visible)) { if ('visible' in arg && ![false, '"false"'].includes(arg.visible)) {
addEvaluationGetter('visible', field, arg.visible, forms) addEvaluationGetter('visible', field, arg.visible, forms)