Linked pipeline autoselect
This commit is contained in:
parent
90d9bc3fcc
commit
f17c7e01f5
9 changed files with 312 additions and 40 deletions
|
@ -1,5 +1,6 @@
|
|||
import React, { useState, useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { usePipelineMappings } from "../../Queries.jsx";
|
||||
import StoreContext from "../../ctx/StoreContext.jsx";
|
||||
import JobContext from "../../ctx/JobContext.jsx";
|
||||
|
||||
|
@ -13,6 +14,12 @@ import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
|||
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import {
|
||||
selectBranch,
|
||||
asTree,
|
||||
asBranches,
|
||||
as1d,
|
||||
} from "../../../lib/jobs/pipelines.js";
|
||||
|
||||
export default function CatalogBox(props) {
|
||||
const { catalogTest } = props;
|
||||
|
@ -21,12 +28,12 @@ export default function CatalogBox(props) {
|
|||
name: testName,
|
||||
class: testClass,
|
||||
repo: testRepo,
|
||||
isCompound,
|
||||
isPipeline,
|
||||
type: testType,
|
||||
} = catalogTest;
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { data: pipelineMappings, isLoading } = usePipelineMappings();
|
||||
const { state: store, updateStore } = useContext(StoreContext);
|
||||
|
||||
const { state: jobState, jobFactory } = useContext(JobContext);
|
||||
|
@ -38,10 +45,24 @@ export default function CatalogBox(props) {
|
|||
const runTest = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log(catalogTest);
|
||||
if (isPipeline) return runPipelineTest();
|
||||
const jobId = jobFactory({ testNames: [testName] });
|
||||
if (store.focusJob) navigate(`/qualiteer/jobs#${jobId}`);
|
||||
};
|
||||
|
||||
const runPipelineTest = () => {
|
||||
const primaries = pipelineMappings.filter((m) => m.includes(testName));
|
||||
const builderCache = {
|
||||
branches: asBranches(primaries),
|
||||
tree: asTree(primaries),
|
||||
selectedBranches: as1d(primaries),
|
||||
isTriage: true,
|
||||
};
|
||||
const pipeline = jobFactory(builderCache);
|
||||
if (store.focusJob) navigate(`/qualiteer/jobs#p${pipeline.id}`);
|
||||
};
|
||||
|
||||
function Actions() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue