Fixed display and failing pipeline
This commit is contained in:
parent
b7f953e93d
commit
90d9bc3fcc
8 changed files with 119 additions and 33 deletions
|
@ -114,6 +114,7 @@ export const JobProvider = ({ children }) => {
|
||||||
const jobReq = {
|
const jobReq = {
|
||||||
...request,
|
...request,
|
||||||
pipeline: {
|
pipeline: {
|
||||||
|
...p,
|
||||||
triggers: triggers[t],
|
triggers: triggers[t],
|
||||||
__test: t,
|
__test: t,
|
||||||
},
|
},
|
||||||
|
@ -229,7 +230,6 @@ export const JobProvider = ({ children }) => {
|
||||||
type: "single",
|
type: "single",
|
||||||
name: jobId,
|
name: jobId,
|
||||||
};
|
};
|
||||||
console.log(request);
|
|
||||||
|
|
||||||
jobCreate(job);
|
jobCreate(job);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,13 @@ export default function Navbar(props) {
|
||||||
)}
|
)}
|
||||||
</Badge>,
|
</Badge>,
|
||||||
<NotificationsIcon />,
|
<NotificationsIcon />,
|
||||||
<Badge badgeContent={jobState.jobs.length} color="primary">
|
<Badge
|
||||||
|
badgeContent={
|
||||||
|
jobState.jobs.filter((j) => !j.isPipeline).length +
|
||||||
|
jobState.pipelines.length
|
||||||
|
}
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
<WorkIcon />
|
<WorkIcon />
|
||||||
</Badge>,
|
</Badge>,
|
||||||
<FormatListBulletedIcon />,
|
<FormatListBulletedIcon />,
|
||||||
|
|
|
@ -1,26 +1,49 @@
|
||||||
import React, { useContext } from "react";
|
import React, { useContext } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import JobContext from "../../ctx/JobContext.jsx";
|
import JobContext, { jobStatus } from "../../ctx/JobContext.jsx";
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import AppBar from "@mui/material/AppBar";
|
import AppBar from "@mui/material/AppBar";
|
||||||
import Toolbar from "@mui/material/Toolbar";
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
import IconButton from "@mui/material/IconButton";
|
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
import Accordion from "@mui/material/Accordion";
|
import Accordion from "@mui/material/Accordion";
|
||||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
import AccordionSummary from "@mui/material/AccordionSummary";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||||
|
import IconButton from "@mui/material/IconButton";
|
||||||
|
import CheckIcon from "@mui/icons-material/Check";
|
||||||
|
import ClearIcon from "@mui/icons-material/Clear";
|
||||||
|
import ViewColumnIcon from "@mui/icons-material/ViewColumn";
|
||||||
|
import PendingIcon from "@mui/icons-material/Pending";
|
||||||
|
import VisibilityIcon from "@mui/icons-material/Visibility";
|
||||||
|
import DoNotDisturbIcon from "@mui/icons-material/DoNotDisturb";
|
||||||
|
|
||||||
|
import Menu from "@mui/material/Menu";
|
||||||
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||||
|
import MoreVertIcon from "@mui/icons-material/MoreVert";
|
||||||
|
import DeleteIcon from "@mui/icons-material/Delete";
|
||||||
|
|
||||||
function JobPipelineDisplay(props) {
|
function JobPipelineDisplay(props) {
|
||||||
const { back, pipeline } = props;
|
const { pipeline } = props;
|
||||||
const {
|
const {
|
||||||
state: jobState,
|
state: jobState,
|
||||||
pipelineCancel,
|
pipelineCancel,
|
||||||
pipelineDestroy,
|
pipelineDestroy,
|
||||||
} = useContext(JobContext);
|
} = useContext(JobContext);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||||
|
const open = Boolean(anchorEl);
|
||||||
|
const handleClick = (event) => {
|
||||||
|
setAnchorEl(event.currentTarget);
|
||||||
|
};
|
||||||
|
const handleClose = () => {
|
||||||
|
setAnchorEl(null);
|
||||||
|
};
|
||||||
|
|
||||||
const pipelineJobs = jobState.jobs.filter(
|
const pipelineJobs = jobState.jobs.filter(
|
||||||
(j) => j.isPipeline && j.pipelineId === pipeline.id
|
(j) => j.isPipeline && j.pipelineId === pipeline.id
|
||||||
);
|
);
|
||||||
|
@ -30,8 +53,11 @@ function JobPipelineDisplay(props) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const findJob = (testName) =>
|
||||||
|
pipelineJobs.find((j) => j.branchId === testName);
|
||||||
|
|
||||||
const selectJob = (testName) => () => {
|
const selectJob = (testName) => () => {
|
||||||
const job = pipelineJobs.find((j) => j.branchId === testName);
|
const job = findJob(testName);
|
||||||
if (!job) return;
|
if (!job) return;
|
||||||
navigate(`/qualiteer/jobs#${job.jobId}`);
|
navigate(`/qualiteer/jobs#${job.jobId}`);
|
||||||
};
|
};
|
||||||
|
@ -48,6 +74,38 @@ function JobPipelineDisplay(props) {
|
||||||
pipelineDestroy(pipeline.id);
|
pipelineDestroy(pipeline.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const menuSelect = (cb) => () => {
|
||||||
|
handleClose();
|
||||||
|
cb();
|
||||||
|
};
|
||||||
|
|
||||||
|
function pipelineActive() {
|
||||||
|
return pipelineJobs.find(
|
||||||
|
(j) => j.status === jobStatus.ACTIVE || j.status === jobStatus.PENDING
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function jobIcon(name) {
|
||||||
|
const job = findJob(name);
|
||||||
|
const status = job ? job.status : null;
|
||||||
|
switch (status) {
|
||||||
|
case jobStatus.OK:
|
||||||
|
return <CheckIcon color="success" />;
|
||||||
|
case jobStatus.ERROR:
|
||||||
|
return <ClearIcon color="error" />;
|
||||||
|
case jobStatus.PENDING:
|
||||||
|
return <PendingIcon color="info" />;
|
||||||
|
case jobStatus.ACTIVE:
|
||||||
|
return <VisibilityIcon color="primary" />;
|
||||||
|
case jobStatus.CANCELED:
|
||||||
|
return <DoNotDisturbIcon color="warning" />;
|
||||||
|
case jobStatus.QUEUED:
|
||||||
|
return <ViewColumnIcon color="secondary" />;
|
||||||
|
default:
|
||||||
|
return <ViewColumnIcon color="secondary" />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<AppBar
|
<AppBar
|
||||||
|
@ -67,11 +125,8 @@ function JobPipelineDisplay(props) {
|
||||||
<Typography variant="h6" sx={{ ml: "auto", mr: "auto" }}>
|
<Typography variant="h6" sx={{ ml: "auto", mr: "auto" }}>
|
||||||
{pipeline.id}
|
{pipeline.id}
|
||||||
</Typography>
|
</Typography>
|
||||||
<IconButton onClick={cancelPipeline}>
|
<IconButton onClick={handleClick}>
|
||||||
<ArrowBackIcon />
|
<MoreVertIcon />
|
||||||
</IconButton>
|
|
||||||
<IconButton onClick={deletePipeline}>
|
|
||||||
<ArrowBackIcon />
|
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -101,13 +156,34 @@ function JobPipelineDisplay(props) {
|
||||||
>
|
>
|
||||||
{test}
|
{test}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Stack sx={{ ml: "auto" }}>I</Stack>
|
<Stack sx={{ ml: "auto" }}>
|
||||||
|
<IconButton aria-label="retry" component="span">
|
||||||
|
{jobIcon(test)}
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
</AccordionSummary>
|
</AccordionSummary>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
<Menu anchorEl={anchorEl} open={open} onClose={handleClose}>
|
||||||
|
{pipelineActive() ? (
|
||||||
|
<MenuItem onClick={menuSelect(cancelPipeline)}>
|
||||||
|
<ListItemIcon>
|
||||||
|
<DoNotDisturbIcon fontSize="small" />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText>Cancel</ListItemText>
|
||||||
|
</MenuItem>
|
||||||
|
) : null}
|
||||||
|
<MenuItem onClick={menuSelect(deletePipeline)}>
|
||||||
|
<ListItemIcon>
|
||||||
|
<DeleteIcon fontSize="small" />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText>Delete</ListItemText>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,7 @@ export default function JobView(props) {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>Download Log</ListItemText>
|
<ListItemText>Download Log</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
{!job.isPipeline && (
|
||||||
<MenuItem onClick={menuSelect(retryJob)}>
|
<MenuItem onClick={menuSelect(retryJob)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
{job.status === jobStatus.OK || job.status === jobStatus.ERROR ? (
|
{job.status === jobStatus.OK || job.status === jobStatus.ERROR ? (
|
||||||
|
@ -120,10 +121,10 @@ export default function JobView(props) {
|
||||||
)}
|
)}
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>
|
<ListItemText>
|
||||||
{" "}
|
|
||||||
{job.status === jobStatus.ERROR ? "Retry" : "Duplicate"}
|
{job.status === jobStatus.ERROR ? "Retry" : "Duplicate"}
|
||||||
</ListItemText>
|
</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
)}
|
||||||
{job.status === jobStatus.OK ||
|
{job.status === jobStatus.OK ||
|
||||||
job.status === jobStatus.ERROR ||
|
job.status === jobStatus.ERROR ||
|
||||||
job.status === jobStatus.CANCELED ? null : (
|
job.status === jobStatus.CANCELED ? null : (
|
||||||
|
@ -134,12 +135,14 @@ export default function JobView(props) {
|
||||||
<ListItemText>Cancel</ListItemText>
|
<ListItemText>Cancel</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
|
{!job.isPipeline && (
|
||||||
<MenuItem onClick={menuSelect(deleteJob)}>
|
<MenuItem onClick={menuSelect(deleteJob)}>
|
||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<DeleteIcon fontSize="small" />
|
<DeleteIcon fontSize="small" />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText>Delete</ListItemText>
|
<ListItemText>Delete</ListItemText>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|
|
@ -43,7 +43,6 @@ export default function Jobs() {
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
sx={{ flexFlow: "wrap" }}
|
sx={{ flexFlow: "wrap" }}
|
||||||
>
|
>
|
||||||
{" "}
|
|
||||||
<Typography variant="h5">
|
<Typography variant="h5">
|
||||||
Click the '+' to start a new one!
|
Click the '+' to start a new one!
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
|
@ -31,6 +31,7 @@ const liveIndicator = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const runTests = () => {
|
const runTests = () => {
|
||||||
|
console.log(pipeline);
|
||||||
switch (test) {
|
switch (test) {
|
||||||
case "primary":
|
case "primary":
|
||||||
return primary();
|
return primary();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default function secondaryTest(pipelineData) {
|
export default function secondaryTest(pipelineData) {
|
||||||
console.log("This came from a secondary2 test!");
|
console.log("This came from a secondary2 test!");
|
||||||
|
console.log(pipelineData, "SomeData");
|
||||||
return {
|
return {
|
||||||
status: +(pipelineData !== "SomeData"),
|
status: +(pipelineData !== "SomeData"),
|
||||||
pipelineData: "SomeOtherOtherData",
|
pipelineData: "SomeOtherOtherData",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export default function secondaryTest(pipelineData) {
|
export default function secondaryTest(pipelineData) {
|
||||||
console.log("This came from a tertiary3!");
|
console.log("This came from a tertiary3!");
|
||||||
return { status: +(pipelineData !== "SomeOtherData") };
|
return { status: +(pipelineData !== "SomeOtherOtherData") };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue