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

Refresh resources after dropping an access request #49125

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gzdunek
Copy link
Contributor

@gzdunek gzdunek commented Nov 18, 2024

Closes #42381

As mentioned in the linked issue, we were unable to refresh resources after dropping an access request because ResourcesContext was lower in the component tree, so we simply couldn't access it.
A simple fix for this problem is to move it higher in the tree and add a root cluster URI as an argument to its functions, so we can still refresh resources within a single workspace.

Changelog: Teleport Connect now refreshes the resources view after dropping an access request

const requestResourcesRefresh = useCallback(
() => emitterRef.current.emit('refresh'),
(rootClusterUri: RootClusterUri) =>
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about making the hook accept the rootClusterUri argument? Then the caller doesn't need to remember to pass it to every function that the hook provides.

@ravicious ravicious self-requested a review November 18, 2024 14:01
ctx.clustersService.dropRoles(rootClusterUri, [assumedRequest.id])
);
requestResourcesRefresh(rootClusterUri);
} catch (err) {
ctx.notificationsService.notifyError({
title: 'Could not switch back the role',
Copy link
Contributor

Choose a reason for hiding this comment

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

i know this error text was already present but it seems so weird. I think it'd be better saying something like "Could not drop role" or "Could not switch back to default role" or something. Don't have to change here, just discussing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Access Request doesn't refresh access
3 participants