-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add auth styling and 'extra actions' menu #3
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
Conversation
plugins/backstage-plugin-coder/src/components/CoderAuthWrapper/CoderAuthInputForm.tsx
Outdated
Show resolved
Hide resolved
Could we add an |
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 my deployment is down I get an infinite loop of requests to /me
, does anyone else see that?
plugins/backstage-plugin-coder/src/components/CoderAuthWrapper/CoderAuthWrapper.tsx
Outdated
Show resolved
Hide resolved
}, | ||
})); | ||
|
||
function CoderAuthCard({ children }: PropsWithChildren<unknown>) { |
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.
The auth card is looking slick!
<div> | ||
<CoderLogo className={styles.coderLogo} /> | ||
<p> | ||
Unable to verify token authenticity. Please check your internet |
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 like this! Having the user choose whether to discard the token or not makes a lot of sense.
@code-asher I do not but I'm testing against |
@Kira-Pilot So, it is a little jarring (especially since some of the visually-hidden labels are a bit on the long side), but it is intentional. It gives you a quick way of scanning which icons do and don't have accessible text associated with them (which is normally impossible to eyeball, since the elements are supposed to be invisible) Unless you mean that just opening the devtools at all does that, in which case, that definitely isn't intentional |
plugins/backstage-plugin-coder/src/components/CoderAuthWrapper/CoderAuthInputForm.tsx
Outdated
Show resolved
Hide resolved
This is what I mean :) |
That's definitely a bug. Off the top of my head, I'm not sure how it's happening – even when the event from the input bubbles up, it should miss the button for opening the menu, but I'll get this fixed |
Looking lovely! It's really coming together! 🚀 |
What I do is edit |
Oh yeahhhh i see that |
@Kira-Pilot Almost all your points of feedback should be addressed. The only one that should be left is the VisuallyHidden toggle. I've always been opening it up with F12, so I didn't realize there were shortcuts involving Alt/Option. Not sure if it'll make it in this PR, but I will see if there might be a better way to customize which key triggers things @code-asher And the last thing from your feedback should be the infinite loop when a deployment's down. Looking at that right now |
One last set of additions I had to add to the PR: the majority of the tests had to be updated to make sure they don't flake out. Turns out, all components that you directly wire up to a Backstage plugin and export through it have a lot more metadata attached to them. And depending on the component or the type of functionality you're exposing, you might need to bring in a whole test app to provide all the dependencies. But it's a toss-up, and components don't always fail consistently Took me a bit of time to track down the issue, but all the test helpers have been updated to use We weren't running into this issue with the previous repo because not all the components were going through this process yet. This is 100% on me for not making sure the exports weren't fully squared away and were going through the plugin |
wrapInTestApp( | ||
<TestApiProvider | ||
apis={[ | ||
[errorApiRef, mockErrorApi], | ||
[scmIntegrationsApiRef, mockSourceControl], | ||
[configApiRef, mockConfigApi], | ||
]} | ||
> | ||
<EntityProvider entity={mockEntity}>{children}</EntityProvider> | ||
</CoderProviderWithMockAuth> | ||
</TestApiProvider> | ||
), | ||
<CoderProviderWithMockAuth | ||
appConfig={mockAppConfig} | ||
queryClient={mockQueryClient} | ||
authStatus={authStatus} | ||
> | ||
<EntityProvider entity={mockEntity}> | ||
<>{children}</> | ||
</EntityProvider> | ||
</CoderProviderWithMockAuth> | ||
</TestApiProvider>, | ||
), |
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.
Code is almost exactly the same – only change is that now it's wrapped inside wrapInTestApp
} | ||
|
||
isRefetchingTokenQuery = true; | ||
await queryClient.refetchQueries({ queryKey: authQueryKey }); |
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.
One important detail: even though refetchQueries
is an async function, it never throws. The promise only indicates when a query is done, even if it's not successful, so there's no need for a try/catch
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.
LGTM! Nice job figuring out the test flakes
Closes #1. First major commit for the new repo.
Screen.Recording.2024-02-20.at.7.35.50.PM.mov
Changes made
RefreshButton
component in favor of anExtraActionsButton
component. Moves the old refresh functionality and the new eject token functionality under that menuCoderAuth
API to compute theinitializing
status more accuratelyNotes
logout
toejectToken
to make it more clear that calling it does not log the user out of the whole Backstage deployment