Live Job Update for failing tests
This commit is contained in:
parent
360ff368e1
commit
204bcbb7c1
3 changed files with 26 additions and 9 deletions
|
@ -11,8 +11,8 @@ const PG_DISABLED = process.env.POSTGRES_DISABLED;
|
||||||
|
|
||||||
const silencedMock = () => {
|
const silencedMock = () => {
|
||||||
return [{
|
return [{
|
||||||
name: `single`,
|
name: `failing`,
|
||||||
class: `single.js`,
|
class: `failing.js`,
|
||||||
method: "FAKEMETHOD",
|
method: "FAKEMETHOD",
|
||||||
id: 0,
|
id: 0,
|
||||||
silencedUntil: new Date().toJSON(),
|
silencedUntil: new Date().toJSON(),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useState, useContext } from "react";
|
import { useState, useContext } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import {useCurrentlyFailing} from "../../Queries.jsx";
|
import {useCurrentlyFailing, useSilencedAlerts} from "../../Queries.jsx";
|
||||||
import StoreContext from "../../ctx/StoreContext.jsx";
|
import StoreContext from "../../ctx/StoreContext.jsx";
|
||||||
import JobContext from "../../ctx/JobContext.jsx";
|
import JobContext from "../../ctx/JobContext.jsx";
|
||||||
import SilenceDialog from "../alerting/SilenceDialog.jsx";
|
import SilenceDialog from "../alerting/SilenceDialog.jsx";
|
||||||
|
@ -29,7 +29,7 @@ export default function Failing() {
|
||||||
silenceRequest,
|
silenceRequest,
|
||||||
} = useContext(StoreContext);
|
} = useContext(StoreContext);
|
||||||
const {isLoading, data: failing} = useCurrentlyFailing();
|
const {isLoading, data: failing} = useCurrentlyFailing();
|
||||||
|
const {isSilencedLoading, data:silencedAlerts} = useSilencedAlerts();
|
||||||
const [silenceEntry, setSilenceEntry] = useState({ open: false });
|
const [silenceEntry, setSilenceEntry] = useState({ open: false });
|
||||||
|
|
||||||
const closeSilence = () => setSilenceEntry({ ...silenceEntry, open: false });
|
const closeSilence = () => setSilenceEntry({ ...silenceEntry, open: false });
|
||||||
|
@ -56,9 +56,22 @@ export default function Failing() {
|
||||||
navigate(`/qualiteer/jobs#${jobId}`);
|
navigate(`/qualiteer/jobs#${jobId}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const failingTestsWithJobs = () => {
|
||||||
|
const silences = silencedAlerts ?? [];
|
||||||
|
for(var test of failing){
|
||||||
|
if(test.isCompound) continue;
|
||||||
|
const job = jobState.jobs.find((j)=>j.builderCache.testNames.includes(test.name))
|
||||||
|
if(job) test.job = job;
|
||||||
|
const silence = silences.find((s)=>s.name === test.name || s.class === test.class)
|
||||||
|
|
||||||
|
if(silence) test.silencedUntil = silence;
|
||||||
|
}
|
||||||
|
return failing;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="failing">
|
<div className="failing">
|
||||||
{isLoading? null :failing.map((v, i) => (
|
{isLoading? null :failingTestsWithJobs().map((v, i) => (
|
||||||
<FailingBox key={i} failingTest={v} silenceClick={editSilence(v)} />
|
<FailingBox key={i} failingTest={v} silenceClick={editSilence(v)} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
@ -97,6 +110,7 @@ export default function Failing() {
|
||||||
|
|
||||||
|
|
||||||
): null}
|
): null}
|
||||||
|
|
||||||
{(failing ?? []).length ===0? null :(
|
{(failing ?? []).length ===0? null :(
|
||||||
<SpeedDial
|
<SpeedDial
|
||||||
ariaLabel="Retry All"
|
ariaLabel="Retry All"
|
||||||
|
|
|
@ -48,11 +48,12 @@ export default function FailingBox(props) {
|
||||||
failedMessage,
|
failedMessage,
|
||||||
isCompound,
|
isCompound,
|
||||||
jobStatus: testJobStatus,
|
jobStatus: testJobStatus,
|
||||||
|
job
|
||||||
} = failingTest;
|
} = failingTest;
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { state: jobState, retrySingle } = useContext(JobContext);
|
const { state: jobState, jobFactory } = useContext(JobContext);
|
||||||
|
|
||||||
const { state: store, updateStore, removeFailure } = useContext(StoreContext);
|
const { state: store, updateStore, removeFailure } = useContext(StoreContext);
|
||||||
|
|
||||||
|
@ -77,12 +78,13 @@ export default function FailingBox(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const retryTest = () => {
|
const retryTest = () => {
|
||||||
const jobId = retrySingle(failingTest);
|
const jobId = jobFactory({testNames: [testName], isTriage: true});
|
||||||
if (store.focusJob) navigate(`/qualiteer/jobs#${jobId}`);
|
if (store.focusJob) navigate(`/qualiteer/jobs#${jobId}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const jobOnClick = () => {
|
const jobOnClick = () => {
|
||||||
switch (testJobStatus) {
|
if(!job) return retryTest;
|
||||||
|
switch (job.status) {
|
||||||
case jobStatus.OK:
|
case jobStatus.OK:
|
||||||
return null;
|
return null;
|
||||||
case jobStatus.ERROR:
|
case jobStatus.ERROR:
|
||||||
|
@ -101,7 +103,8 @@ export default function FailingBox(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function jobIcon() {
|
function jobIcon() {
|
||||||
switch (testJobStatus) {
|
if(!job) return <ReplayIcon />;
|
||||||
|
switch (job.status) {
|
||||||
case jobStatus.OK:
|
case jobStatus.OK:
|
||||||
return <CheckIcon color="success" />;
|
return <CheckIcon color="success" />;
|
||||||
case jobStatus.ERROR:
|
case jobStatus.ERROR:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue