Skip to content

Commit

Permalink
[DONTNOD] Add DetailLevel.OnlyFailures to BuildSummary and make it th…
Browse files Browse the repository at this point in the history
…e default
  • Loading branch information
tdesveaux committed Jan 8, 2024
1 parent 25f062a commit 7bd4510
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions www/react-base/src/components/BuildSummary/BuildSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
results2class,
results2text,
SUCCESS,
FAILURE,
useDataAccessor,
useDataApiDynamicQuery,
useDataApiQuery,
Expand All @@ -56,8 +57,9 @@ import {AnchorLink} from "../AnchorLink/AnchorLink";
enum DetailLevel {
None = 0,
OnlyNotSuccess = 1,
Everything = 2,
Count = 3
OnlyFailures = 2,
Everything = 3,
Count = 4
}

const detailLevelToString = (level: DetailLevel) => {
Expand All @@ -66,6 +68,8 @@ const detailLevelToString = (level: DetailLevel) => {
return "None";
case DetailLevel.OnlyNotSuccess:
return "Problems";
case DetailLevel.OnlyFailures:
return "Failures";
case DetailLevel.Everything:
default:
return "All";
Expand All @@ -77,6 +81,8 @@ const isStepDisplayed = (step: Step, details: DetailLevel) => {
return !step.hidden;
} else if (details === DetailLevel.OnlyNotSuccess) {
return (step.results == null) || (step.results !== SUCCESS);
} else if (details === DetailLevel.OnlyFailures) {
return step.results === FAILURE;
} else if (details === DetailLevel.None) {
return false;
}
Expand Down Expand Up @@ -237,7 +243,7 @@ export const BuildSummary = observer(({build, parentBuild, parentRelationship,
const logsQuery = useDataApiQuery(() => stepsQuery.getRelated(step => step.getLogs()));

const [detailLevel, setDetailLevel] =
useState<DetailLevel>(condensed ? DetailLevel.OnlyNotSuccess : DetailLevel.Everything);
useState<DetailLevel>(condensed ? DetailLevel.OnlyFailures : DetailLevel.Everything);

const builder = builderQuery.getNthOrNull(0);
const parentBuilder = builderBuilderQuery.getNthOrNull(0);
Expand Down

0 comments on commit 7bd4510

Please sign in to comment.