Skip to content

Conversation

@charliepark
Copy link
Contributor

Fixes #984

We had a few different strings we were using for the various edit forms. This PR aligns them, by adding a new formType ('create' | 'edit') prop. For edit forms, we have a default button label of "Save changes" (which we were already using in a few places).

This PR also removes an id prop, which we can generate dynamically, allowing us to clean the props up a little.

I'm ambivalent on whether formType should be a required prop, as we're only using it to set the default label on edit forms. We could make it optional and clean up the various create form callsites.

@vercel
Copy link

vercel bot commented Mar 8, 2024

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

Name Status Preview Updated (UTC)
console ✅ Ready (Inspect) Visit Preview Mar 11, 2024 6:40pm

@charliepark charliepark changed the title Make SideModal button copy consistent Make SideModal submit button copy consistent Mar 8, 2024
@david-crespo
Copy link
Collaborator

Ha, @benjaminleonard was way ahead of us on the form type concept:

Just a thought – in order to keep this consistent going forward, is it possible to pass a pane type (e.g. Create / Edit / Delete) to the form, and have it by default set the text. And we could use the same patterns for title + submit text too?

@david-crespo
Copy link
Collaborator

I'm on the fence too, but I think formType should be required so you have to make a decision rather than, for example, accidentally leaving it off on an edit form and getting the create behavior by default.

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.

I like the change — it fixes the inconsistency and reduces choices we have to make at dev time.

It's a small thing, but since we're giving all the edit forms the same button label, I want to make sure we considered all possibilities. The plausible options I can think of are:

Label Comment
Save changes Fine, though something about "changes" bothers me. "Save" makes me think of saving progress for later rather than submitting my update permanently
Save Kinda short, plus same problem as "save" above
Update A little better than "save", I think, but similar
Update [resource] I might like this the best, but it's also the most annoying. We could do it by making the edit form take a resource name prop and have it plug it into both the title with Edit ${resource} and the button label with `Update ${resource}

@charliepark
Copy link
Contributor Author

charliepark commented Mar 8, 2024

I'm on board with the Edit/Update ${resource} option. Adding the resource prop won't be too painful, and I think it'll give the best effect. Will pick that up in the morning.

submitError: ApiError | null
loading?: boolean
title: string
title?: string
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’d add a doc comment here explaining that you only need this when you want to override the default create or edit title. Same with submitLabel I think.

await page.click('role=menuitem[name="Change role"]')

await expectVisible(page, ['role=heading[name*="Change user role"]'])
await expectVisible(page, ['role=heading[name*="Edit role"]'])
Copy link
Collaborator

@david-crespo david-crespo Mar 9, 2024

Choose a reason for hiding this comment

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

“Change user role” is a little more descriptive? I could go either way. If it shows up for editing a group role too it’s misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree that Change is probably more accurate than Edit, as they aren't editing the role, per se. Change permissions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the actions modal we say Change role, so I think that makes sense. Should we determine whether it's a user or group and pass in the appropriate term? Change user role / Change group role

Copy link
Collaborator

Choose a reason for hiding this comment

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

Permissions isn’t a term in the API, so I prefer to avoid it. Really what they’re doing in this case is updating the policy on the resource, and the UI is sort of deliberately obscuring that (uncharacteristically) because it is so much more natural to think about operating on the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hold the phone. There was a TODO in the project-access and silo-access files noting that we should // TODO: show user name in header or SOMEWHERE … this seems like as good a time as any to update that in the modal's title.

Copy link
Collaborator

@david-crespo david-crespo Mar 9, 2024

Choose a reason for hiding this comment

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

Yea, it’s a bit weird but it’s still an improvement. See what it looks like with a 63 character name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though it worked if the name was hypenated, it overran the boundary without hyphens …
Screenshot 2024-03-11 at 10 39 13 AM
… so I added word-break: break-all to the class for that header:
Screenshot 2024-03-11 at 10 50 42 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though …
Screenshot 2024-03-11 at 11 19 18 AM

I have an idea I'll try here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

what about break-words instead of break-all?

Copy link
Contributor Author

@charliepark charliepark Mar 11, 2024

Choose a reason for hiding this comment

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

I tried that, plus wrapping a container in display: inline-block and individual words in both break-words and break-all, but neither worked as desired 100% of the time. I think users will run into more situations with something like Name ofPerson or hyphenated-group-name as opposed to unhyphenatedLongGroupName, so break-words is probably the best solution for now.
Screenshot 2024-03-11 at 11 38 18 AM

@charliepark charliepark merged commit 0469280 into main Mar 11, 2024
@charliepark charliepark deleted the make_sidemodal_button_copy_consistent branch March 11, 2024 19:00
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Mar 21, 2024
oxidecomputer/console@784e8aa...7c96844

* [7c968443](oxidecomputer/console@7c968443) oxidecomputer/console#2083
* [b844a42c](oxidecomputer/console@b844a42c) oxidecomputer/console#2078
* [47835ee3](oxidecomputer/console@47835ee3) oxidecomputer/console#2086
* [c4ddebc2](oxidecomputer/console@c4ddebc2) oxidecomputer/console#2082
* [530a0997](oxidecomputer/console@530a0997) upload-artifact@v4 requires unique filenames for each run in matrix
* [b996c34c](oxidecomputer/console@b996c34c) bump actions/upload-artifact to v4
* [bc51f530](oxidecomputer/console@bc51f530) bump API to latest main
* [743da3b0](oxidecomputer/console@743da3b0) oxidecomputer/console#2080
* [7596d633](oxidecomputer/console@7596d633) oxidecomputer/console#2073
* [65531bff](oxidecomputer/console@65531bff) oxidecomputer/console#2074
* [4d226cd3](oxidecomputer/console@4d226cd3) oxidecomputer/console#1891
* [7490104a](oxidecomputer/console@7490104a) update readme with cool new preview URL
* [a2218994](oxidecomputer/console@a2218994) oxidecomputer/console#2066
* [641ebe85](oxidecomputer/console@641ebe85) oxidecomputer/console#2061
* [1bb8dd3a](oxidecomputer/console@1bb8dd3a) oxidecomputer/console#2055
* [41dd9f06](oxidecomputer/console@41dd9f06) oxidecomputer/console#2059
* [04692802](oxidecomputer/console@04692802) oxidecomputer/console#2048
* [8c30305e](oxidecomputer/console@8c30305e) oxidecomputer/console#2050
* [53709d2a](oxidecomputer/console@53709d2a) oxidecomputer/console#2046
* [84caede7](oxidecomputer/console@84caede7) oxidecomputer/console#2026
* [bca9f42a](oxidecomputer/console@bca9f42a) oxidecomputer/console#2045
* [09e5f713](oxidecomputer/console@09e5f713) oxidecomputer/console#2043
* [d780e5d8](oxidecomputer/console@d780e5d8) fix casing on floating IP attach/detach toasts
david-crespo added a commit to oxidecomputer/omicron that referenced this pull request Mar 21, 2024
oxidecomputer/console@784e8aa...7c96844

* [7c968443](oxidecomputer/console@7c968443)
oxidecomputer/console#2083
* [b844a42c](oxidecomputer/console@b844a42c)
oxidecomputer/console#2078
* [47835ee3](oxidecomputer/console@47835ee3)
oxidecomputer/console#2086
* [c4ddebc2](oxidecomputer/console@c4ddebc2)
oxidecomputer/console#2082
* [530a0997](oxidecomputer/console@530a0997)
upload-artifact@v4 requires unique filenames for each run in matrix
* [b996c34c](oxidecomputer/console@b996c34c)
bump actions/upload-artifact to v4
* [bc51f530](oxidecomputer/console@bc51f530)
bump API to latest main
* [743da3b0](oxidecomputer/console@743da3b0)
oxidecomputer/console#2080
* [7596d633](oxidecomputer/console@7596d633)
oxidecomputer/console#2073
* [65531bff](oxidecomputer/console@65531bff)
oxidecomputer/console#2074
* [4d226cd3](oxidecomputer/console@4d226cd3)
oxidecomputer/console#1891
* [7490104a](oxidecomputer/console@7490104a)
update readme with cool new preview URL
* [a2218994](oxidecomputer/console@a2218994)
oxidecomputer/console#2066
* [641ebe85](oxidecomputer/console@641ebe85)
oxidecomputer/console#2061
* [1bb8dd3a](oxidecomputer/console@1bb8dd3a)
oxidecomputer/console#2055
* [41dd9f06](oxidecomputer/console@41dd9f06)
oxidecomputer/console#2059
* [04692802](oxidecomputer/console@04692802)
oxidecomputer/console#2048
* [8c30305e](oxidecomputer/console@8c30305e)
oxidecomputer/console#2050
* [53709d2a](oxidecomputer/console@53709d2a)
oxidecomputer/console#2046
* [84caede7](oxidecomputer/console@84caede7)
oxidecomputer/console#2026
* [bca9f42a](oxidecomputer/console@bca9f42a)
oxidecomputer/console#2045
* [09e5f713](oxidecomputer/console@09e5f713)
oxidecomputer/console#2043
* [d780e5d8](oxidecomputer/console@d780e5d8)
fix casing on floating IP attach/detach toasts
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.

Make edit submit button text consistent

3 participants