-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from bartoval/polish_charts_size
refactor(Metrics): ♻️ Polish charts resize
- Loading branch information
Showing
16 changed files
with
456 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,51 @@ | ||
import { FC, memo } from 'react'; | ||
|
||
import { Stack, StackItem, Title } from '@patternfly/react-core'; | ||
import { Flex, FlexItem } from '@patternfly/react-core'; | ||
|
||
import { Labels } from '../../../../config/labels'; | ||
import SkChartArea from '../../../../core/components/SkChartArea'; | ||
import SkIsLoading from '../../../../core/components/SkIsLoading'; | ||
import { formatLatency } from '../../../../core/utils/formatLatency'; | ||
import { LatencyMetrics } from '../../../../types/Metrics.interfaces'; | ||
|
||
const LatencyCharts: FC<{ | ||
latenciesData: LatencyMetrics[]; | ||
title: string; | ||
}> = memo(({ latenciesData, title }) => ( | ||
<Stack hasGutter> | ||
<StackItem> | ||
<Title headingLevel="h4">{title}</Title> | ||
<SkChartArea | ||
formatY={formatLatency} | ||
legendLabels={latenciesData.map(({ label }) => label)} | ||
data={latenciesData.map(({ data }) => data)} | ||
isChartLine={true} | ||
/> | ||
</StackItem> | ||
</Stack> | ||
)); | ||
interface LatencyChartsProps { | ||
inboundData?: LatencyMetrics[] | null; | ||
outboundData?: LatencyMetrics[] | null; | ||
isInboundLoading: boolean; | ||
isOutboundLoading: boolean; | ||
isInboundRefetching: boolean; | ||
isOutboundRefetching: boolean; | ||
} | ||
|
||
const LatencyCharts: FC<LatencyChartsProps> = memo( | ||
({ inboundData, outboundData, isInboundLoading, isOutboundLoading, isInboundRefetching, isOutboundRefetching }) => ( | ||
<Flex direction={{ xl: 'row', default: 'column' }} gap={{ default: 'gap4xl' }}> | ||
{!isOutboundLoading && outboundData?.length && ( | ||
<FlexItem flex={{ default: 'flex_1' }}> | ||
{!isOutboundLoading && isOutboundRefetching && <SkIsLoading />} | ||
<SkChartArea | ||
title={Labels.Inbound} | ||
formatY={formatLatency} | ||
legendLabels={outboundData.map(({ label }) => label)} | ||
data={outboundData.map(({ data }) => data)} | ||
isChartLine={true} | ||
/> | ||
</FlexItem> | ||
)} | ||
{!isInboundLoading && inboundData?.length && ( | ||
<FlexItem flex={{ default: 'flex_1' }}> | ||
{!isInboundLoading && isInboundRefetching && <SkIsLoading />} | ||
<SkChartArea | ||
title={Labels.Outbound} | ||
formatY={formatLatency} | ||
legendLabels={inboundData.map(({ label }) => label)} | ||
data={inboundData.map(({ data }) => data)} | ||
isChartLine={true} | ||
/> | ||
</FlexItem> | ||
)} | ||
</Flex> | ||
) | ||
); | ||
|
||
export default LatencyCharts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.