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 = () => {
|
||||
return [{
|
||||
name: `single`,
|
||||
class: `single.js`,
|
||||
name: `failing`,
|
||||
class: `failing.js`,
|
||||
method: "FAKEMETHOD",
|
||||
id: 0,
|
||||
silencedUntil: new Date().toJSON(),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { useState, useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import {useCurrentlyFailing} from "../../Queries.jsx";
|
||||
import {useCurrentlyFailing, useSilencedAlerts} from "../../Queries.jsx";
|
||||
import StoreContext from "../../ctx/StoreContext.jsx";
|
||||
import JobContext from "../../ctx/JobContext.jsx";
|
||||
import SilenceDialog from "../alerting/SilenceDialog.jsx";
|
||||
|
@ -29,7 +29,7 @@ export default function Failing() {
|
|||
silenceRequest,
|
||||
} = useContext(StoreContext);
|
||||
const {isLoading, data: failing} = useCurrentlyFailing();
|
||||
|
||||
const {isSilencedLoading, data:silencedAlerts} = useSilencedAlerts();
|
||||
const [silenceEntry, setSilenceEntry] = useState({ open: false });
|
||||
|
||||
const closeSilence = () => setSilenceEntry({ ...silenceEntry, open: false });
|
||||
|
@ -56,9 +56,22 @@ export default function Failing() {
|
|||
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 (
|
||||
<div className="failing">
|
||||
{isLoading? null :failing.map((v, i) => (
|
||||
{isLoading? null :failingTestsWithJobs().map((v, i) => (
|
||||
<FailingBox key={i} failingTest={v} silenceClick={editSilence(v)} />
|
||||
))}
|
||||
|
||||
|
@ -97,6 +110,7 @@ export default function Failing() {
|
|||
|
||||
|
||||
): null}
|
||||
|
||||
{(failing ?? []).length ===0? null :(
|
||||
<SpeedDial
|
||||
ariaLabel="Retry All"
|
||||
|
|
|
@ -48,11 +48,12 @@ export default function FailingBox(props) {
|
|||
failedMessage,
|
||||
isCompound,
|
||||
jobStatus: testJobStatus,
|
||||
job
|
||||
} = failingTest;
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { state: jobState, retrySingle } = useContext(JobContext);
|
||||
const { state: jobState, jobFactory } = useContext(JobContext);
|
||||
|
||||
const { state: store, updateStore, removeFailure } = useContext(StoreContext);
|
||||
|
||||
|
@ -77,12 +78,13 @@ export default function FailingBox(props) {
|
|||
}
|
||||
|
||||
const retryTest = () => {
|
||||
const jobId = retrySingle(failingTest);
|
||||
const jobId = jobFactory({testNames: [testName], isTriage: true});
|
||||
if (store.focusJob) navigate(`/qualiteer/jobs#${jobId}`);
|
||||
};
|
||||
|
||||
const jobOnClick = () => {
|
||||
switch (testJobStatus) {
|
||||
if(!job) return retryTest;
|
||||
switch (job.status) {
|
||||
case jobStatus.OK:
|
||||
return null;
|
||||
case jobStatus.ERROR:
|
||||
|
@ -101,7 +103,8 @@ export default function FailingBox(props) {
|
|||
};
|
||||
|
||||
function jobIcon() {
|
||||
switch (testJobStatus) {
|
||||
if(!job) return <ReplayIcon />;
|
||||
switch (job.status) {
|
||||
case jobStatus.OK:
|
||||
return <CheckIcon color="success" />;
|
||||
case jobStatus.ERROR:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue