Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use grouped status in status chart for all tree details tab #276

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dashboard/src/components/StatusChart/StatusCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const ChartLegend = ({ chartValues, onClick }: IChartLegend): JSX.Element => {
<WrapperElement
onClick={(): void => onClick?.(status)}
key={chartValue?.color}
className="flex flex-row"
className="flex flex-row text-left"
>
{chartValue && (
<div className="pr-2 pt-1">
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TreeDetails/Tabs/Build/BuildTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const StatusCard = ({
},
{
value: treeDetailsData?.buildsSummary.null ?? 0,
label: 'treeDetails.unknown',
label: 'global.inconclusive',
color: Colors.Gray,
},
]}
Expand Down
35 changes: 15 additions & 20 deletions dashboard/src/pages/TreeDetails/Tabs/TestCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import StatusChartMemoized, {
Colors,
StatusChartValues,
} from '@/components/StatusChart/StatusCharts';
import { groupStatus } from '@/utils/status';

interface IConfigList extends Pick<TTreeTestsData, 'configStatusCounts'> {
title: IBaseCard['title'];
Expand Down Expand Up @@ -177,37 +178,31 @@ interface IStatusChart extends Pick<TTreeTestsData, 'statusCounts'> {
}

const StatusChart = ({ statusCounts, title }: IStatusChart): JSX.Element => {
const groupedStatusCounts = groupStatus({
doneCount: statusCounts.DONE ?? 0,
errorCount: statusCounts.ERROR ?? 0,
failCount: statusCounts.FAIL ?? 0,
missCount: statusCounts.MISS ?? 0,
passCount: statusCounts.PASS ?? 0,
skipCount: statusCounts.SKIP ?? 0,
});

const chartElements = [
{
label: 'bootsTab.success',
value: statusCounts['PASS'] ?? 0,
value: groupedStatusCounts.successCount,
color: Colors.Green,
},
{
label: 'global.failed',
value: statusCounts['FAIL'] ?? 0,
color: Colors.Yellow,
},
{
label: 'bootsTab.skip',
value: statusCounts['SKIP'] ?? 0,
color: Colors.DimGray,
value: groupedStatusCounts.failedCount,
color: Colors.Red,
},
{
label: 'global.missed',
value: statusCounts['MISS'] ?? 0,
label: 'global.inconclusive',
value: groupedStatusCounts.inconclusiveCount ?? 0,
color: Colors.Gray,
},
{
label: 'global.done',
value: statusCounts['DONE'] ?? 0,
color: Colors.Blue,
},
{
label: 'bootsTab.error',
value: statusCounts['ERROR'] ?? 0,
color: Colors.Red,
},
] satisfies StatusChartValues[];

const filteredChartElements = chartElements.filter(chartElement => {
Expand Down
Loading