-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 initial JoinTokens UI #43766
Add initial JoinTokens UI #43766
Conversation
lib/web/join_tokens_test.go
Outdated
}) | ||
} | ||
} | ||
|
||
func filterContentField(tokens []ui.JoinToken) []ui.JoinToken { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this method to avoid adding a bunch to the tests just to get the yaml content correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would using cmpopts.IgnoreFields
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the backend perspective.
lib/web/apiserver.go
Outdated
@@ -769,6 +769,7 @@ func (h *Handler) bindDefaultEndpoints() { | |||
h.GET("/webapi/auth/export", h.authExportPublic) | |||
|
|||
// join token handlers | |||
h.POST("/webapi/token/yaml", h.WithAuth(h.upsertTokenContent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is an upsert, would PUT be more accurate method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right. I'll update
}); | ||
}, | ||
|
||
// TODO (avatus) add abort signal to this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added this TODO because adding the abort signal to our put
method here would change a LOT of spots and I don't want it to muddy up this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make it optional
isStatic, | ||
safeName, | ||
method, | ||
roles: roles?.sort() || [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these strings? I think we should sort by a.localeCompare(b)
<Text bold as="span"> | ||
{` ${token.safeName}`} | ||
</Text> | ||
. This will not remove any resource that used this join token to join |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "resources"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should reword "join token to join" too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think this copy should change quite a bit. I'm not sure it's 100% accurate anymore because it also depends on token type (I believe this is only true with join method type token)
I'll revisit this entire blurb
<Cell align="right"> | ||
<HoverTooltip | ||
justifyContentProps={{ justifyContent: 'end' }} | ||
tipContent="You cannot configure or delete static tokens via the web UI. Static tokens should be removed from your Teleport configuration file." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should change this to say "You can only configure or delete static tokens through tctl`, that way we convey they same thing but give the user the info they need to continue on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static tokens are in the actual teleport yaml config and not via tctl. They can only be removed by removing from the file. Also, this was the copy suggested during ux meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I had no idea where they were managed - fair enough
open={true} | ||
> | ||
<DialogHeader> | ||
<DialogTitle>Delete Join Token?</DialogTitle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a common UI trend to get the user to type "delete" or "delete me" to confirm they want to delete something. Should we use that here? cc @roraback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted with kenny and we decided not to implement this. Great idea tho, thank you
8c90fde
to
27c2171
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some minor stuff but otherwise lgtm.
another thing to think about is, if mfa authn failed, it shows a blank page, can we somehow propagate the error and render an error?
lib/web/join_tokens_test.go
Outdated
}) | ||
} | ||
} | ||
|
||
func filterContentField(tokens []ui.JoinToken) []ui.JoinToken { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would using cmpopts.IgnoreFields
work?
|
||
initialize(); | ||
|
||
export const Loaded = () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a failed story?
{deleteTokenAttempt.status === 'error' && ( | ||
<Alert kind="danger">{deleteTokenAttempt.statusText}</Alert> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the other failure modes? like fetching and upserting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thnks, i forgot to add alerts for those!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the alert for fetching, but the error for upserting is shown in the yaml editor. i will update this when we add the forms
This PR is part of the new join tokens feature. This will make the join tokens UI available on /web/tokens but not enable it in the navigation. You will have to manually view it. We will add it to the navigation just before the backport to the release branch. I did it this way so we can start PRing the larger chunks while we work on the "create token" forms. So obviously, the "create token" button doesn't exist on here. this is for viewing/editting for now.
This PR is part of the new join tokens feature. This will make the join tokens UI available on /web/tokens but not enable it in the navigation. You will have to manually view it. We will add it to the navigation just before the backport to the release branch. I did it this way so we can start PRing the larger chunks while we work on the "create token" forms. So obviously, the "create token" button doesn't exist on here. this PR is for viewing/editting tokens