From e3c42b580f8e3e8345699ae84c9651ebf0652765 Mon Sep 17 00:00:00 2001 From: Dawid Rusnak Date: Thu, 3 Aug 2023 13:33:00 +0200 Subject: [PATCH 1/2] fix: avoid jumping screen when metrics are loading --- .../EntityDetailsContent.tsx | 2 +- .../SummaryGrid/SummaryGrid.tsx | 79 ++++++++----------- .../SummaryGrid/SummaryGridItem.tsx | 23 ++++++ 3 files changed, 58 insertions(+), 46 deletions(-) create mode 100644 src/components/organisms/EntityDetails/EntityDetailsContent/SummaryGrid/SummaryGridItem.tsx diff --git a/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx b/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx index 0b77ab961..f65eda573 100644 --- a/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx +++ b/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx @@ -187,7 +187,7 @@ const EntityDetailsContent: React.FC = () => { ) : null} - {!isMetricsEmpty ? : null} + = props => { +const SummaryGrid: FC = memo(props => { const {metrics} = props; - return ( - <> + if (!metrics) { + return ( - - - pass/fail ratio - - {metrics?.passFailRatio ? `${metrics?.passFailRatio.toFixed(2)}%` : '-'} - - - - execution duration (p50) - - - {metrics?.executionDurationP50ms ? formatDuration(metrics?.executionDurationP50ms / 1000) : '-'} - - - - - execution duration (p95) - - - {metrics?.executionDurationP95ms ? formatDuration(metrics?.executionDurationP95ms / 1000) : '-'} - - - - - failed executions - - {metrics?.failedExecutions || '-'} - - - - total executions - - {metrics?.totalExecutions || '-'} - + } /> + } /> + } /> + } /> + } /> - + ); + } + + return ( + + + + + + + ); -}; +}); export default SummaryGrid; diff --git a/src/components/organisms/EntityDetails/EntityDetailsContent/SummaryGrid/SummaryGridItem.tsx b/src/components/organisms/EntityDetails/EntityDetailsContent/SummaryGrid/SummaryGridItem.tsx new file mode 100644 index 000000000..3e149fa68 --- /dev/null +++ b/src/components/organisms/EntityDetails/EntityDetailsContent/SummaryGrid/SummaryGridItem.tsx @@ -0,0 +1,23 @@ +import React, {FC, ReactNode, memo} from 'react'; + +import {Title} from '@custom-antd'; + +import Colors from '@styles/Colors'; + +import {CustomText, SummaryGridItem as ItemContainer} from './SummaryGrid.styled'; + +type SummaryGridProps = { + title: string; + value?: ReactNode; +}; + +const SummaryGridItem: FC = memo(({title, value}) => ( + + + {title} + + {value ?? '-'} + +)); + +export default SummaryGridItem; From 2bf1c0ac72ff593f020ec35667b4276074807445 Mon Sep 17 00:00:00 2001 From: Dawid Rusnak Date: Thu, 3 Aug 2023 13:38:15 +0200 Subject: [PATCH 2/2] fix: always show filtering by date Relates to: kubeshop/testkube#4083 --- .../EntityDetailsContent.tsx | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx b/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx index f65eda573..a10a51af5 100644 --- a/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx +++ b/src/components/organisms/EntityDetails/EntityDetailsContent/EntityDetailsContent.tsx @@ -137,8 +137,6 @@ const EntityDetailsContent: React.FC = () => { } : {}; - const isMetricsEmpty = !metrics?.executions || !metrics?.executions.length; - const isPageDisabled = !name; return ( @@ -149,16 +147,14 @@ const EntityDetailsContent: React.FC = () => { onBack={() => navigate(defaultStackRoute)} title={name || 'Loading...'} extra={[ - !isMetricsEmpty ? ( - , Abort all executions}]}