Skip to content

Conversation

@allisonschiang
Copy link
Member

@allisonschiang allisonschiang commented Dec 31, 2025

Demo:

Screen.Recording.2026-01-06.at.2.50.52.PM.mov

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Dec 31, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 2, 2026
huh.NewInput().
Title("Set a module name:").
Description("The module name can contain only alphanumeric characters, dashes, and underscores.").
Description("This can be the name of the piece of hardware, the challenge you are trying to\n"+
Copy link
Member Author

Choose a reason for hiding this comment

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

took wording from ticket but lmk if you want to change the verbage or wording!

Copy link
Member

Choose a reason for hiding this comment

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

pls add a new line before The module name can contain only...

Description("This is the name of the new resource model that your module will provide.\n"+
"The model name can contain only alphanumeric characters, dashes, and underscores.").
Placeholder("my-model").
PlaceholderFunc(func() string {
Copy link
Member Author

@allisonschiang allisonschiang Jan 2, 2026

Choose a reason for hiding this comment

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

the ticket calls to pre-populate text rather than have the background gray placeholder, but the huh package doesn't have the ValueFunc() implemented yet to dynamically change it

I tried:

  • change the module.ModelName value with a validate() function, but its set when the form is created and doesn't change
  • change the module.ModelName value by setting Value to a func() that returns resource type, but its set when the form is created and sets it to the first resource of arm
  • change the module.ModelName with PlaceholderFunc, but it only changes the Placeholder (can't put an extra function in it to edit ModelName)
  • create an Accessor function where you can create your own get() and set() function, but get() runs at form creation time so set to first resource of 'arm'

Didn't think it was worth it to split the form into two (ask resource name first and then prepopulate on another loaded form), switch packages, or make an open source contribution to huh package

@allisonschiang allisonschiang marked this pull request as ready for review January 2, 2026 17:56
@allisonschiang allisonschiang requested review from a team, lia-viam, michaellee1019 and njooma and removed request for a team January 2, 2026 17:57
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 6, 2026
PlaceholderFunc(func() string {
return modelName(module)
}, &module.Resource).
SuggestionsFunc(func() []string {
Copy link
Member Author

Choose a reason for hiding this comment

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

the only suggestion that makes sense to make is the model name we recommend

huh.NewInput().
Title("Set a module name:").
Description("The module name can contain only alphanumeric characters, dashes, and underscores.").
Description("This can be the name of the piece of hardware, the challenge you are trying to\n"+
Copy link
Member

Choose a reason for hiding this comment

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

pls add a new line before The module name can contain only...

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 8, 2026
@allisonschiang allisonschiang merged commit 05fe28b into viamrobotics:main Jan 8, 2026
19 checks passed
@allisonschiang allisonschiang deleted the APP-14418 branch January 8, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants