Upgrades people!
This commit is contained in:
parent
f84234150f
commit
8ad56e8d38
40 changed files with 483 additions and 379 deletions
|
@ -1,6 +1,6 @@
|
|||
import { useState, useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import {useCurrentlyFailing, useSilencedAlerts} 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";
|
||||
|
@ -28,8 +28,8 @@ export default function Failing() {
|
|||
updateStore,
|
||||
silenceRequest,
|
||||
} = useContext(StoreContext);
|
||||
const {isLoading, data: failing} = useCurrentlyFailing();
|
||||
const {isSilencedLoading, data:silencedAlerts} = useSilencedAlerts();
|
||||
const { isLoading, data: failing } = useCurrentlyFailing();
|
||||
const { isSilencedLoading, data: silencedAlerts } = useSilencedAlerts();
|
||||
const [silenceEntry, setSilenceEntry] = useState({ open: false });
|
||||
|
||||
const closeSilence = () => setSilenceEntry({ ...silenceEntry, open: false });
|
||||
|
@ -58,22 +58,28 @@ export default function Failing() {
|
|||
|
||||
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)
|
||||
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;
|
||||
if (silence) test.silencedUntil = silence;
|
||||
}
|
||||
return failing;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="failing">
|
||||
{isLoading? null :failingTestsWithJobs().map((v, i) => (
|
||||
<FailingBox key={i} failingTest={v} silenceClick={editSilence(v)} />
|
||||
))}
|
||||
{isLoading
|
||||
? null
|
||||
: failingTestsWithJobs().map((v, i) => (
|
||||
<FailingBox key={i} failingTest={v} silenceClick={editSilence(v)} />
|
||||
))}
|
||||
|
||||
<Dialog
|
||||
open={retryAllOpen}
|
||||
|
@ -100,25 +106,21 @@ export default function Failing() {
|
|||
onClose={handleSilenceClose}
|
||||
silence={silenceEntry}
|
||||
/>
|
||||
{(failing ?? []).length === 0? ( <Box
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Typography variant="h4">No tests failing!</Typography>
|
||||
</Box>
|
||||
|
||||
|
||||
): null}
|
||||
{(failing ?? []).length === 0 ? (
|
||||
<Box display="flex" alignItems="center" justifyContent="center">
|
||||
<Typography variant="h4">No tests failing!</Typography>
|
||||
</Box>
|
||||
) : null}
|
||||
|
||||
{(failing ?? []).length ===0? null :(
|
||||
<SpeedDial
|
||||
ariaLabel="Retry All"
|
||||
sx={{ position: "fixed", bottom: 16, right: 16 }}
|
||||
icon={<ReplayIcon />}
|
||||
onClick={retryAllClick}
|
||||
open={false}
|
||||
/>)}
|
||||
{(failing ?? []).length === 0 ? null : (
|
||||
<SpeedDial
|
||||
ariaLabel="Retry All"
|
||||
sx={{ position: "fixed", bottom: 16, right: 16 }}
|
||||
icon={<ReplayIcon />}
|
||||
onClick={retryAllClick}
|
||||
open={false}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export default function FailingBox(props) {
|
|||
failedMessage,
|
||||
isCompound,
|
||||
jobStatus: testJobStatus,
|
||||
job
|
||||
job,
|
||||
} = failingTest;
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
@ -78,12 +78,12 @@ export default function FailingBox(props) {
|
|||
}
|
||||
|
||||
const retryTest = () => {
|
||||
const jobId = jobFactory({testNames: [testName], isTriage: true});
|
||||
const jobId = jobFactory({ testNames: [testName], isTriage: true });
|
||||
if (store.focusJob) navigate(`/qualiteer/jobs#${jobId}`);
|
||||
};
|
||||
|
||||
const jobOnClick = () => {
|
||||
if(!job) return retryTest;
|
||||
if (!job) return retryTest;
|
||||
switch (job.status) {
|
||||
case jobStatus.OK:
|
||||
return null;
|
||||
|
@ -103,7 +103,7 @@ export default function FailingBox(props) {
|
|||
};
|
||||
|
||||
function jobIcon() {
|
||||
if(!job) return <ReplayIcon />;
|
||||
if (!job) return <ReplayIcon />;
|
||||
switch (job.status) {
|
||||
case jobStatus.OK:
|
||||
return <CheckIcon color="success" />;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue