fix(edge/templates): get correct default value for selectType env vars EE-6796 (#11293)

pull/11308/head
matias-portainer 2024-03-04 10:35:19 -03:00 committed by GitHub
parent 51c672af21
commit ec913b45d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -81,7 +81,15 @@ function Item({
} }
export function getDefaultValues(definitions: Array<TemplateEnv>): Value { export function getDefaultValues(definitions: Array<TemplateEnv>): Value {
return Object.fromEntries(definitions.map((v) => [v.name, v.default || ''])); return Object.fromEntries(
definitions.map((v) => {
if (v.select) {
return [v.name, v.select.find((v) => v.default)?.value || ''];
}
return [v.name, v.default || ''];
})
);
} }
export function envVarsFieldsetValidation(): SchemaOf<Value> { export function envVarsFieldsetValidation(): SchemaOf<Value> {