Revamp Job flow
This commit is contained in:
parent
945afdfbbe
commit
4a0a4b29a5
86 changed files with 592 additions and 608 deletions
|
@ -2,12 +2,7 @@ import React, { useState, useContext } from "react";
|
|||
|
||||
import { usePipelineMappings } from "@qltr/queries";
|
||||
import StoreContext from "@qltr/store";
|
||||
import JobContext, { jobStatus } from "@qltr/jobs";
|
||||
import {
|
||||
useJobIconState,
|
||||
usePipelineIconState,
|
||||
useJobNav,
|
||||
} from "@qltr/util/JobTools";
|
||||
import { useJobCore, jobStatus } from "@qltr/jobcore";
|
||||
|
||||
import useMediaQuery from "@mui/material/useMediaQuery";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
|
@ -39,25 +34,24 @@ export default function CatalogBox(props) {
|
|||
|
||||
const { data: pipelineMappings, isLoading } = usePipelineMappings();
|
||||
const { state: store } = useContext(StoreContext);
|
||||
const { jobFactory } = useContext(JobContext);
|
||||
const jobNav = useJobNav();
|
||||
const { jobCompose, toPipeline, toJob, jobIcon, pipelineIcon } = useJobCore();
|
||||
const [open, setOpen] = useState(false);
|
||||
const toggleOpen = () => setOpen(!open);
|
||||
const theme = useTheme();
|
||||
const minifyActions = useMediaQuery(theme.breakpoints.down("sm"));
|
||||
|
||||
const navigateToJob = () => {
|
||||
if (pipeline) return jobNav.toPipeline(pipeline.id);
|
||||
jobNav.toJob(job.jobId);
|
||||
if (pipeline) return toPipeline(pipeline.id);
|
||||
toJob(job.jobId);
|
||||
};
|
||||
|
||||
const runTest = () => {
|
||||
if (isPipeline) return runPipelineTest();
|
||||
const jobId = jobFactory({
|
||||
const jobId = jobCompose({
|
||||
testNames: [testName],
|
||||
isTriage: store.triageFailing,
|
||||
});
|
||||
if (store.focusJob) jobNav.toJob(jobId);
|
||||
if (store.focusJob) toJob(jobId);
|
||||
};
|
||||
|
||||
const runPipelineTest = () => {
|
||||
|
@ -74,8 +68,8 @@ export default function CatalogBox(props) {
|
|||
selectedBranches: as1d(primaries),
|
||||
isTriage: true,
|
||||
};
|
||||
const pipeline = jobFactory(builderCache);
|
||||
if (store.focusJob) jobNav.toPipeline(pipeline.id);
|
||||
const pipeline = jobCompose(builderCache);
|
||||
if (store.focusJob) toPipeline(pipeline.id);
|
||||
};
|
||||
|
||||
const jobOnClick = (e) => {
|
||||
|
@ -86,10 +80,10 @@ export default function CatalogBox(props) {
|
|||
navigateToJob();
|
||||
};
|
||||
|
||||
function jobIcon() {
|
||||
if (pipeline) return usePipelineIconState(pipeline);
|
||||
function boxIcon() {
|
||||
if (pipeline) return pipelineIcon(pipeline);
|
||||
if (!job) return <PlayArrowIcon />;
|
||||
return useJobIconState(job);
|
||||
return jobIcon(job);
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -130,7 +124,7 @@ export default function CatalogBox(props) {
|
|||
component="span"
|
||||
onClick={jobOnClick}
|
||||
>
|
||||
{jobIcon()}
|
||||
{boxIcon()}
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</AccordionSummary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue