-
Notifications
You must be signed in to change notification settings - Fork 212
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
feat(admin): Create 'Relying Parties' page & display RPs from db #13123
Conversation
ff4120d
to
7ee5a6f
Compare
); | ||
}; | ||
|
||
export default PageRelyingParties; |
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 SVGs shown below are rendering funny in GH because icon-account
has an explicit width/height set on it that matches its viewbox, and icon-key
has a larger viewbox with no explicit width/height. I tried making them more consistent but ran into at least one of them looking funky and didn't think it was worth spending more time on since they look just fine in the UI and it's an internal tool anyway.
@apply font-medium text-violet-900 pl-4 pr-8 text-left; | ||
} | ||
|
||
.result-grey { |
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'm going to file a follow up issue around cleaning up all the lists vs tables we're using as well as padding/margin/text color adjustments (I like this result-grey
), colon vs no colons (or question marks for booleans), and maybe even a helper for displaying our booleans as "Yes" / "No" or true/false if that's what we prefer. Couple other things too like renaming our other pages to begin with Page
to match what we're doing in Settings.
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.
Sounds good! Consistency is always appreciated.
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.
Filed #13164 for this bit
5fd75b4
to
782b1c3
Compare
async onModuleDestroy() { | ||
// This tear down is important for jest tests. Without this | ||
// the tests will hang on completion. | ||
await this.connectedServicesDb.cache.close(); | ||
await this.connectedServicesDb.db.close(); | ||
// await this.mySqlOAuthShared.close(); |
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 was seeing some strange output in CI that I thought was hanging on my RP resolver tests (and they took a while locally) so I wanted to see if this helped even though I didn't think I'd need it since I didn't need knex and I'm mocking the db call with this (which should be a const
that I'll also update). I didn't realize I committed this while commented out, but CI seems happy now, so I'll remove it next time I push an update.
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.
Interesting. ConnectedServicesDb is effectively calling close on mySqlOAuthShared (since it's passed into the constructor and it has a referende to it). I wonder if calling close twice becomes an issue... Anyways removing it seems good to me.
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, it was a "too long without output" error and I just figured this is what it was. I think it was something flaky or something, I've just pushed another update so I'll merge when it passes.
|
||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import * as apollo from '@apollo/client'; |
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.
apollo not used
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.
Good catch, yeah thought I'd need to mock it and didn't need it. I'm looking forward to us using this package, looks like we need new issues filed for it so it's per package, though I'm not sure I care if it's per package personally so I'll bring it up in triage.
</Guard> | ||
<Guard features={[AdminPanelFeature.AccountLogs]}> | ||
export const Nav = () => { | ||
const getNavLinkClassName = (isActive: boolean) => |
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.
Random nit pick. Maybe put this in the outer scope? Seems like adding this function, resulted in a using a 'return' statement, which in turn had a big impact on the the diff.
<Route path="/account-search" element={<AccountSearch />} /> | ||
<> | ||
<Route path="/account-search" element={<AccountSearch />} /> | ||
<Route path="/" element={<Navigate to="/account-search" />} /> |
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.
Nice! This seems like a good idea to me.
@Field() | ||
trusted!: boolean; | ||
|
||
@Field({ nullable: true }) |
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.
In fxa-shared/db/models/auth/relying-party.ts, this value is marked as non nullable. Just double checking there's not a mismatch here.
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.
Another good catch - this is definitely nullable, I'll change it over there.
@@ -79,8 +86,9 @@ export class DatabaseService implements OnModuleDestroy { | |||
this.device = Device; | |||
this.linkedAccounts = LinkedAccount; | |||
|
|||
this.mySqlOAuthShared = mySqlOAuthShared; |
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.
Probably not a thing for this PR, but as I see this evolving, I wonder if we we should have more services broken out. Smaller services are usually more maintainable and modular.
So perhaps we have several supporting services here that can be injected,
- MySqlOAuthSharedService
- ConnectedServicesCacheService
- ConnectedServicesDbService
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 agree. This definitely felt a little less-than-ideal here but okay for now since it was a simple change.
@LZoog, things are looking good to me. I'll do some exploratory testing on Monday and likely r+. |
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! I tested this locally and this is definitely a nice addition. Any feedback I left shouldn't be seen as blocking. If there is any feedback you'd like to turn into separate follow up items, let me know and I can add them to the follow up epic.
<th>Allowed Scopes</th> | ||
<td> | ||
{allowedScopes ? ( | ||
allowedScopes |
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 a nitpick. When I was testing this locally, I noticed that scopes are delimitted by a whitespace, which is kind of hard to read. Mabye we can split on whitespace, and display them as a list?
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.
Because: * We want a single source of truth to view FxA / Subplat relying parties This commit: * Adds a new RP model and resolver, uses a new query to read desired rows from clients table in fxa_oauth database * Displays this data in the UI with a new /relying-parties page * Adds RP guard to existing admin panel guards and to server/client * Contains a Nav account icon update, CSS tweaks
Because:
This commit:
fixes #12781
There's 2-3 follow up issues I'm going to file around our HTML/CSS as well as some consistency displaying stuff, and not having an AppErrorBoundary (not sure if we want errors reported to Sentry). I could probably also file one for Storybook since I haven't even ran that in the admin-panel in a while and haven't (yet) while working on this PR. 😬