From 8f1f25180c5ce08e670a8a8bea693cbd3cdbfef1 Mon Sep 17 00:00:00 2001 From: Mia Wong Date: Fri, 2 Aug 2024 13:37:17 -0400 Subject: [PATCH] Fix error in Cluster Management page when clicking continue (#4795) --- pkg/handlers/embedded_cluster_confirm_cluster_management.go | 6 ------ web/src/components/PreflightResultPage.tsx | 6 ++++-- web/src/components/upgrade_service/ConfirmAndDeploy.tsx | 6 ++++-- web/src/components/upgrade_service/PreflightChecks.tsx | 4 +++- web/src/features/AppConfig/components/AppConfig.tsx | 4 ++-- web/src/features/PreflightChecks/api/getPreflightResult.tsx | 4 +++- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pkg/handlers/embedded_cluster_confirm_cluster_management.go b/pkg/handlers/embedded_cluster_confirm_cluster_management.go index 65aca71451..c42bb128cb 100644 --- a/pkg/handlers/embedded_cluster_confirm_cluster_management.go +++ b/pkg/handlers/embedded_cluster_confirm_cluster_management.go @@ -53,12 +53,6 @@ func (h *Handler) ConfirmEmbeddedClusterManagement(w http.ResponseWriter, r *htt } pendingVersion := downstreamVersions.PendingVersions[0] - if pendingVersion.Status != storetypes.VersionPendingClusterManagement { - logger.Error(fmt.Errorf("pending version is not in pending_cluster_management status")) - w.WriteHeader(http.StatusBadRequest) - return - } - archiveDir, err := os.MkdirTemp("", "kotsadm") if err != nil { logger.Error(fmt.Errorf("failed to create temp dir: %w", err)) diff --git a/web/src/components/PreflightResultPage.tsx b/web/src/components/PreflightResultPage.tsx index f3e2acfd1d..07662a1967 100644 --- a/web/src/components/PreflightResultPage.tsx +++ b/web/src/components/PreflightResultPage.tsx @@ -75,7 +75,7 @@ function PreflightResultPage(props: Props) { return (
-
+
{location.pathname.includes("version-history") && (
navigate(-1)}>
diff --git a/web/src/components/upgrade_service/ConfirmAndDeploy.tsx b/web/src/components/upgrade_service/ConfirmAndDeploy.tsx index db30542504..bfc6cddd5a 100644 --- a/web/src/components/upgrade_service/ConfirmAndDeploy.tsx +++ b/web/src/components/upgrade_service/ConfirmAndDeploy.tsx @@ -181,7 +181,7 @@ const ConfirmAndDeploy = ({ return (
-
+
{location.pathname.includes("version-history") && (
navigate(-1)}>
diff --git a/web/src/components/upgrade_service/PreflightChecks.tsx b/web/src/components/upgrade_service/PreflightChecks.tsx index 9adbcff7ac..4376381401 100644 --- a/web/src/components/upgrade_service/PreflightChecks.tsx +++ b/web/src/components/upgrade_service/PreflightChecks.tsx @@ -108,7 +108,9 @@ const PreflightCheck = ({ preflightCheck?.pendingPreflightCheckName || "" } percentage={ - preflightCheck?.pendingPreflightChecksPercentage || 0 + Math.round( + preflightCheck?.pendingPreflightChecksPercentage + ) || 0 } />
diff --git a/web/src/features/AppConfig/components/AppConfig.tsx b/web/src/features/AppConfig/components/AppConfig.tsx index c013917089..a26e0ed557 100644 --- a/web/src/features/AppConfig/components/AppConfig.tsx +++ b/web/src/features/AppConfig/components/AppConfig.tsx @@ -404,10 +404,10 @@ class AppConfig extends Component { const hasPreflight = app?.hasPreflight; if (hasPreflight) { - navigate(`/${slug}/preflight`, { replace: true }); + navigate(`/${slug}/preflight`); } else { await this.props.refetchApps(); - navigate(`/app/${slug}`, { replace: true }); + navigate(`/app/${slug}`); } } else { this.setState({ diff --git a/web/src/features/PreflightChecks/api/getPreflightResult.tsx b/web/src/features/PreflightChecks/api/getPreflightResult.tsx index 143d963db7..5e24bfcc45 100644 --- a/web/src/features/PreflightChecks/api/getPreflightResult.tsx +++ b/web/src/features/PreflightChecks/api/getPreflightResult.tsx @@ -189,7 +189,9 @@ function useGetPrelightResults({ setRefetchCount(0); }, refetchInterval: (preflightCheck: PreflightCheck | undefined) => { - if (!preflightCheck) return false; + if (!preflightCheck) return null; + + if (preflightCheck?.preflightResults.length > 0) return null; const refetchInterval = makeRefetchInterval(preflightCheck);