-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nicholas Bucher <behappy54321@gmail.com>
- Loading branch information
1 parent
17104cc
commit 4719e6e
Showing
8 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 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
20 changes: 20 additions & 0 deletions
20
projects/ui/src/Components/Apps/AppMetadata/AppMetadataDisplay.tsx
This file contains 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,20 @@ | ||
import { Box, Text } from "@mantine/core"; | ||
import { App } from "../../../Apis/api-types"; | ||
import { colors } from "../../../Styles"; | ||
import { borderRadiusConstants } from "../../../Styles/constants"; | ||
|
||
const AppMetadataDisplay = ({ app }: { app: App }) => { | ||
return ( | ||
<Box | ||
sx={{ | ||
border: "1px solid " + colors.splashBlue, | ||
borderRadius: borderRadiusConstants.small, | ||
}} | ||
p="20px" | ||
> | ||
<Text size="md">Metadata for {app.name}</Text> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default AppMetadataDisplay; |
This file contains 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 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 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 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,33 @@ | ||
import { useEffect, useRef } from "react"; | ||
import { useCreateUserMutation, useGetCurrentUser } from "../Apis/gg_hooks"; | ||
|
||
const UserChecker = () => { | ||
// For Gloo Gateway: | ||
// If the user is logged into the IDP, but the portal server doesn't return data for it, | ||
// then the user will need to be created. | ||
const { error, mutate } = useGetCurrentUser(); | ||
const { trigger: createUser } = useCreateUserMutation(); | ||
const triedToCreateUser = useRef(false); | ||
|
||
useEffect(() => { | ||
if ( | ||
// This error occurs when the user has logged in through their IDP, | ||
// but does not exist in the portal server DB. | ||
error?.message === | ||
"logged in user is not found, this should not happen" && | ||
!triedToCreateUser.current | ||
) { | ||
setTimeout(async () => { | ||
// We can then create the current user. | ||
await createUser(); | ||
// and then refetch their user information. | ||
mutate(); | ||
}, 0); | ||
triedToCreateUser.current = true; | ||
} | ||
}, [error, createUser, mutate]); | ||
|
||
return null; | ||
}; | ||
|
||
export default UserChecker; |