-
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.
NickAkhmetov/CAT-751 Prevent full-page errors from malformed provenan…
…ce data (#3560)
- Loading branch information
1 parent
c4bb547
commit 60d5a49
Showing
4 changed files
with
30 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Prevent malformed provenance graph data from crashing the entire page. |
24 changes: 24 additions & 0 deletions
24
context/app/static/js/components/detailPage/provenance/ProvGraph/ProvGraphErrorBoundary.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,24 @@ | ||
import { FaroErrorBoundary } from '@grafana/faro-react'; | ||
import Stack from '@mui/material/Stack'; | ||
import Typography from '@mui/material/Typography'; | ||
import DetailsAccordion from 'js/shared-styles/accordions/DetailsAccordion'; | ||
import React from 'react'; | ||
|
||
interface ErrorBoundaryProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
function ErrorFallback(error: Error) { | ||
return ( | ||
<Stack p={4}> | ||
<Typography variant="subtitle1">An error occurred while attempting to display the provenance graph.</Typography> | ||
<DetailsAccordion summary="Click to expand error details"> | ||
<Typography variant="body2">{error?.message}</Typography> | ||
</DetailsAccordion> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default function ProvGraphErrorBoundary({ children }: ErrorBoundaryProps) { | ||
return <FaroErrorBoundary fallback={ErrorFallback}>{children}</FaroErrorBoundary>; | ||
} |
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