diff --git a/ui/src/components/ErrorPage.tsx b/ui/src/components/ErrorPage.tsx index 84787a5f8..77fe07a89 100644 --- a/ui/src/components/ErrorPage.tsx +++ b/ui/src/components/ErrorPage.tsx @@ -1,4 +1,4 @@ -import { ErrorPageData } from "../types"; +import {ErrorPageData, PolicyEvaluationTrace} from "../types"; import SectionFooter from "./SectionFooter"; import Alert from "@mui/material/Alert"; import AlertTitle from "@mui/material/AlertTitle"; @@ -9,11 +9,50 @@ import Stack from "@mui/material/Stack"; import Typography from "@mui/material/Typography"; import React, { FC } from "react"; import Markdown from "markdown-to-jsx"; +import {ListItemProps, TableCell} from "@mui/material"; +import {CheckCircle, MinusCircle, XCircle} from "react-feather"; +import Table from "@mui/material/Table"; +import TableRow from "@mui/material/TableRow"; +import TableHead from "@mui/material/TableHead"; + +type PolicyEvaluationTraceDetailsProps = { + trace: PolicyEvaluationTrace; +} & ListItemProps; +const PolicyEvaluationTraceDetails: FC = ({ + trace, + ...props +}) => { + return ( + + + {trace.deny ? ( + + ) : trace.allow ? ( + + ) : ( + + )} + + + + {trace.explanation || trace.id} + + + + + {trace.deny || !trace.allow ? trace.remediation : ""} + + + + ); +}; export type ErrorPageProps = { data: ErrorPageData; }; export const ErrorPage: FC = ({ data }) => { + const traces = + data?.policyEvaluationTraces?.filter((trace) => !!trace.id) || []; return ( @@ -34,6 +73,22 @@ export const ErrorPage: FC = ({ data }) => { )} + {traces?.length > 0 && ( + + + + + Outcome + Explanation + Remediation + + + {traces.map((trace) => ( + + ))} +
+
+ )} {data?.requestId ? ( diff --git a/ui/src/types/index.ts b/ui/src/types/index.ts index 83c3f4fc7..55c1ee6e0 100644 --- a/ui/src/types/index.ts +++ b/ui/src/types/index.ts @@ -97,6 +97,7 @@ export type ErrorPageData = BasePageData & { status?: number; statusText?: string; errorMessageFirstParagraph?: string; + policyEvaluationTraces?: PolicyEvaluationTrace[]; }; export type UserInfoData = { @@ -140,3 +141,11 @@ export type PageData = | SignOutConfirmPageData | UserInfoPageData | WebAuthnRegistrationPageData; + +export type PolicyEvaluationTrace = { + id?: string; + explanation?: string; + remediation?: string; + allow?: boolean; + deny?: boolean; +};