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 initial JoinTokens UI #43766

Merged
merged 1 commit into from
Jul 10, 2024
Merged

Add initial JoinTokens UI #43766

merged 1 commit into from
Jul 10, 2024

Conversation

avatus
Copy link
Contributor

@avatus avatus commented Jul 2, 2024

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
Screenshot 2024-07-02 at 3 30 16 PM

@avatus avatus added the no-changelog Indicates that a PR does not require a changelog entry label Jul 2, 2024
@avatus avatus requested review from ryanclark, kimlisa and rudream July 2, 2024 20:32
@github-actions github-actions bot requested review from gzdunek and ravicious July 2, 2024 20:33
@avatus avatus removed request for ravicious and gzdunek July 2, 2024 21:03
})
}
}

func filterContentField(tokens []ui.JoinToken) []ui.JoinToken {
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 added this method to avoid adding a bunch to the tests just to get the yaml content correct

Copy link
Contributor

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?

Copy link
Contributor

@strideynet strideynet 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 from the backend perspective.

@@ -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))
Copy link
Contributor

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?

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 you're right. I'll update

});
},

// TODO (avatus) add abort signal to this
Copy link
Contributor Author

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

Copy link
Contributor

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() || [],
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be "resources"?

Copy link
Contributor

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

Copy link
Contributor Author

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."
Copy link
Contributor

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

Copy link
Contributor Author

@avatus avatus Jul 4, 2024

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

Copy link
Contributor

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>
Copy link
Contributor

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

Copy link
Contributor Author

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

@avatus avatus requested a review from ryanclark July 8, 2024 17:05
@avatus avatus force-pushed the avatus/join branch 2 times, most recently from 8c90fde to 27c2171 Compare July 9, 2024 17:31
Copy link
Contributor

@kimlisa kimlisa left a 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?

})
}
}

func filterContentField(tokens []ui.JoinToken) []ui.JoinToken {
Copy link
Contributor

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 = () => (
Copy link
Contributor

Choose a reason for hiding this comment

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

add a failed story?

Comment on lines +137 to +142
{deleteTokenAttempt.status === 'error' && (
<Alert kind="danger">{deleteTokenAttempt.statusText}</Alert>
)}
Copy link
Contributor

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

Copy link
Contributor Author

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!

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 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.
@avatus avatus added this pull request to the merge queue Jul 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2024
@avatus avatus added this pull request to the merge queue Jul 10, 2024
Merged via the queue into master with commit d47bc96 Jul 10, 2024
42 checks passed
@avatus avatus deleted the avatus/join branch July 10, 2024 04:42
@avatus avatus mentioned this pull request Jul 26, 2024
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/lg ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants