forked from KelvinTegelaar/CIPP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8f7474
commit 464113c
Showing
9 changed files
with
398 additions
and
265 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,125 @@ | ||
import { | ||
Box, | ||
Button, | ||
Container, | ||
Grid, | ||
Typography, | ||
CircularProgress, | ||
Skeleton, | ||
Link, | ||
} from "@mui/material"; | ||
import { Layout as DashboardLayout } from "/src/layouts/index.js"; | ||
import { useForm, useWatch } from "react-hook-form"; | ||
import CippButtonCard from "../../../../components/CippCards/CippButtonCard"; | ||
import { Search } from "@mui/icons-material"; | ||
import CippFormComponent from "../../../../components/CippComponents/CippFormComponent"; | ||
import { ApiGetCall } from "../../../../api/ApiCall"; | ||
|
||
const Page = () => { | ||
const formControl = useForm({ mode: "onBlur" }); | ||
const domain = useWatch({ control: formControl.control, name: "domain" }); | ||
const getGeoIP = ApiGetCall({ | ||
url: "/api/ListExternalTenantInfo", | ||
data: { tenant: domain }, | ||
queryKey: `tenant-${domain}`, | ||
waiting: false, | ||
}); | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
flexGrow: 1, | ||
py: 4, | ||
}} | ||
> | ||
<Container maxWidth={false}> | ||
<Grid container spacing={3}> | ||
<Grid item xs={4}> | ||
<CippButtonCard | ||
title="Tenant lookup" | ||
cardSx={{ display: "flex", flexDirection: "column", height: "100%" }} | ||
> | ||
<Grid container spacing={2}> | ||
<Grid item xs={8}> | ||
<CippFormComponent | ||
formControl={formControl} | ||
name="domain" | ||
type="textField" | ||
placeholder="Domain name" | ||
required | ||
/> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Button | ||
type="submit" | ||
onClick={() => getGeoIP.refetch()} | ||
variant="contained" | ||
startIcon={<Search />} | ||
> | ||
Check | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
</CippButtonCard> | ||
</Grid> | ||
|
||
{/* Results Card */} | ||
{getGeoIP.isFetching ? ( | ||
<Grid item xs={8}> | ||
<CippButtonCard title="Fetching Results"> | ||
<Grid container spacing={2}> | ||
<Grid item xs={12} textAlign="center"> | ||
<Skeleton width={"100%"} /> | ||
</Grid> | ||
</Grid> | ||
</CippButtonCard> | ||
</Grid> | ||
) : getGeoIP.data ? ( | ||
<Grid item xs={8}> | ||
<CippButtonCard title="Geo IP Results"> | ||
<Grid container spacing={2}> | ||
<Grid item xs={6}> | ||
<Typography variant="body1"> | ||
<strong>Tenant Name:</strong> {domain} | ||
</Typography> | ||
<Typography variant="body1"> | ||
<strong>Tenant Id:</strong> {getGeoIP.data?.GraphRequest?.tenantId} | ||
</Typography> | ||
<Typography variant="body1"> | ||
<strong>Default Domain Name:</strong>{" "} | ||
{getGeoIP.data?.GraphRequest?.defaultDomainName} | ||
</Typography> | ||
<Typography variant="body1"> | ||
<strong>Tenant Brand Name :</strong>{" "} | ||
{getGeoIP.data?.GraphRequest?.federationBrandName | ||
? getGeoIP.data?.GraphRequest?.federationBrandName | ||
: "N/A"} | ||
</Typography> | ||
</Grid> | ||
<Grid item xs={6}> | ||
<Typography variant="body1"> | ||
<strong>domains:</strong> | ||
</Typography> | ||
<Typography variant="body1"> | ||
{getGeoIP.data?.Domains?.map((domain) => ( | ||
<li> | ||
<Link href={`https://${domain}`} target="_blank"> | ||
{domain} | ||
</Link> | ||
</li> | ||
))} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
</CippButtonCard> | ||
</Grid> | ||
) : null} | ||
</Grid> | ||
</Container> | ||
</Box> | ||
); | ||
}; | ||
|
||
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>; | ||
|
||
export default Page; |