Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: allow number options with monotonic validation#12726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 8 commits intocoder:mainfromdannykopping:dk/monotonic
Mar 27, 2024

Conversation

dannykopping
Copy link
Contributor

@dannykoppingdannykopping commentedMar 22, 2024
edited
Loading

Fixes#11579

NOTE:terraform-provider-coder was updated to facilitate this change, and your template will requirev0.19.0 for this feature to work. You can runterraform init -upgrade in your template directory. If you have a version constraint set, ensure it points to this version.

This PR just does some light refactoring / cleanup; the real work was done incoder/terraform-provider-coder#202.

Initially we planned to extend validation in both the browser & CLI UIs, but we agreed to defer this until#7099 is implemented which would centralise all the logic. Right now the UIs don't validate the monotonicity before submit, but there is still backend validation of course.

Here's an example of how to use the new functionality:

data"coder_parameter""home_volume_size" {name="Home Volume Size"description=<<-EOF  How large should your home volume be?  EOFtype="number"default=30mutable=trueorder=3option {name="30GB"value=30  }option {name="60GB"value=60  }option {name="100GB"value=100  }validation {monotonic="increasing"  }}

Examples:

image

image

Signed-off-by: Danny Kopping <danny@coder.com>
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

Initially we planned to extend validation in both the browser & CLI UIs

I don't remember now if CLI supports validation of monotonicity. As long as it usescodersdk.ValidateWorkspaceBuildParameters, it should be supported. Maybe drop another CLI test to verify the behavior?

, but we agreed to defer this until#7099 is implemented which would centralise all the logic.

Since validation might work well on the CLI, I'm wondering if it isn't a low hanging fruit to come up with a temporary fix for the frontend. I'm unsure how frontend deals with monotonicity right now.

@dannykopping
Copy link
ContributorAuthor

dannykopping commentedMar 22, 2024
edited
Loading

Initially we planned to extend validation in both the browser & CLI UIs

I don't remember now if CLI supports validation of monotonicity. As long as it usescodersdk.ValidateWorkspaceBuildParameters, it should be supported. Maybe drop another CLI test to verify the behavior?

The CLI doesn't seem to have any client-side validation for options that I can see. Thesurvey lib which powers the options selector exposes aWithValidator hook which we could implement?

, but we agreed to defer this until#7099 is implemented which would centralise all the logic.

Since validation might work well on the CLI, I'm wondering if it isn't a low hanging fruit to come up with a temporary fix for the frontend. I'm unsure how frontend deals with monotonicity right now.

Frontend validation can work but it's not possible to display the error inline with theRadioGroup component according to@BrunoQuaresma.

mtojek reacted with thumbs up emoji

Signed-off-by: Danny Kopping <danny@coder.com>
@mtojek
Copy link
Member

The CLI doesn't seem to have any client-side validation for options that I can see. The survey lib which powers the options selector exposes a WithValidator hook which we could implement?

AFAIR There were some problems with testingselect input assurvey always picked the first item on the list, hence no tests were implemented.

Anyway, if CLI and UI depend on backend validation here, then user will be warned about value conflict. If you want to try, you can modifycli/update_test.go to address themonotonicity use case, but I'm also cool if it is hard/impossible to do 👍

@dannykopping
Copy link
ContributorAuthor

cli/update_test.go

Will do, thanks!

@dannykopping
Copy link
ContributorAuthor

cli/update_test.go

Will do, thanks!

@mtojek I added a test inaae5463, PTAL?

I also updated the provider now thatcoder/terraform-provider-coder#202 is merged.

Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

One nit pick to clarify (restart or update) but otherwise it is 👍 .

Signed-off-by: Danny Kopping <danny@coder.com>
@dannykoppingdannykoppingenabled auto-merge (squash)March 27, 2024 08:34
@dannykoppingdannykopping merged commita74ef40 intocoder:mainMar 27, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 27, 2024
@dannykoppingdannykopping deleted the dk/monotonic branchMarch 27, 2024 08:59
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mtojekmtojekmtojek approved these changes

Assignees

@dannykoppingdannykopping

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

coder_parameter doesn't support monotonic for option values
2 participants
@dannykopping@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp