From 86058f32ec7cc5d375c6cc235080157f6558005c Mon Sep 17 00:00:00 2001
From: Star Richardson <67430892+alicenstar@users.noreply.github.com>
Date: Fri, 20 Oct 2023 10:22:03 -0600
Subject: [PATCH] update redirect to cluster manage page, comment test data
(#4096)
* improve logic around initial cluster flow, comment test data
* fix types, redirect on unknown or pending config status if helmvm
---
pkg/store/types/constants.go | 16 +++----
web/src/Root.tsx | 24 +++++++----
web/src/components/apps/AppDetailPage.tsx | 6 ++-
.../apps/HelmVMClusterManagement.tsx | 42 ++++++++++++++++---
web/src/components/apps/HelmVMViewNode.jsx | 38 +++++++++++++++--
web/src/components/shared/NavBar.tsx | 27 ++++++------
.../AppVersionHistoryRow.tsx | 9 ++--
.../components/DashboardVersionCard.tsx | 6 +--
web/src/types/index.ts | 5 +--
9 files changed, 119 insertions(+), 54 deletions(-)
diff --git a/pkg/store/types/constants.go b/pkg/store/types/constants.go
index a449968b28..1ce8b655d7 100644
--- a/pkg/store/types/constants.go
+++ b/pkg/store/types/constants.go
@@ -3,12 +3,12 @@ package types
type DownstreamVersionStatus string
const (
- VersionUnknown DownstreamVersionStatus = "unknown"
- VersionPendingConfig DownstreamVersionStatus = "pending_config"
- VersionPending DownstreamVersionStatus = "pending"
- VersionPendingPreflight DownstreamVersionStatus = "pending_preflight"
- VersionPendingDownload DownstreamVersionStatus = "pending_download"
- VersionDeploying DownstreamVersionStatus = "deploying"
- VersionDeployed DownstreamVersionStatus = "deployed"
- VersionFailed DownstreamVersionStatus = "failed"
+ VersionUnknown DownstreamVersionStatus = "unknown" // we don't know
+ VersionPendingConfig DownstreamVersionStatus = "pending_config" // needs required configuration
+ VersionPendingDownload DownstreamVersionStatus = "pending_download" // needs to be downloaded from the upstream source
+ VersionPendingPreflight DownstreamVersionStatus = "pending_preflight" // waiting for preflights to finish
+ VersionPending DownstreamVersionStatus = "pending" // can be deployed, but is not yet
+ VersionDeploying DownstreamVersionStatus = "deploying" // is being deployed
+ VersionDeployed DownstreamVersionStatus = "deployed" // did deploy successfully
+ VersionFailed DownstreamVersionStatus = "failed" // did not deploy successfully
)
diff --git a/web/src/Root.tsx b/web/src/Root.tsx
index 04a656426b..54e86f9a31 100644
--- a/web/src/Root.tsx
+++ b/web/src/Root.tsx
@@ -576,15 +576,21 @@ const Root = () => {
/>
} />
{state.adminConsoleMetadata?.isHelmVM && (
-
- }
- />
+ <>
+
+ }
+ />
+ }
+ />
+ >
)}
{(state.adminConsoleMetadata?.isKurl ||
state.adminConsoleMetadata?.isHelmVM) && (
diff --git a/web/src/components/apps/AppDetailPage.tsx b/web/src/components/apps/AppDetailPage.tsx
index dbe0d00df5..46fbe7a2e2 100644
--- a/web/src/components/apps/AppDetailPage.tsx
+++ b/web/src/components/apps/AppDetailPage.tsx
@@ -322,11 +322,15 @@ function AppDetailPage(props: Props) {
const firstVersion = downstream.pendingVersions.find(
(version: Version) => version?.sequence === 0
);
- if (props.isHelmVM) {
+ if (firstVersion?.status === "unknown" && props.isHelmVM) {
navigate(`/${appNeedsConfiguration.slug}/cluster/manage`);
return;
}
if (firstVersion?.status === "pending_config") {
+ if (props.isHelmVM) {
+ navigate(`/${appNeedsConfiguration.slug}/cluster/manage`);
+ return;
+ }
navigate(`/${appNeedsConfiguration.slug}/config`);
return;
}
diff --git a/web/src/components/apps/HelmVMClusterManagement.tsx b/web/src/components/apps/HelmVMClusterManagement.tsx
index 799cd767c7..3c80ae1ef9 100644
--- a/web/src/components/apps/HelmVMClusterManagement.tsx
+++ b/web/src/components/apps/HelmVMClusterManagement.tsx
@@ -14,6 +14,38 @@ import CodeSnippet from "../shared/CodeSnippet";
import "@src/scss/components/apps/HelmVMClusterManagement.scss";
+const testData = {
+ nodes: undefined,
+};
+// const testData = {
+// nodes: [
+// {
+// name: "laverya-helmvm",
+// isConnected: true,
+// isReady: true,
+// isPrimaryNode: true,
+// canDelete: false,
+// kubeletVersion: "v1.28.2+k0s",
+// kubeProxyVersion: "v1.28.2+k0s",
+// operatingSystem: "linux",
+// kernelVersion: "5.10.0-26-cloud-amd64",
+// cpu: { capacity: 4, used: 1.9364847660000002 },
+// memory: { capacity: 15.633056640625, used: 3.088226318359375 },
+// pods: { capacity: 110, used: 27 },
+// labels: ["controller"],
+// conditions: {
+// memoryPressure: false,
+// diskPressure: false,
+// pidPressure: false,
+// ready: true,
+// },
+// podList: [],
+// },
+// ],
+// ha: true,
+// isHelmVMEnabled: true,
+// };
+
type State = {
displayAddNode: boolean;
confirmDeleteNode: string;
@@ -260,12 +292,10 @@ const HelmVMClusterManagement = ({
const mappedNodes = useMemo(() => {
return (
- nodesData?.nodes?.map((n) => ({
- name: slug ? (
- n.name
- ) : (
+ (nodesData?.nodes || testData?.nodes)?.map((n) => ({
+ name: (
{n.name}
@@ -335,7 +365,7 @@ const HelmVMClusterManagement = ({
{nodesError?.message}
)}
- {nodesData?.nodes && (
+ {(nodesData?.nodes || testData?.nodes) && (
{
- const { nodeName } = useParams();
+ const { slug, nodeName } = useParams();
const { data: nodeData, isLoading: nodeLoading } = useQuery({
queryKey: ["helmVmNode", nodeName],
queryFn: async ({ queryKey }) => {
@@ -41,7 +73,7 @@ const HelmVMViewNode = () => {
},
});
- const node = nodeData;
+ const node = nodeData || testData;
// #region table data
const columns = useMemo(
@@ -109,7 +141,7 @@ const HelmVMViewNode = () => {
{/* Breadcrumbs */}
Cluster Nodes
diff --git a/web/src/components/shared/NavBar.tsx b/web/src/components/shared/NavBar.tsx
index 6f937c6226..09c6dc2c9d 100644
--- a/web/src/components/shared/NavBar.tsx
+++ b/web/src/components/shared/NavBar.tsx
@@ -228,20 +228,21 @@ export class NavBar extends PureComponent {
)}
- {(isKurlEnabled || isHelmVMEnabled) && (
-
-
- Cluster Management
-
-
- )}
+
+ Cluster Management
+
+
+ )}
{isSnapshotsSupported && (
{
};
const getCurrentVersionStatus = (version: Version | null) => {
- if (
- version?.status === "deployed" ||
- version?.status === "merged" ||
- version?.status === "pending"
- ) {
+ if (version?.status === "deployed" || version?.status === "pending") {
return (
Currently {version?.status.replace("_", " ")} version
diff --git a/web/src/types/index.ts b/web/src/types/index.ts
index 269d6d1b35..6a0c7cdf44 100644
--- a/web/src/types/index.ts
+++ b/web/src/types/index.ts
@@ -252,13 +252,12 @@ export type VersionStatus =
| "deployed"
| "deploying"
| "failed"
- | "merged"
| "pending"
| "pending_config"
| "pending_download"
| "pending_preflight"
- | "superseded"
- | "waiting";
+ | "waiting"
+ | "unknown";
export type LicenseFile = {
preview: string;