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 the options panel to role editor #49801

Merged
merged 8 commits into from
Dec 10, 2024
Merged

Add the options panel to role editor #49801

merged 8 commits into from
Dec 10, 2024

Conversation

bl-nero
Copy link
Contributor

@bl-nero bl-nero commented Dec 4, 2024

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-12-04 at 23 29 36

Figma
Story: https://localhost:9002/?path=/story/teleport-roles-role-editor--new-role

Deviations from the design:

  • Clarified field names
  • Used original data format for timeouts to spare myself some headaches.
  • Used radio buttons instead of the toggle, as that component turned out to be unprepared for this kind of layout
  • A YAML marshalling bug rendered one of the options unusable; I disabled it until I can fix that.

Requires #49764
Contributes to #46612

@bl-nero bl-nero added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v17 labels Dec 4, 2024
@flyinghermit
Copy link
Contributor

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

Can you add a story for this UI? will make it easy for reviewers to play around without spinning the dev UI and setting up all the dependencies.

Also tightens some constraints about standard role editor conformance.
@bl-nero bl-nero force-pushed the bl-nero/role-editor-8 branch from 4d4eaa6 to 0bacc2f Compare December 6, 2024 12:22
@bl-nero bl-nero force-pushed the bl-nero/role-editor-9 branch from 7b4bd84 to a1b1c2e Compare December 6, 2024 12:25
@bl-nero
Copy link
Contributor Author

bl-nero commented Dec 6, 2024

@flyinghermit It's already there, just go to https://localhost:9002/?path=/story/teleport-roles-role-editor--new-role and go to the Options panel.

@flyinghermit
Copy link
Contributor

Thanks for the link, that is helpful. Can you also put that link to storybook in your PR description? Its hard to guess otherwise when the PR itself does not touch on the story :)

Copy link
Contributor

@flyinghermit flyinghermit left a comment

Choose a reason for hiding this comment

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

Looks good but please remove the commented code before merging this PR.

Comment on lines 1104 to 1113
<H4
css={`
grid-column: 1/3;
border-top: ${theme.borders[1]}
${theme.colors.interactive.tonal.neutral[0]};
padding-top: ${theme.space[3]}px;
`}
>
SSH
</H4>
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing this H4 grid repeated with only the text values (SSH,Database, Desktop etc) being unique, I think you will gain by programmatically creating each row instead of with hand. Given the scope of our role option, this will likely grow a larger list and I think will be cleaner that way.

desktopClipboard: true,
createDesktopUser: false,
desktopDirectorySharing: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

The SAML IdP option is not included this time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are supporting an arbitrary subset of options for now, so no, it's not included.

Comment on lines 1048 to 1059
<Box
border={1}
borderColor={theme.colors.interactive.tonal.neutral[0]}
borderRadius={3}
p={3}
css={`
display: grid;
grid-template-columns: 1fr 1fr;
align-items: baseline;
row-gap: ${theme.space[3]}px;
`}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a lot of mixing of Styled components, style prop, css attributes, and then standard css in the css prop? Is there a particular reason you used all 4 instead of picking one? I know genreally the css attributes are used for 1 offs or what not, but this seems to be all over the place.

I think the preferred way is a styled component (at least, I've received comments as such), but I don't care which way you do it here as long as its consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, this one. Yes, that was just me being lazy, I forgot to refactor it before submitting.

Comment on lines 1106 to 1110
grid-column: 1/3;
border-top: ${theme.borders[1]}
${theme.colors.interactive.tonal.neutral[0]};
padding-top: ${theme.space[3]}px;
`}
Copy link
Contributor

Choose a reason for hiding this comment

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

This style seems to match the other H4 in the component, lets move it to a single styled component so we don't risk missing style updates if we need to change it

@bl-nero bl-nero requested a review from avatus December 9, 2024 14:43
Base automatically changed from bl-nero/role-editor-8 to master December 9, 2024 18:07
@bl-nero bl-nero enabled auto-merge December 9, 2024 19:11
@bl-nero bl-nero added this pull request to the merge queue Dec 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 9, 2024
@bl-nero bl-nero added this pull request to the merge queue Dec 10, 2024
Merged via the queue into master with commit 7252e1c Dec 10, 2024
40 checks passed
@bl-nero bl-nero deleted the bl-nero/role-editor-9 branch December 10, 2024 09:57
@public-teleport-github-review-bot

@bl-nero See the table below for backport results.

Branch Result
branch/v17 Failed

bl-nero added a commit that referenced this pull request Dec 10, 2024
* Add admin rule tab to the role editor

Also tightens some constraints about standard role editor conformance.

* Add a way to delete an admin rule

* Add the options panel to role editor

* Review

* Review
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2024
* Add admin rule tab to the role editor

Also tightens some constraints about standard role editor conformance.

* Add a way to delete an admin rule

* Add the options panel to role editor

* Review

* Review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v17 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