-
Notifications
You must be signed in to change notification settings - Fork 558
feat(OIDC): API Access tab with trust relationships UI #8044
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b8cac86
feat(trust-relationships): Add API Access tab with trust relationship…
khvn26 16f4adf
fix(OIDC): Provider selection cards are not keyboard accessible
khvn26 17c95c4
fix(OIDC): Trust relationship role changes ignore API failures
khvn26 38721de
refactor(OIDC): Give each trust relationship component its own folder
khvn26 bf9c703
fix(OIDC): Freeform trust relationship modal ignores role API failures
khvn26 f582d31
fix(OIDC): Trust relationship issuer is hidden behind its provider icon
khvn26 965894c
refactor(OIDC): Use the design system Icon to remove a claim rule
khvn26 4d5913a
refactor(OIDC): Use InputGroup for the GitHub audience field
khvn26 3d1af53
fix(OIDC): Trust relationship form banner renders unreadable error bo…
khvn26 55eb84f
refactor(OIDC): Read trust relationship roles through RTK Query
khvn26 8dfc35a
refactor(OIDC): Use FieldLabel for the claim rules label
khvn26 1671d07
fix(API keys): A failed key fetch disables key creation permanently
khvn26 9033fc6
test(OIDC): Name the pending roles update type
khvn26 f7672e4
fix(OIDC): Detached roles reappear after switching a trust relationsh…
khvn26 09da768
fix(OIDC): Workflow snippet omits the environment for a padded claim …
khvn26 0799c1a
fix(OIDC): Role chips cannot be removed with a keyboard
khvn26 5feae08
fix(OIDC): Editing a GitHub trust relationship drops claim rules it c…
khvn26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| import { Res } from 'common/types/responses' | ||
| import { Req } from 'common/types/requests' | ||
| import { service } from 'common/service' | ||
|
|
||
| export const trustRelationshipService = service | ||
| .enhanceEndpoints({ | ||
| addTagTypes: ['TrustRelationship', 'MasterAPIKeyWithMasterAPIKeyRole'], | ||
| }) | ||
| .injectEndpoints({ | ||
| endpoints: (builder) => ({ | ||
| createTrustRelationship: builder.mutation< | ||
| Res['trustRelationship'], | ||
| Req['createTrustRelationship'] | ||
| >({ | ||
| invalidatesTags: [{ id: 'LIST', type: 'TrustRelationship' }], | ||
| query: (query: Req['createTrustRelationship']) => ({ | ||
| body: query.body, | ||
| method: 'POST', | ||
| url: `organisations/${query.organisation_id}/trust-relationships/`, | ||
| }), | ||
| }), | ||
| deleteTrustRelationship: builder.mutation< | ||
| void, | ||
| Req['deleteTrustRelationship'] | ||
| >({ | ||
| invalidatesTags: [{ id: 'LIST', type: 'TrustRelationship' }], | ||
| query: (query: Req['deleteTrustRelationship']) => ({ | ||
| method: 'DELETE', | ||
| url: `organisations/${query.organisation_id}/trust-relationships/${query.id}/`, | ||
| }), | ||
| }), | ||
| getTrustRelationships: builder.query< | ||
| Res['trustRelationships'], | ||
| Req['getTrustRelationships'] | ||
| >({ | ||
| providesTags: [{ id: 'LIST', type: 'TrustRelationship' }], | ||
| query: (query: Req['getTrustRelationships']) => ({ | ||
| url: `organisations/${query.organisation_id}/trust-relationships/`, | ||
| }), | ||
| }), | ||
| updateTrustRelationship: builder.mutation< | ||
| Res['trustRelationship'], | ||
| Req['updateTrustRelationship'] | ||
| >({ | ||
| // Turning `is_admin` on detaches the backing key's roles server-side, | ||
| // so the cached role list has to go with it. | ||
| invalidatesTags: (res) => [ | ||
| { id: 'LIST', type: 'TrustRelationship' }, | ||
| { id: res?.id, type: 'TrustRelationship' }, | ||
| 'MasterAPIKeyWithMasterAPIKeyRole', | ||
| ], | ||
| query: (query: Req['updateTrustRelationship']) => ({ | ||
| body: query.body, | ||
| method: 'PUT', | ||
| url: `organisations/${query.organisation_id}/trust-relationships/${query.id}/`, | ||
| }), | ||
| }), | ||
| // END OF ENDPOINTS | ||
| }), | ||
| }) | ||
|
|
||
| export async function getTrustRelationships( | ||
| store: any, | ||
| data: Req['getTrustRelationships'], | ||
| options?: Parameters< | ||
| typeof trustRelationshipService.endpoints.getTrustRelationships.initiate | ||
| >[1], | ||
| ) { | ||
| return store.dispatch( | ||
| trustRelationshipService.endpoints.getTrustRelationships.initiate( | ||
| data, | ||
| options, | ||
| ), | ||
| ) | ||
| } | ||
| // END OF FUNCTION_EXPORTS | ||
|
|
||
| export const { | ||
| useCreateTrustRelationshipMutation, | ||
| useDeleteTrustRelationshipMutation, | ||
| useGetTrustRelationshipsQuery, | ||
| useUpdateTrustRelationshipMutation, | ||
| // END OF EXPORTS | ||
| } = trustRelationshipService | ||
|
|
||
| /* Usage examples: | ||
| const { data, isLoading } = useGetTrustRelationshipsQuery({ organisation_id: 2 }) //get hook | ||
| const [createTrustRelationship, { isLoading, data, isSuccess }] = useCreateTrustRelationshipMutation() //create hook | ||
| trustRelationshipService.endpoints.getTrustRelationships.select({organisation_id: 2})(store.getState()) //access data from any function | ||
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
frontend/web/components/pages/organisation-settings/tabs/APIKeysTab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,19 @@ | ||
| import React from 'react' | ||
| import AdminAPIKeys from 'components/AdminAPIKeys' | ||
| import Utils from 'common/utils/utils' | ||
| import TrustRelationships from './trust-relationships' | ||
|
|
||
| type APIKeysTabProps = { | ||
| organisationId: number | ||
| } | ||
|
|
||
| export const APIKeysTab = ({ organisationId }: APIKeysTabProps) => { | ||
| return <AdminAPIKeys organisationId={organisationId} /> | ||
| return ( | ||
| <> | ||
| <AdminAPIKeys organisationId={organisationId} /> | ||
| {Utils.getFlagsmithHasFeature('trust_relationships') && ( | ||
| <TrustRelationships organisationId={organisationId} /> | ||
| )} | ||
| </> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.