-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: error handling/display for all pages and pipeline load block
Signed-off-by: bbehnke <bradleybehnke@yahoo.com> fix: block pipeline load until ready
- Loading branch information
Showing
25 changed files
with
464 additions
and
602 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { useContext, useCallback } from "react"; | ||
import Box from "@mui/material/Box"; | ||
import { AppContextProps } from "../../../types/declarations/app"; | ||
import { AppContext } from "../../../App"; | ||
import { SidebarType } from "../SlidingSidebar"; | ||
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline"; | ||
import ErrorIcon from "@mui/icons-material/Error"; | ||
|
||
import "./style.css"; | ||
|
||
export function ErrorIndicator() { | ||
const { errors, setSidebarProps } = useContext<AppContextProps>(AppContext); | ||
|
||
const onErrorClick = useCallback(() => { | ||
setSidebarProps({ | ||
type: SidebarType.ERRORS, | ||
slide: false, | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<Box sx={{ float: "right", marginRight: "1rem", cursor: "pointer" }}> | ||
{errors && errors.length ? ( | ||
<ErrorIcon onClick={onErrorClick} sx={{ color: "#D52B1E" }} /> | ||
) : ( | ||
<ErrorOutlineIcon onClick={onErrorClick} sx={{ color: "#6B6C72" }} /> | ||
)} | ||
</Box> | ||
); | ||
} |
Empty file.
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
83 changes: 50 additions & 33 deletions
83
ui/src/components/common/SlidingSidebar/partials/Errors/index.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 |
---|---|---|
@@ -1,54 +1,71 @@ | ||
import React, { useMemo } from "react"; | ||
import React, { useCallback, useContext, useMemo } from "react"; | ||
import Box from "@mui/material/Box"; | ||
import { Slide, ToastContainer } from "react-toastify"; | ||
import Grid from "@mui/material/Grid"; | ||
import Paper from "@mui/material/Paper"; | ||
import Button from "@mui/material/Button"; | ||
import { AppContextProps } from "../../../../../types/declarations/app"; | ||
import { AppContext } from "../../../../../App"; | ||
|
||
import "./style.css"; | ||
|
||
export interface ErrorsProps { | ||
errors: boolean; | ||
} | ||
export function Errors() { | ||
const { errors, clearErrors } = useContext<AppContextProps>(AppContext); | ||
|
||
const handleClear = useCallback(() => { | ||
clearErrors(); | ||
}, [clearErrors]); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export function Errors({ errors }: ErrorsProps) { | ||
const header = useMemo(() => { | ||
const headerContainerStyle = { | ||
const content = useMemo(() => { | ||
const paperStyle = { | ||
display: "flex", | ||
flexDirection: "row", | ||
flexDirection: "column", | ||
padding: "1rem", | ||
}; | ||
const textClass = "vertex-details-header-text"; | ||
|
||
return ( | ||
<Box sx={headerContainerStyle}> | ||
<span className={textClass}>Errors</span> | ||
</Box> | ||
<Grid | ||
container | ||
spacing={2} | ||
sx={{ marginTop: "0.5rem", justifyContent: "center" }} | ||
> | ||
{!errors.length && ( | ||
<Grid item xs={12}> | ||
<Paper elevation={0} sx={paperStyle}> | ||
No errors | ||
</Paper> | ||
</Grid> | ||
)} | ||
{errors.map((error) => ( | ||
<Grid item xs={12}> | ||
<Paper elevation={0} sx={paperStyle}> | ||
<span className="errors-message-text">{error.message}</span> | ||
<span>{error.date.toLocaleTimeString()}</span> | ||
</Paper> | ||
</Grid> | ||
))} | ||
{!!errors.length && ( | ||
<Button | ||
sx={{ marginTop: "1rem" }} | ||
onClick={handleClear} | ||
variant="outlined" | ||
color="primary" | ||
> | ||
Clear | ||
</Button> | ||
)} | ||
</Grid> | ||
); | ||
}, []); | ||
}, [errors]); | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
display: "flex", | ||
flexDirection: "column", | ||
height: "100%", | ||
borderColor: "divider", | ||
}} | ||
> | ||
<Box sx={{ marginTop: "1rem", borderBottom: 1, borderColor: "divider" }}> | ||
{header} | ||
</Box> | ||
<ToastContainer | ||
position="bottom-right" | ||
autoClose={5000} | ||
hideProgressBar={false} | ||
newestOnTop={false} | ||
limit={11} | ||
closeOnClick={false} | ||
rtl={false} | ||
draggable={true} | ||
pauseOnHover={true} | ||
transition={Slide} | ||
theme="light" | ||
/> | ||
<span className="errors-header-text">Errors</span> | ||
{content} | ||
</Box> | ||
); | ||
} |
6 changes: 5 additions & 1 deletion
6
ui/src/components/common/SlidingSidebar/partials/Errors/style.css
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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
.vertex-details-header-text { | ||
.errors-header-text { | ||
font-size: 1.25rem; | ||
font-style: normal; | ||
font-weight: 500; | ||
} | ||
|
||
.errors-message-text { | ||
color: #D52B1E; | ||
} |
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
Oops, something went wrong.