Skip to content

Conversation

@charliepark
Copy link
Contributor

We are already restricting some of the characters that users can add to the Name field. While working on #2546 I figured that it might be helpful to have this string manipulation available in an external function, so we can restrict what's typed in to the Combobox field. Because we'll want to give users the option of typing a number in as the initial character ("I'm trying to filter for Images with 2024 in them"), the nameSyntax function has an optional second prop. Left off, the default action is to only permit a letter in the zeroth position. If true is passed in to allowNonLetterStart, the user can enter either a number or a dash. Non-allowed characters are dropped.

@charliepark charliepark marked this pull request as ready for review November 13, 2024 18:52
@vercel
Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Nov 13, 2024 11:17pm

Copy link
Collaborator

@david-crespo david-crespo left a comment

Choose a reason for hiding this comment

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

Good idea! I'd rename the function — "syntax" is not the right word for these constraints. A maximally literal option would be constrainNameChars. A more abstract option is normalizeName.

@charliepark charliepark enabled auto-merge (squash) November 13, 2024 23:18
@charliepark charliepark changed the title Set up nameSyntax string utility function Set up normalizeName string utility function Nov 13, 2024
@charliepark charliepark merged commit 6052fdb into main Nov 13, 2024
8 checks passed
@charliepark charliepark deleted the nameSyntax-util branch November 13, 2024 23:27
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Nov 14, 2024
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Nov 14, 2024
oxidecomputer/console@9ef82ba...48fc079

* [48fc079a](oxidecomputer/console@48fc079a)
oxidecomputer/console#2542
* [f3d38103](oxidecomputer/console@f3d38103)
oxidecomputer/console#2545
* [eba6626d](oxidecomputer/console@eba6626d)
bump API for moved system timeseries endpoints
* [6052fdbf](oxidecomputer/console@6052fdbf)
oxidecomputer/console#2549
* [b886e4b8](oxidecomputer/console@b886e4b8)
oxidecomputer/console#2550
* [7303d9d7](oxidecomputer/console@7303d9d7)
oxidecomputer/console#2551
* [e239a8e2](oxidecomputer/console@e239a8e2)
oxidecomputer/console#2540
* [31520a2e](oxidecomputer/console@31520a2e)
move Breadcrumbs component definition into TopBar.tsx
* [ad02edec](oxidecomputer/console@ad02edec)
minor: extract UserMenu component for readability

Co-authored-by: iliana etaoin <iliana@oxide.computer>
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.

3 participants