Skip to content

feat: Support booleans for parameters input - #3437

Merged
BrunoQuaresma merged 2 commits into
mainfrom
bq/2659-suuport-boolean-values
Aug 10, 2022
Merged

BrunoQuaresma merged 2 commits into
mainfrom
bq/2659-suuport-boolean-values

Conversation

@BrunoQuaresma

@BrunoQuaresma BrunoQuaresma commented Aug 9, 2022 •

Copy link
Copy Markdown
Contributor

Closes #2659

Preview:

Screen Shot 2022-08-09 at 16 36 36

Screen Shot 2022-08-09 at 16 39 44

PS: I tried with Checkbox but for the current design, having a Radio Group fits better when together with other fields, but I'm open. Here is what the checkbox looks like:

Screen Shot 2022-08-09 at 16 40 54

@BrunoQuaresma BrunoQuaresma self-assigned this Aug 9, 2022
@BrunoQuaresma
BrunoQuaresma requested a review from a team as a code owner August 9, 2022 19:39
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"

const isBoolean = (schema: ParameterSchema) => {
return schema.validation_value_type === "bool"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to have an enum for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is true, but I would wait until we use it more often or with different values.

name: "disable_docker",
description: "Disable Docker?",
validation_value_type: "bool",
default_source_value: "false",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have testing entities for these objects?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't. Do you think it would be interesting to have?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know! I haven't worked extensively with these inputs. If you think it will be used in other stories, great. If not, no worries.

@Kira-Pilot Kira-Pilot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have time to pull down but the code looks good!

…ries.tsx

Co-authored-by: Kira Pilot <kira@coder.com>
@matifali

Copy link
Copy Markdown
Contributor

Can the display names be more human-friendly.?
from var.instance_size to Instance size

@BrunoQuaresma

BrunoQuaresma commented Aug 10, 2022 •

Copy link
Copy Markdown
Contributor Author

Can the display names be more human-friendly.? from var.instance_size to Instance size

I think this is a good suggestion. We already have a description so I think what we can do is if there is a description, display it as a label, if not, display the variable name. What do you think? Also, I think this work could be in a diff PR, so I'm going to merge this one, but feel free to keep the discussion here if you want to.

@BrunoQuaresma
BrunoQuaresma merged commit 758eb21 into main Aug 10, 2022
@BrunoQuaresma
BrunoQuaresma deleted the bq/2659-suuport-boolean-values branch August 10, 2022 13:41
@matifali

matifali commented Aug 10, 2022 •

Copy link
Copy Markdown
Contributor

Seem's like a good idea.
Can you point me to where in the code this is being done?

@BrunoQuaresma

Copy link
Copy Markdown
Contributor Author

@matifali sure thing, here is

const ParameterLabel: React.FC<{ schema: ParameterSchema }> = ({ schema }) => {
const styles = useStyles()
return (
<label className={styles.label} htmlFor={schema.name}>
<strong>var.{schema.name}</strong>
{schema.description && <span className={styles.labelDescription}>{schema.description}</span>}
</label>
)
}

@matifali

Copy link
Copy Markdown
Contributor

Can the display names be more human-friendly.?

Any plans for to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add checkbox input for boolean variable

3 participants