diff --git a/pkg/handlers/embedded_cluster_node_join_command.go b/pkg/handlers/embedded_cluster_node_join_command.go index e732fbe458..017aeb83f4 100644 --- a/pkg/handlers/embedded_cluster_node_join_command.go +++ b/pkg/handlers/embedded_cluster_node_join_command.go @@ -26,15 +26,15 @@ type GenerateEmbeddedClusterNodeJoinCommandRequest struct { } func (h *Handler) GenerateEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *http.Request) { - generateHelmVMNodeJoinCommandRequest := GenerateEmbeddedClusterNodeJoinCommandRequest{} - if err := json.NewDecoder(r.Body).Decode(&generateHelmVMNodeJoinCommandRequest); err != nil { + generateEmbeddedClusterNodeJoinCommandRequest := GenerateEmbeddedClusterNodeJoinCommandRequest{} + if err := json.NewDecoder(r.Body).Decode(&generateEmbeddedClusterNodeJoinCommandRequest); err != nil { logger.Error(fmt.Errorf("failed to decode request body: %w", err)) w.WriteHeader(http.StatusBadRequest) return } store := kotsstore.StoreFromEnv() - token, err := store.SetEmbeddedClusterInstallCommandRoles(generateHelmVMNodeJoinCommandRequest.Roles) + token, err := store.SetEmbeddedClusterInstallCommandRoles(generateEmbeddedClusterNodeJoinCommandRequest.Roles) if err != nil { logger.Error(fmt.Errorf("failed to set k0s install command roles: %w", err)) w.WriteHeader(http.StatusInternalServerError) diff --git a/web/src/Root.tsx b/web/src/Root.tsx index a78e3b46bc..9d2607b93f 100644 --- a/web/src/Root.tsx +++ b/web/src/Root.tsx @@ -1,31 +1,31 @@ -import React, { useReducer, useEffect } from "react"; -import { createBrowserHistory } from "history"; -import { Route, Routes, Navigate, useNavigate } from "react-router-dom"; -import { Helmet } from "react-helmet"; +import React, {useEffect, useReducer} from "react"; +import {createBrowserHistory} from "history"; +import {Navigate, Route, Routes, useNavigate} from "react-router-dom"; +import {Helmet} from "react-helmet"; import Modal from "react-modal"; import find from "lodash/find"; import ConnectionTerminated from "./ConnectionTerminated"; import GitOps from "./components/clusters/GitOps"; import PreflightResultPage from "./components/PreflightResultPage"; import AppConfig from "./features/AppConfig/components/AppConfig"; -import { AppDetailPage } from "./components/apps/AppDetailPage"; +import {AppDetailPage} from "./components/apps/AppDetailPage"; import KurlClusterManagement from "./components/apps/KurlClusterManagement"; -import HelmVMClusterManagement from "./components/apps/HelmVMClusterManagement"; +import EmbeddedClusterManagement from "@components/apps/EmbeddedClusterManagement"; import UnsupportedBrowser from "./components/static/UnsupportedBrowser"; import NotFound from "./components/static/NotFound"; -import { Utilities, parseUpstreamUri } from "./utilities/utilities"; +import {parseUpstreamUri, Utilities} from "./utilities/utilities"; import fetch from "./utilities/fetchWithTimeout"; -import { SecureAdminConsole } from "@features/Auth"; +import {SecureAdminConsole} from "@features/Auth"; import UploadLicenseFile from "./components/UploadLicenseFile"; import BackupRestore from "./components/BackupRestore"; import UploadAirgapBundle from "./components/UploadAirgapBundle"; import RestoreCompleted from "./components/RestoreCompleted"; import Access from "./components/identity/Access"; import SnapshotsWrapper from "./components/snapshots/SnapshotsWrapper"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { InstallWithHelm } from "@features/AddNewApp"; +import {QueryClient, QueryClientProvider} from "@tanstack/react-query"; +import {InstallWithHelm} from "@features/AddNewApp"; import DownstreamTree from "./components/tree/KotsApplicationTree"; -import { Dashboard } from "@features/Dashboard/components/Dashboard"; +import {Dashboard} from "@features/Dashboard/components/Dashboard"; import AppVersionHistory from "@components/apps/AppVersionHistory"; import AppLicense from "@components/apps/AppLicense"; import AppRegistrySettings from "@components/apps/AppRegistrySettings"; @@ -42,8 +42,8 @@ import "./index.css"; import connectHistory from "./services/matomo"; // types -import { App, Metadata, ThemeState } from "@types"; -import { ToastProvider } from "./context/ToastContext"; +import {App, Metadata, ThemeState} from "@types"; +import {ToastProvider} from "./context/ToastContext"; import Redactors from "@components/redactors/Redactors"; import EditRedactor from "@components/redactors/EditRedactor"; import SupportBundleAnalysis from "@components/troubleshoot/SupportBundleAnalysis"; @@ -58,7 +58,7 @@ import SnapshotDetails from "@components/snapshots/SnapshotDetails"; import SnapshotRestore from "@components/snapshots/SnapshotRestore"; import AppSnapshots from "@components/snapshots/AppSnapshots"; import AppSnapshotRestore from "@components/snapshots/AppSnapshotRestore"; -import HelmVMViewNode from "@components/apps/HelmVMViewNode"; +import EmbeddedClusterViewNode from "@components/apps/EmbeddedClusterViewNode"; // react-query client const queryClient = new QueryClient(); @@ -467,7 +467,7 @@ const Root = () => { refetchAppsList={getAppsList} fetchingMetadata={state.fetchingMetadata} isKurlEnabled={Boolean(state.adminConsoleMetadata?.isKurl)} - isHelmVMEnabled={Boolean(state.adminConsoleMetadata?.isHelmVM)} + isEmbeddedClusterEnabled={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)} isGitOpsSupported={isGitOpsSupported()} isIdentityServiceSupported={isIdentityServiceSupported()} appsList={state.appsList} @@ -532,7 +532,7 @@ const Root = () => { appSlugFromMetadata={state.appSlugFromMetadata || ""} fetchingMetadata={state.fetchingMetadata} onUploadSuccess={getAppsList} - isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)} + isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)} /> } /> @@ -575,33 +575,33 @@ const Root = () => { } /> } /> - {state.adminConsoleMetadata?.isHelmVM && ( + {state.adminConsoleMetadata?.isEmbeddedCluster && ( <> } + element={} /> } + element={} /> )} {(state.adminConsoleMetadata?.isKurl || - state.adminConsoleMetadata?.isHelmVM) && ( + state.adminConsoleMetadata?.isEmbeddedCluster) && ( ) : ( - + ) } /> )} - {state.adminConsoleMetadata?.isHelmVM && ( - } /> + {state.adminConsoleMetadata?.isEmbeddedCluster && ( + } /> )} { snapshotInProgressApps={state.snapshotInProgressApps} ping={ping} isHelmManaged={state.isHelmManaged} - isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)} + isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)} /> } /> @@ -708,7 +708,7 @@ const Root = () => { snapshotInProgressApps={state.snapshotInProgressApps} ping={ping} isHelmManaged={state.isHelmManaged} - isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)} + isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)} /> } > diff --git a/web/src/components/UploadLicenseFile.tsx b/web/src/components/UploadLicenseFile.tsx index e08cf5b829..5ac80978f1 100644 --- a/web/src/components/UploadLicenseFile.tsx +++ b/web/src/components/UploadLicenseFile.tsx @@ -1,5 +1,5 @@ -import React, { useEffect, useReducer } from "react"; -import { Link, useNavigate } from "react-router-dom"; +import React, {useEffect, useReducer} from "react"; +import {Link, useNavigate} from "react-router-dom"; import yaml from "js-yaml"; import isEmpty from "lodash/isEmpty"; import keyBy from "lodash/keyBy"; @@ -10,8 +10,8 @@ import Dropzone from "react-dropzone"; import Modal from "react-modal"; import Select from "react-select"; -import { KotsPageTitle } from "@components/Head"; -import { getFileContent } from "../utilities/utilities"; +import {KotsPageTitle} from "@components/Head"; +import {getFileContent} from "../utilities/utilities"; import Icon from "./Icon"; import LicenseUploadProgress from "./LicenseUploadProgress"; import CodeSnippet from "./shared/CodeSnippet"; @@ -67,7 +67,7 @@ type Props = { onUploadSuccess: () => Promise; logo: string | null; snapshot?: { name: string }; - isHelmVM: boolean; + isEmbeddedCluster: boolean; }; const UploadLicenseFile = (props: Props) => { @@ -261,7 +261,7 @@ const UploadLicenseFile = (props: Props) => { return; } - if (props.isHelmVM) { + if (props.isEmbeddedCluster) { navigate(`/${data.slug}/cluster/manage`, { replace: true }); return; } diff --git a/web/src/components/apps/AppDetailPage.tsx b/web/src/components/apps/AppDetailPage.tsx index 46fbe7a2e2..2617344f91 100644 --- a/web/src/components/apps/AppDetailPage.tsx +++ b/web/src/components/apps/AppDetailPage.tsx @@ -1,11 +1,10 @@ -import React, { Fragment, useReducer, useEffect, useState } from "react"; +import React, {Fragment, useEffect, useReducer, useState} from "react"; import classNames from "classnames"; -import { useNavigate, useParams, Outlet } from "react-router-dom"; +import {Outlet, useNavigate, useParams} from "react-router-dom"; import Modal from "react-modal"; -import { useTheme } from "@src/components/context/withTheme"; -import { KotsSidebarItem } from "@src/components/watches/WatchSidebarItem"; -import { HelmChartSidebarItem } from "@src/components/watches/WatchSidebarItem"; -import { isAwaitingResults } from "../../utilities/utilities"; +import {useTheme} from "@src/components/context/withTheme"; +import {HelmChartSidebarItem, KotsSidebarItem} from "@src/components/watches/WatchSidebarItem"; +import {isAwaitingResults} from "../../utilities/utilities"; import SubNavBar from "@src/components/shared/SubNavBar"; import SidebarLayout from "../layout/SidebarLayout/SidebarLayout"; @@ -15,8 +14,8 @@ import Loader from "../shared/Loader"; import ErrorModal from "../modals/ErrorModal"; // Types -import { App, Metadata, KotsParams, Version } from "@types"; -import { useApps, useSelectedApp } from "@features/App"; +import {App, KotsParams, Metadata, Version} from "@types"; +import {useApps, useSelectedApp} from "@features/App"; type Props = { adminConsoleMetadata?: Metadata; @@ -30,7 +29,7 @@ type Props = { refetchAppsList: () => void; refetchAppMetadata: () => void; snapshotInProgressApps: string[]; - isHelmVM: boolean; + isEmbeddedCluster: boolean; }; type State = { @@ -322,12 +321,12 @@ function AppDetailPage(props: Props) { const firstVersion = downstream.pendingVersions.find( (version: Version) => version?.sequence === 0 ); - if (firstVersion?.status === "unknown" && props.isHelmVM) { + if (firstVersion?.status === "unknown" && props.isEmbeddedCluster) { navigate(`/${appNeedsConfiguration.slug}/cluster/manage`); return; } if (firstVersion?.status === "pending_config") { - if (props.isHelmVM) { + if (props.isEmbeddedCluster) { navigate(`/${appNeedsConfiguration.slug}/cluster/manage`); return; } diff --git a/web/src/components/apps/AppVersionHistory.tsx b/web/src/components/apps/AppVersionHistory.tsx index f39ff953ef..e0280f27f7 100644 --- a/web/src/components/apps/AppVersionHistory.tsx +++ b/web/src/components/apps/AppVersionHistory.tsx @@ -1,5 +1,5 @@ -import React, { Component } from "react"; -import { Link } from "react-router-dom"; +import React, {Component} from "react"; +import {Link} from "react-router-dom"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; import Modal from "react-modal"; @@ -14,31 +14,31 @@ import ShowDetailsModal from "@src/components/modals/ShowDetailsModal"; import ShowLogsModal from "@src/components/modals/ShowLogsModal"; import AirgapUploadProgress from "@src/features/Dashboard/components/AirgapUploadProgress"; import ErrorModal from "../modals/ErrorModal"; -import { AppVersionHistoryRow } from "@features/AppVersionHistory/AppVersionHistoryRow"; +import {AppVersionHistoryRow} from "@features/AppVersionHistory/AppVersionHistoryRow"; import DeployWarningModal from "../shared/modals/DeployWarningModal"; import AutomaticUpdatesModal from "@src/components/modals/AutomaticUpdatesModal"; import SkipPreflightsModal from "../shared/modals/SkipPreflightsModal"; import { - Utilities, + getCommitHashFromUrl, + getGitProviderDiffUrl, + getPreflightResultState, isAwaitingResults, secondsAgo, - getPreflightResultState, - getGitProviderDiffUrl, - getCommitHashFromUrl, + Utilities, } from "../../utilities/utilities"; -import { Repeater } from "../../utilities/repeater"; -import { AirgapUploader } from "../../utilities/airgapUploader"; +import {Repeater} from "../../utilities/repeater"; +import {AirgapUploader} from "../../utilities/airgapUploader"; import ReactTooltip from "react-tooltip"; import Pager from "../shared/Pager"; -import { HelmDeployModal } from "../shared/modals/HelmDeployModal"; -import { UseDownloadValues } from "../hooks"; -import { KotsPageTitle } from "@components/Head"; +import {HelmDeployModal} from "../shared/modals/HelmDeployModal"; +import {UseDownloadValues} from "../hooks"; +import {KotsPageTitle} from "@components/Head"; import "@src/scss/components/apps/AppVersionHistory.scss"; -import { DashboardGitOpsCard } from "@features/Dashboard"; +import {DashboardGitOpsCard} from "@features/Dashboard"; import Icon from "../Icon"; -import { App, Version, VersionDownloadStatus } from "@types"; -import { RouterProps, withRouter } from "@src/utilities/react-router-utilities"; +import {App, Version, VersionDownloadStatus} from "@types"; +import {RouterProps, withRouter} from "@src/utilities/react-router-utilities"; import PreflightIcon from "@features/App/PreflightIcon"; dayjs.extend(relativeTime); @@ -59,7 +59,7 @@ type Props = { adminConsoleMetadata: { isAirgap: boolean; isKurl: boolean; - isHelmVM: boolean; + isEmbeddedCluster: boolean; }; app: App; displayErrorModal: boolean; diff --git a/web/src/components/apps/HelmVMClusterManagement.tsx b/web/src/components/apps/EmbeddedClusterManagement.tsx similarity index 96% rename from web/src/components/apps/HelmVMClusterManagement.tsx rename to web/src/components/apps/EmbeddedClusterManagement.tsx index f801d0c1e2..58ef48fee7 100644 --- a/web/src/components/apps/HelmVMClusterManagement.tsx +++ b/web/src/components/apps/EmbeddedClusterManagement.tsx @@ -12,7 +12,7 @@ import {Utilities} from "../../utilities/utilities"; import Icon from "../Icon"; import CodeSnippet from "../shared/CodeSnippet"; -import "@src/scss/components/apps/HelmVMClusterManagement.scss"; +import "@src/scss/components/apps/EmbeddedClusterManagement.scss"; const testData = { nodes: undefined, @@ -43,7 +43,7 @@ const testData = { // }, // ], // ha: true, -// isHelmVMEnabled: true, +// isEmbeddedClusterEnabled: true, // }; type State = { @@ -56,7 +56,7 @@ type State = { drainNodeSuccessful: boolean; }; -const HelmVMClusterManagement = ({ +const EmbeddedClusterManagement = ({ fromLicenseFlow = false, }: { fromLicenseFlow?: boolean; @@ -87,7 +87,7 @@ const HelmVMClusterManagement = ({ // #region queries type NodesResponse = { ha: boolean; - isHelmVMEnabled: boolean; + isEmbeddedClusterEnabled: boolean; nodes: { name: string; isConnected: boolean; @@ -122,9 +122,9 @@ const HelmVMClusterManagement = ({ isInitialLoading: nodesLoading, error: nodesError, } = useQuery({ - queryKey: ["helmVmNodes"], + queryKey: ["embeddedClusterNodes"], queryFn: async () => { - const res = await fetch(`${process.env.API_ENDPOINT}/helmvm/nodes`, { + const res = await fetch(`${process.env.API_ENDPOINT}/embedded-cluster/nodes`, { headers: { Accept: "application/json", }, @@ -168,7 +168,7 @@ const HelmVMClusterManagement = ({ queryFn: async ({ queryKey }) => { const [, nodeTypes] = queryKey; const res = await fetch( - `${process.env.API_ENDPOINT}/helmvm/generate-node-join-command`, + `${process.env.API_ENDPOINT}/embedded-cluster/generate-node-join-command`, { headers: { "Content-Type": "application/json", @@ -334,7 +334,7 @@ const HelmVMClusterManagement = ({ // #endregion return ( -
+

@@ -517,4 +517,4 @@ const HelmVMClusterManagement = ({ ); }; -export default HelmVMClusterManagement; +export default EmbeddedClusterManagement; diff --git a/web/src/components/apps/HelmVMViewNode.jsx b/web/src/components/apps/EmbeddedClusterViewNode.jsx similarity index 96% rename from web/src/components/apps/HelmVMViewNode.jsx rename to web/src/components/apps/EmbeddedClusterViewNode.jsx index f7b3452524..9481e33436 100644 --- a/web/src/components/apps/HelmVMViewNode.jsx +++ b/web/src/components/apps/EmbeddedClusterViewNode.jsx @@ -36,14 +36,14 @@ const testData = undefined; // ], // }; -const HelmVMViewNode = () => { +const EmbeddedClusterViewNode = () => { const { slug, nodeName } = useParams(); const { data: nodeData, isLoading: nodeLoading } = useQuery({ - queryKey: ["helmVmNode", nodeName], + queryKey: ["embeddedClusterNode", nodeName], queryFn: async ({ queryKey }) => { const [, nodeName] = queryKey; return ( - await fetch(`${process.env.API_ENDPOINT}/helmvm/node/${nodeName}`, { + await fetch(`${process.env.API_ENDPOINT}/embedded-cluster/node/${nodeName}`, { headers: { Accept: "application/json", }, @@ -239,4 +239,4 @@ const HelmVMViewNode = () => { ); }; -export default HelmVMViewNode; +export default EmbeddedClusterViewNode; diff --git a/web/src/components/apps/HelmVMNodeRow.test.js b/web/src/components/apps/EmbeddedClustrNodeRow.test.js similarity index 57% rename from web/src/components/apps/HelmVMNodeRow.test.js rename to web/src/components/apps/EmbeddedClustrNodeRow.test.js index b7a4d8324c..18b6d130ad 100644 --- a/web/src/components/apps/HelmVMNodeRow.test.js +++ b/web/src/components/apps/EmbeddedClustrNodeRow.test.js @@ -1,3 +1,3 @@ -describe("HelmVMNodeRow", () => { +describe("EmbeddedClusterNodeRow", () => { it.todo("upgrade to react 18 and add unit tests"); }); diff --git a/web/src/components/shared/NavBar.tsx b/web/src/components/shared/NavBar.tsx index 09c6dc2c9d..109c74df5e 100644 --- a/web/src/components/shared/NavBar.tsx +++ b/web/src/components/shared/NavBar.tsx @@ -1,14 +1,14 @@ -import React, { PureComponent } from "react"; +import React, {PureComponent} from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; -import { withRouter, RouterProps } from "@src/utilities/react-router-utilities"; -import { Link } from "react-router-dom"; -import { Utilities } from "@src/utilities/utilities"; +import {RouterProps, withRouter} from "@src/utilities/react-router-utilities"; +import {Link} from "react-router-dom"; +import {Utilities} from "@src/utilities/utilities"; import ErrorModal from "../modals/ErrorModal"; import NavBarDropdown from "./NavBarDropdown"; import "@src/scss/components/shared/NavBar.scss"; -import { App } from "@types"; +import {App} from "@types"; type Props = { appsList: App[]; @@ -19,7 +19,7 @@ type Props = { isHelmManaged: boolean; isIdentityServiceSupported: boolean; isKurlEnabled: boolean; - isHelmVMEnabled: boolean; + isEmbeddedClusterEnabled: boolean; isSnapshotsSupported: boolean; logo: string | null; onLogoutError: (message: string) => void; @@ -144,7 +144,7 @@ export class NavBar extends PureComponent { className, fetchingMetadata, isKurlEnabled, - isHelmVMEnabled, + isEmbeddedClusterEnabled, isGitOpsSupported, isIdentityServiceSupported, appsList, @@ -228,7 +228,7 @@ export class NavBar extends PureComponent {

)} - {(isKurlEnabled || isHelmVMEnabled) && + {(isKurlEnabled || isEmbeddedClusterEnabled) && location.pathname !== `${selectedApp?.slug}/cluster/manage` && (