mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
fix: Do not show the MetricsChartTooltip InfoSummary when all projects (#6810)
What it says on the tin Closes # [](https://linear.app/unleash/issue/1-2275/hide-bottom-part-of-metrics-tooltip-when-all-projects) <img width="1677" alt="Screenshot 2024-04-09 at 16 57 13" src="https://github.com/Unleash/unleash/assets/104830839/2369c6f4-a136-4635-b77b-63aa0087338e"> <img width="1678" alt="Screenshot 2024-04-09 at 16 55 53" src="https://github.com/Unleash/unleash/assets/104830839/b29ec13d-5611-40a2-8dc6-af4c5a4ec97a"> --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
032419aa76
commit
fb9855c3fa
@ -1,18 +0,0 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
|
||||||
import { InfoSummary } from './MetricsChartTooltip';
|
|
||||||
|
|
||||||
test('Renders apps, flags, and environments, even when their data is `N/A`', () => {
|
|
||||||
render(
|
|
||||||
<InfoSummary
|
|
||||||
data={[
|
|
||||||
{ key: 'Flags', value: 'N/A' },
|
|
||||||
{ key: 'Environments', value: 'N/A' },
|
|
||||||
{ key: 'Apps', value: 'N/A' },
|
|
||||||
]}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
|
|
||||||
screen.getByText('Environments');
|
|
||||||
screen.getByText('Apps');
|
|
||||||
screen.getByText('Flags');
|
|
||||||
});
|
|
@ -2,6 +2,7 @@ import type { VFC } from 'react';
|
|||||||
import type { InstanceInsightsSchemaMetricsSummaryTrendsItem } from 'openapi';
|
import type { InstanceInsightsSchemaMetricsSummaryTrendsItem } from 'openapi';
|
||||||
import { Box, Divider, Paper, styled, Typography } from '@mui/material';
|
import { Box, Divider, Paper, styled, Typography } from '@mui/material';
|
||||||
import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip';
|
import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip';
|
||||||
|
import { ConditionallyRender } from '../../../../common/ConditionallyRender/ConditionallyRender';
|
||||||
|
|
||||||
const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({
|
const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({
|
||||||
padding: theme.spacing(2),
|
padding: theme.spacing(2),
|
||||||
@ -126,24 +127,38 @@ export const MetricsSummaryTooltip: VFC<{ tooltip: TooltipState | null }> = ({
|
|||||||
title={`Not exposed: ${point.value.totalNo ?? 0}`}
|
title={`Not exposed: ${point.value.totalNo ?? 0}`}
|
||||||
color={'error'}
|
color={'error'}
|
||||||
/>
|
/>
|
||||||
<Divider
|
<ConditionallyRender
|
||||||
sx={(theme) => ({ margin: theme.spacing(1.5, 0) })}
|
condition={
|
||||||
/>
|
Boolean(point.value.totalApps) &&
|
||||||
<InfoSummary
|
Boolean(point.value.totalEnvironments) &&
|
||||||
data={[
|
Boolean(point.value.totalFlags)
|
||||||
{
|
}
|
||||||
key: 'Flags',
|
show={
|
||||||
value: point.value.totalFlags ?? 'N/A',
|
<>
|
||||||
},
|
<Divider
|
||||||
{
|
sx={(theme) => ({
|
||||||
key: 'Environments',
|
margin: theme.spacing(1.5, 0),
|
||||||
value: point.value.totalEnvironments ?? 'N/A',
|
})}
|
||||||
},
|
/>
|
||||||
{
|
<InfoSummary
|
||||||
key: 'Apps',
|
data={[
|
||||||
value: point.value.totalApps ?? 'N/A',
|
{
|
||||||
},
|
key: 'Flags',
|
||||||
]}
|
value: point.value.totalFlags,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Environments',
|
||||||
|
value: point.value
|
||||||
|
.totalEnvironments,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Apps',
|
||||||
|
value: point.value.totalApps,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</StyledTooltipItemContainer>
|
</StyledTooltipItemContainer>
|
||||||
)) || null}
|
)) || null}
|
||||||
|
Loading…
Reference in New Issue
Block a user