Skip to content

Commit

Permalink
fix: emui yaml editor populating with values (#2079)
Browse files Browse the repository at this point in the history
## Description:
@mieubrisse performed the following:
* open the postgres package for a new enclave
* Click YAML (sees `{}`)
* Click Form
* Click YAML (sees
```
persistent: false
launch_adminer: false
```

This is unexpected as the user has not specified values for these args.
This PR fixes an issue specifically in boolean input that caused this
problem - when we convert from 'kurtosis args' to 'form args' (YAML ->
Form) we set the value for the boolean input to `""` (rather than
undefined - I don't think we can set values on the form to the undefined
value). Then when we convert 'form args' to 'kurtosis args' (Form ->
YAML) we need to treat the empty string as if no value were set, rather
than a falsey value.

## Is this change user facing?
YES

## References (if applicable):
* Direct message on slack.
  • Loading branch information
Dartoxian authored Jan 25, 2024
1 parent cc44589 commit 7669881
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function transformFormArgsToKurtosisArgs(data: Record<string, any>, kurto
case ArgumentValueType.LIST:
return value.map((v: any) => transformValue(innerValuetype, v));
case ArgumentValueType.BOOL:
return isDefined(value) ? isStringTrue(value) : null;
return isDefined(value) && value !== "" ? isStringTrue(value) : null;
case ArgumentValueType.INTEGER:
return isNaN(value) || isNaN(parseFloat(value)) ? null : parseFloat(value);
case ArgumentValueType.STRING:
Expand Down

0 comments on commit 7669881

Please sign in to comment.