Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions torchci/pages/failure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);

import { CSSProperties, useState } from "react";
import { useRouter } from "next/router";
import useSWR from "swr";
import { BarChart, Bar, CartesianGrid, Tooltip, XAxis, YAxis } from "recharts";
Expand All @@ -14,7 +15,6 @@ import { usePreference } from "lib/useGroupingPreference";
import { ParamSelector } from "lib/ParamSelector";

const fetcher = (url: string) => fetch(url).then((res) => res.json());
import { CSSProperties } from "react";

function FuzzySearchCheckBox({
useFuzzySearch,
Expand Down Expand Up @@ -51,6 +51,11 @@ function FailureInfo({
jobCount: { [jobName: string]: number };
samples: JobData[];
}) {
const [jobsToShow, setJobsToShow] = useState(new Set<string>());
const samplesToShow = samples.filter((sample) => {
return jobsToShow.size == 0 || (sample.name && jobsToShow.has(sample.name));
});

// Populate the last 14 days
const dayBuckets: Map<
string,
Expand All @@ -69,7 +74,7 @@ function FailureInfo({
highlighted.add("main");

const branchNames = new Set<string>(highlighted);
samples.forEach((job, i) => {
samplesToShow.forEach((job, i) => {
const time = dayjs(job.time!).local().format("MM/D");
if (!dayBuckets.has(time)) {
return;
Expand Down Expand Up @@ -208,7 +213,26 @@ function FailureInfo({
return jobAName.localeCompare(jobBName);
})
.map(([job, count]) => (
<tr key={job}>
<tr
key={job}
onClick={() => {
if (jobsToShow.has(job)) {
const newSet = new Set(jobsToShow);
newSet.delete(job);
setJobsToShow(newSet);
} else {
setJobsToShow(new Set(jobsToShow).add(job));
}
}}
>
<td>
<input
type="checkbox"
name={`show-${job}`}
checked={jobsToShow.has(job)}
onChange={() => {}}
></input>
</td>
<td>{job}</td>
<td>{count as number}</td>
</tr>
Expand All @@ -218,7 +242,7 @@ function FailureInfo({
</div>
<h3>Failures ({totalCount} total)</h3>
<ul>
{samples
{samplesToShow
// Keep the most recent samples on top
.sort(function (sampleA: JobData, sampleB: JobData) {
if (sampleA.time == sampleB.time) {
Expand Down