Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add database and Windows access sections to the role editor #47992

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

bl-nero
Copy link
Contributor

@bl-nero bl-nero commented Oct 28, 2024

Also, rearrange some of the tests to get rid of large swaths of duplicate data.

To turn on the new UI, go to developer tools -> Application -> Local storage and add a grv_teleport_use_new_role_editor key set to true. This will be lifted once UI is good to be released.

Screenshot 2024-10-28 at 13 26 51

Figma:

@bl-nero bl-nero added the no-changelog Indicates that a PR does not require a changelog entry label Oct 28, 2024
@github-actions github-actions bot requested a review from avatus October 28, 2024 12:44
@github-actions github-actions bot added the ui label Oct 28, 2024
@github-actions github-actions bot requested a review from kiosion October 28, 2024 12:44
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-47992.d3pp5qlev8mo18.amplifyapp.com

Copy link
Contributor

@avatus avatus left a comment

Choose a reason for hiding this comment

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

Awesome!

<FieldSelectCreatable
isMulti
label="Roles"
toolTipContent="List of database roles for automatic user creation"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unsure what this means. Could you explain the automatic user creation to me?

Copy link
Member

Choose a reason for hiding this comment

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

This help message is a bit vague. I found another one in the docs that is more clear IMHO:

Roles the user can access on a database when they authenticate to a database server.

If we spell it out as "Database Roles" instead of just "Roles", I think it'll be more even clear that we're talking about roles in the database sense of that word.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, but even then the description I provided is not that great because it fails to mention that this is relevant only for automatic user provisioning.

I think this field should be clearly marked as optional and also have a link to the docs somewhere.

Copy link
Contributor Author

@bl-nero bl-nero Nov 18, 2024

Choose a reason for hiding this comment

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

I'll explain as much as I can, but we'll need to rethink linking to docs here, as these tooltips are sticky, and therefore not clickable. Also we still don't have clear conclusion about unified presentation of links in our app. @rishibarbhaya-design, that's some food for thought.

Comment on lines 700 to 701
label="Users"
toolTipContent="List of database users that this role is allowed to connect as"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would "Database Users" make more sense here, or make it less ambiguous at least? If UX explicitly said use "Users" instead of "Database Users", ignore this comment.

Comment on lines +704 to +706
components={{
DropdownIndicator: null,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL! Love it

@bl-nero bl-nero requested a review from ravicious November 13, 2024 16:45
@ravicious
Copy link
Member

I'll take a look tomorrow, I'm a bit swamped with PR reviews.

Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

Looks very good! I added a bunch of UX issues/suggestions that can be addressed outside of this PR.

setLabels={labels => onChange?.({ ...value, labels })}
/>
</Box>
<FieldSelectCreatable
Copy link
Member

Choose a reason for hiding this comment

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

Is any of these three fields ever supposed to show suggestions?

When I click on the input and it says "No options", it feels like something is broken. If we never intend to show suggestions here, perhaps we could not show that "No options" message?

no-options

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. I'll disable these, just as we disable them in the user invitation dialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ravicious Well, I thought it's an one-liner, but no. The existing UI that does it better way actually reimplements a part of the internal React Select logic; basically takes over the responsibility of creating items. Since this is not a reusable component, I'd rather first discuss what we would like the interaction to look with the UX team and then apply it consistently to other places (yes, we do the same thing in other places).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Plot twist! I found out about openMenuOnClick, I'll use that. It was a one-liner, after all. Well, almost.

</Box>
<FieldSelectCreatable
isMulti
label="Names"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if I should direct this feedback to you or the design team, but I'd prepend "Database" to the labels of all three fields. Teleport and its configuration and roles involved a lot of different names, roles and users. If it's not explicitly spelled out, it's hard to know what kind of names I'm supposed to put here without hovering over the info icon.

Or perhaps alternatively we could not prepend "Database" but just spell out the text of the info icon within the form, without requiring the user to hover over it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change to "database names", "database users', and "database roles"./

<FieldSelectCreatable
isMulti
label="Roles"
toolTipContent="List of database roles for automatic user creation"
Copy link
Member

Choose a reason for hiding this comment

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

This help message is a bit vague. I found another one in the docs that is more clear IMHO:

Roles the user can access on a database when they authenticate to a database server.

If we spell it out as "Database Roles" instead of just "Roles", I think it'll be more even clear that we're talking about roles in the database sense of that word.

<FieldSelectCreatable
isMulti
label="Roles"
toolTipContent="List of database roles for automatic user creation"
Copy link
Member

Choose a reason for hiding this comment

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

Oh, but even then the description I provided is not that great because it fails to mention that this is relevant only for automatic user provisioning.

I think this field should be clearly marked as optional and also have a link to the docs somewhere.

/>
<FieldSelectCreatable
isMulti
label="Users"
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if this is something we deliberately decided or not, but from the time I spent playing with our db access, it seems to me that the order of the fields should be database names, database users and then database roles. You might want to confirm it with the db team or someone who has actually set up db access in a production cluster.

DB names and users are something you have to set up to use DB access. Roles are optional and are only relevant for auto user provisioning. DB users also directly impacts what you later see in the dropdown in Connect when you're about to connect to a database. I think it's a good reason for those fields to be above db roles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, switching to names -> users -> roles.

@@ -636,6 +654,97 @@ export function AppAccessSpecSection({
);
}

export function DatabaseAccessSpecSection({
Copy link
Member

Choose a reason for hiding this comment

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

It's not a blocker for the initial release, but long-term I think the role editor should guide you wrt the wildcard value and somehow tell you which fields accept it as a value. It's important part of label matching and the current UI doesn't focus on that.

I know there are also some fields where you can use wildcard as a pattern-matching tool (e.g., dev-*), but idk off the top of my head which fields support that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, definitely. The UX team didn't give us any directions here, but I'll have to discuss it with them. In one of my previous PRs, I added an explanation of the wildcard to the help test in the Kubernetes resource view; I'll look into whether these fields also support wildcards and document it if I find anything.

@bl-nero
Copy link
Contributor Author

bl-nero commented Nov 18, 2024

@ravicious @avatus PTAL at the last commit; if no comments, I'll merge it tomorrow.

Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

Looking good, I found one minor issue.

label="Database Names"
toolTipContent={
<>
List of database names that this role is allowed to connect to.
Copy link
Member

Choose a reason for hiding this comment

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

For some reason the dot at the end of this line is not visible in the tooltip for me.
no-dot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, that's a copy&paste blunder. Thanks for spotting. :)

@bl-nero bl-nero enabled auto-merge November 19, 2024 13:30
@bl-nero bl-nero added this pull request to the merge queue Nov 19, 2024
Merged via the queue into master with commit c1c7ce3 Nov 19, 2024
40 checks passed
@bl-nero bl-nero deleted the bl-nero/role-editor-6 branch November 19, 2024 13:47
bl-nero added a commit that referenced this pull request Nov 19, 2024
* Add database and Windows access sections to the role editor

* review

* Fix ta typo
github-merge-queue bot pushed a commit that referenced this pull request Nov 20, 2024
…49211)

* Add database and Windows access sections to the role editor

* review

* Fix ta typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/md ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants