Job navigation rewrite
This commit is contained in:
parent
aced10d083
commit
4097c121e3
10 changed files with 242 additions and 67 deletions
|
@ -1,8 +1,8 @@
|
|||
import { useState, useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useCurrentlyFailing, useSilencedAlerts } from "@qltr/queries";
|
||||
import StoreContext from "@qltr/store";
|
||||
import JobContext from "@qltr/jobs";
|
||||
import { useJobNav } from "@qltr/util/JobTools";
|
||||
import SilenceDialog from "../alerting/SilenceDialog.jsx";
|
||||
import FailingBox from "./FailingBox.jsx";
|
||||
|
||||
|
@ -20,10 +20,10 @@ import Typography from "@mui/material/Typography";
|
|||
|
||||
export default function Failing() {
|
||||
const { state: jobState, retryAll } = useContext(JobContext);
|
||||
const navigate = useNavigate();
|
||||
const { state: store, silenceRequest } = useContext(StoreContext);
|
||||
const { isLoading, data: failing } = useCurrentlyFailing();
|
||||
const { isSilencedLoading, data: silencedAlerts } = useSilencedAlerts();
|
||||
const jobNav = useJobNav();
|
||||
const [silenceEntry, setSilenceEntry] = useState({ open: false });
|
||||
|
||||
const closeSilence = () => setSilenceEntry({ ...silenceEntry, open: false });
|
||||
|
@ -47,11 +47,11 @@ export default function Failing() {
|
|||
const jobId = retryAll(store.failing);
|
||||
|
||||
if (!store.focusJob) return;
|
||||
navigate(`/qualiteer/jobs#${jobId}`);
|
||||
jobNav.toJob(jobId);
|
||||
};
|
||||
|
||||
const failingTestsWithJobs = () => {
|
||||
if(isLoading) return [];
|
||||
if (isLoading) return [];
|
||||
const silences = silencedAlerts ?? [];
|
||||
for (var test of failing) {
|
||||
const silence = silences.find(
|
||||
|
@ -61,7 +61,7 @@ export default function Failing() {
|
|||
if (silence) test.silencedUntil = silence;
|
||||
if (test.isPipeline) {
|
||||
const pipeline = jobState.pipelines.find((p) =>
|
||||
p.selectedBranches.includes(test.name)
|
||||
p.selectedBranches.find((b) => b.name === test.name)
|
||||
);
|
||||
if (!pipeline) continue;
|
||||
const pipelineJob = jobState.jobs.find(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue