From deccf873e04ee1f4ee278d93c4a4ea40fcf96366 Mon Sep 17 00:00:00 2001 From: GuangbinMa Date: Tue, 16 Apr 2024 16:53:40 +0800 Subject: [PATCH] ADM-902: [frontend] fix: fix unit test --- .../DeploymentFrequencySettings/index.tsx | 20 +++++++++---------- frontend/src/context/Metrics/metricsSlice.ts | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/src/containers/MetricsStep/DeploymentFrequencySettings/index.tsx b/frontend/src/containers/MetricsStep/DeploymentFrequencySettings/index.tsx index 33f3e6534f..f68d7d9017 100644 --- a/frontend/src/containers/MetricsStep/DeploymentFrequencySettings/index.tsx +++ b/frontend/src/containers/MetricsStep/DeploymentFrequencySettings/index.tsx @@ -44,6 +44,8 @@ export const DeploymentFrequencySettings = () => { }; const totalPipelineNumber = realDeploymentFrequencySettings.length; + const shouldShowCrews = + loadingCompletedNumber !== 0 && totalPipelineNumber !== 0 && loadingCompletedNumber === totalPipelineNumber; return ( <> @@ -73,16 +75,14 @@ export const DeploymentFrequencySettings = () => { /> ))} - {loadingCompletedNumber !== 0 && - totalPipelineNumber !== 0 && - loadingCompletedNumber === totalPipelineNumber && ( - - )} + {shouldShowCrews && ( + + )} )} diff --git a/frontend/src/context/Metrics/metricsSlice.ts b/frontend/src/context/Metrics/metricsSlice.ts index a2e9f4fbe3..09b5eb5009 100644 --- a/frontend/src/context/Metrics/metricsSlice.ts +++ b/frontend/src/context/Metrics/metricsSlice.ts @@ -515,7 +515,7 @@ export const metricsSlice = createSlice({ : ''; return { id, - isStepSelected: isStepSelected ? isStepSelected : false, + isStepSelected: isStepSelected || false, organization: matchedOrganization, pipelineName: matchedPipelineName, step: matchedPipelineName ? step : '', @@ -597,7 +597,7 @@ export const metricsSlice = createSlice({ return pipeline?.id === id ? { ...pipeline, - step: stepWarningMessage(selectedPipelineStep, matchedPipeline.isStepSelected), + step: stepWarningMessage(selectedPipelineStep, matchedPipeline?.isStepSelected || false), } : pipeline; });