diff --git a/src/Navbar.jsx b/src/Navbar.jsx
new file mode 100644
index 0000000..8b55628
--- /dev/null
+++ b/src/Navbar.jsx
@@ -0,0 +1,147 @@
+import { useContext, useState } from "react";
+import StoreContext from "./ctx/StoreContext.jsx";
+import JobContext from "./ctx/JobContext.jsx";
+
+import {
+ Routes,
+ Route,
+ Link,
+ BrowserRouter,
+ Navigate,
+ useLocation,
+} from "react-router-dom";
+import AppBar from "@mui/material/AppBar";
+import Badge, { BadgeProps } from "@mui/material/Badge";
+import { styled } from "@mui/material/styles";
+import Box from "@mui/material/Box";
+import Toolbar from "@mui/material/Toolbar";
+import IconButton from "@mui/material/IconButton";
+import Typography from "@mui/material/Typography";
+import MenuIcon from "@mui/icons-material/Menu";
+import Avatar from "@mui/material/Avatar";
+import Drawer from "@mui/material/Drawer";
+import ListItemIcon from "@mui/material/ListItemIcon";
+import ListItemText from "@mui/material/ListItemText";
+import List from "@mui/material/List";
+import ListItemButton from "@mui/material/ListItemButton";
+import NotificationsIcon from "@mui/icons-material/Notifications";
+import WorkIcon from "@mui/icons-material/Work";
+import FormatListBulletedIcon from "@mui/icons-material/FormatListBulleted";
+import SettingsIcon from "@mui/icons-material/Settings";
+import WarningIcon from "@mui/icons-material/Warning";
+import InfoIcon from "@mui/icons-material/Info";
+// Import Pages
+import Failing from "./views/Failing.jsx";
+import Alerting from "./views/Alerting.jsx";
+import Jobs from "./views/Jobs.jsx";
+import Catalog from "./views/Catalog.jsx";
+import Settings from "./views/Settings.jsx";
+import About from "./views/About.jsx";
+
+const drawerWidth = 240;
+
+export default function Navbar(props) {
+ const { state: jobState } = useContext(JobContext);
+ const { state: store } = useContext(StoreContext);
+ const { inModal } = props;
+ const pages = store.pages;
+ const icons = [
+
+
+ ,
+ ,
+
+
+ ,
+ ,
+ ,
+ ,
+ ];
+
+ const location = useLocation();
+ const [drawerOpen, setDrawer] = useState(false);
+
+ const toggleDrawer = () => setDrawer(!drawerOpen);
+ const closeDrawer = () => setDrawer(false);
+
+ const reloadPage = () => window.location.reload(false);
+
+ const SideBadge = styled(Badge)(({ theme }) => ({
+ "& .MuiBadge-badge": {
+ right: -6,
+ top: 10,
+ padding: "0 4px",
+ },
+ }));
+
+ const navHeader = () => {
+ const pathStr =
+ location.pathname.charAt(1).toUpperCase() + location.pathname.slice(2);
+ if (location.pathname !== "/failing") return pathStr;
+ return (
+
+ {pathStr}
+
+ );
+ };
+
+ const drawerIndex = (isDrawer) => (theme) =>
+ theme.zIndex.modal + 2 - (isDrawer ? 1 : 0);
+
+ return (
+
+
+
+
+
+
+
+
+
+
+ {pages.map((text, index) => (
+
+ {icons[index]}
+
+
+ ))}
+
+
+
+
+ {navHeader()}
+
+
+
+
+
+ );
+}
diff --git a/src/Views.jsx b/src/Views.jsx
index 1325909..5f2fe54 100644
--- a/src/Views.jsx
+++ b/src/Views.jsx
@@ -1,6 +1,7 @@
import { useContext, useState } from "react";
import StoreContext from "./ctx/StoreContext.jsx";
import JobContext from "./ctx/JobContext.jsx";
+import Navbar from "./Navbar.jsx";
import {
Routes,
@@ -44,106 +45,9 @@ export default function Views() {
const { state: jobState } = useContext(JobContext);
const { state: store } = useContext(StoreContext);
- const pages = ["failing", "alerting", "jobs", "catalog", "settings", "about"];
- const icons = [
-
-
- ,
- ,
-
-
- ,
- ,
- ,
- ,
- ];
-
- const location = useLocation();
- const [drawerOpen, setDrawer] = useState(false);
-
- const toggleDrawer = () => setDrawer(!drawerOpen);
- const closeDrawer = () => setDrawer(false);
-
- const reloadPage = () => window.location.reload(false);
-
- const SideBadge = styled(Badge)(({ theme }) => ({
- "& .MuiBadge-badge": {
- right: -6,
- top: 10,
- padding: "0 4px",
- },
- }));
-
- const navHeader = () => {
- const pathStr =
- location.pathname.charAt(1).toUpperCase() + location.pathname.slice(2);
- if (location.pathname !== "/failing") return pathStr;
- return (
-
- {pathStr}
-
- );
- };
-
return (
-
theme.zIndex.drawer + 1 }}
- >
-
-
-
-
-
-
-
-
-
- {pages.map((text, index) => (
-
- {icons[index]}
-
-
- ))}
-
-
-
-
- {navHeader()}
-
-
-
-
-
+
@@ -153,7 +57,7 @@ export default function Views() {
} />
} />
} />
- } />
+ } />
} />
diff --git a/src/ctx/JobContext.jsx b/src/ctx/JobContext.jsx
index aa3be32..0631b08 100644
--- a/src/ctx/JobContext.jsx
+++ b/src/ctx/JobContext.jsx
@@ -100,8 +100,13 @@ export const JobProvider = ({ children }) => {
});
}
- function jobBuilder() {
- mockRun();
+ function jobBuilder(tests) {
+ if (!Array.isArray(tests)) throw Error("Error from within JobContext.jsx");
+ console.log("Would run tests", tests);
+ }
+
+ function retrySingle(test) {
+ console.log("Would retry test", test);
}
const context = {
@@ -111,6 +116,8 @@ export const JobProvider = ({ children }) => {
jobCreate,
jobDelete,
retryAll,
+ retrySingle,
+ jobBuilder,
activeJobStates,
};
const contextValue = useMemo(() => context, [state, dispatch]);
diff --git a/src/ctx/StoreContext.jsx b/src/ctx/StoreContext.jsx
index 87725dc..c1e921c 100644
--- a/src/ctx/StoreContext.jsx
+++ b/src/ctx/StoreContext.jsx
@@ -23,16 +23,16 @@ const catalogMock = new Array(10).fill(0).map((v, i) => ({
type: i % 3 ? "api" : "ui",
}));
-const failingMock = new Array(10).fill(0).map((v, i) => ({
+const failingMock = new Array(12).fill(0).map((v, i) => ({
class: `SomeTestClass${i % 2 ? i - 1 : i / 2}`,
name: `TestThatDoesOneThing${i + 1}`,
- timestamp: `2022-05-10T16:${2 + i}:33.810Z`,
+ timestamp: `2022-05-10T16:0${i < 10 ? i : i - 10}:33.810Z`,
method: `SomeMethod`,
- silencedUntil: i % 4 ? null : `2022-05-10T16:${2 + i}:33.810Z`,
+ silencedUntil: i % 4 ? null : `2022-05-10T16:0${i}:33.810Z`,
frequency: "1hour",
type: i % 3 ? "api" : "ui",
dailyFails: i + 1,
- screenshot: "https://example.com",
+ screenshot: "https://picsum.photos/1920/1080",
recentResults: [1, 0, 0, 1, 0],
isCompound: i % 5 ? false : true,
failedMessage: `Some Test FailureMessage ${i}`,
@@ -57,6 +57,7 @@ const failingMock = new Array(10).fill(0).map((v, i) => ({
}));
const initialState = {
+ pages: ["failing", "alerting", "jobs", "catalog", "settings", "about"],
intervals: [],
catalog: catalogMock,
failing: failingMock,
@@ -85,14 +86,28 @@ export const StoreProvider = ({ children }) => {
const [state, dispatch] = useReducer(reducer, initialState);
function silenceRequest(silenceInfo) {
- const req = {name: silenceInfo.name ?? "*", class: silenceInfo.class ?? "*", method: silenceInfo.method ?? "*", silencedUntil: silenceInfo.silencedUntil };
+ const req = {
+ name: silenceInfo.name ?? "*",
+ class: silenceInfo.class ?? "*",
+ method: silenceInfo.method ?? "*",
+ silencedUntil: silenceInfo.silencedUntil,
+ };
console.log("Would upsert silence", req);
}
+ function removeFailure(failure) {
+ const req = {
+ name: failure.name,
+ class: failure.class,
+ };
+ console.log("Would remove failure", req);
+ }
+
const context = {
state,
dispatch,
silenceRequest,
+ removeFailure,
updateStore: (store) => dispatch({ type: ACTIONS.UPDATE, store }),
};
const contextValue = useMemo(() => context, [state, dispatch]);
diff --git a/src/views/Failing.jsx b/src/views/Failing.jsx
index 04359ec..3c299e3 100644
--- a/src/views/Failing.jsx
+++ b/src/views/Failing.jsx
@@ -42,13 +42,6 @@ export default function Failing() {
setSilenceEntry({ ...silence, open: true });
};
- /* TODO
-for(var j of activeJobStates()){
-const failingTest = failing.find((f)=>f.name===j.testName);
- if(!failingTest) continue;
- failingTest.jobStatus= j.status;
- }*/
-
const [retryAllOpen, setRetryAllOpen] = useState(false);
const retryAllClick = () => setRetryAllOpen(!retryAllOpen);
diff --git a/src/views/Jobs.jsx b/src/views/Jobs.jsx
index dab3953..cffd3b6 100644
--- a/src/views/Jobs.jsx
+++ b/src/views/Jobs.jsx
@@ -8,7 +8,7 @@ import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
import DialogContent from "@mui/material/DialogContent";
-
+import Toolbar from "@mui/material/Toolbar";
import DialogTitle from "@mui/material/DialogTitle";
import ClickAwayListener from "@mui/material/ClickAwayListener";
@@ -24,8 +24,7 @@ export default function Jobs() {
const {
state: jobState,
dispatch: jobDispatch,
- jobUpdate,
- jobCreate,
+ jobBuilder,
} = useContext(JobContext);
const { state: store, updateStore } = useContext(StoreContext);
@@ -37,21 +36,25 @@ export default function Jobs() {
{ name: "Compound", icon:
},
{ name: "Manual", icon:
},
];
-
+
const quickOpenClick = (e) => {
e.preventDefault();
e.stopPropagation();
- if(!store.simplifiedControls) return setQuickOpen(!quickOpen);
+ if (!store.simplifiedControls) return setQuickOpen(!quickOpen);
setJobDialogOpen(true);
- }
+ };
const quickOpenClose = () => setQuickOpen(false);
-
const handleClickOpen = () => setJobDialogOpen(true);
- const handleClose = () => setJobDialogOpen(false);
+
const [queued, setQueued] = useState([]);
- useEffect(() => {
- }, [jobState.jobs]);
+ useEffect(() => {}, [jobState.jobs]);
+
+ const handleClose = (confirmed) => () => {
+ setJobDialogOpen(false);
+ if (!confirmed) return;
+ jobBuilder(queued);
+ };
return (
@@ -59,15 +62,20 @@ export default function Jobs() {
))}
-