Skip to content
Open
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
24 changes: 23 additions & 1 deletion frontend/src/pages/Presets/Details/Benchmark/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';

import { BarChart, Box, Container, Header, Loader, SelectCSD, Tabs } from 'components';
import { BarChart, Box, ColumnLayout, Container, Header, Loader, SelectCSD, Tabs } from 'components';

import { useBenchmarkCharts } from './useBenchmarkCharts';

Expand All @@ -27,6 +27,28 @@ export const PresetBenchmark: FC = () => {
</Container>
);

// A single concurrency has nothing to compare across: a chart would be one bar without its value, so the
// numbers show as values, the way Details and Constraints show theirs.
if (concurrencies.length === 1)
return (
<Container header={<Header variant="h2">{t('presets.benchmark')}</Header>}>
<ColumnLayout columns={4} variant="text-grid">
<div>
<Box variant="awsui-key-label">{t('presets.concurrency')}</Box>
<div>{concurrencies[0]}</div>
</div>
{charts
.filter(({ data }) => data.length > 0)
.map(({ title, formatValue, data }) => (
<div key={title}>
<Box variant="awsui-key-label">{title}</Box>
<div>{formatValue(data[0].y)}</div>
</div>
))}
</ColumnLayout>
</Container>
);

const group = activeGroup ?? groups[0];
const groupCharts = charts.filter((chart) => chart.group === group);
const chart = groupCharts.find(({ title }) => title === metricByGroup[group]) ?? groupCharts[0];
Expand Down
Loading