Skip to content

Commit

Permalink
rename frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Oct 22, 2023
1 parent 643e6a2 commit 3206e2d
Show file tree
Hide file tree
Showing 11 changed files with 321 additions and 322 deletions.
6 changes: 3 additions & 3 deletions pkg/handlers/embedded_cluster_node_join_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
50 changes: 25 additions & 25 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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";
Expand All @@ -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();
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -532,7 +532,7 @@ const Root = () => {
appSlugFromMetadata={state.appSlugFromMetadata || ""}
fetchingMetadata={state.fetchingMetadata}
onUploadSuccess={getAppsList}
isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)}
isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)}
/>
}
/>
Expand Down Expand Up @@ -575,33 +575,33 @@ const Root = () => {
}
/>
<Route path="/unsupported" element={<UnsupportedBrowser />} />
{state.adminConsoleMetadata?.isHelmVM && (
{state.adminConsoleMetadata?.isEmbeddedCluster && (
<>
<Route
path="/:slug/cluster/manage"
element={<HelmVMClusterManagement fromLicenseFlow={true} />}
element={<EmbeddedClusterManagement fromLicenseFlow={true} />}
/>
<Route
path="/:slug/cluster/:nodeName"
element={<HelmVMViewNode />}
element={<EmbeddedClusterViewNode />}
/>
</>
)}
{(state.adminConsoleMetadata?.isKurl ||
state.adminConsoleMetadata?.isHelmVM) && (
state.adminConsoleMetadata?.isEmbeddedCluster) && (
<Route
path="/cluster/manage"
element={
state.adminConsoleMetadata?.isKurl ? (
<KurlClusterManagement />
) : (
<HelmVMClusterManagement />
<EmbeddedClusterManagement />
)
}
/>
)}
{state.adminConsoleMetadata?.isHelmVM && (
<Route path="/cluster/:nodeName" element={<HelmVMViewNode />} />
{state.adminConsoleMetadata?.isEmbeddedCluster && (
<Route path="/cluster/:nodeName" element={<EmbeddedClusterViewNode />} />
)}
<Route
path="/gitops"
Expand Down Expand Up @@ -692,7 +692,7 @@ const Root = () => {
snapshotInProgressApps={state.snapshotInProgressApps}
ping={ping}
isHelmManaged={state.isHelmManaged}
isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)}
isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)}
/>
}
/>
Expand All @@ -708,7 +708,7 @@ const Root = () => {
snapshotInProgressApps={state.snapshotInProgressApps}
ping={ping}
isHelmManaged={state.isHelmManaged}
isHelmVM={Boolean(state.adminConsoleMetadata?.isHelmVM)}
isEmbeddedCluster={Boolean(state.adminConsoleMetadata?.isEmbeddedCluster)}
/>
}
>
Expand Down
12 changes: 6 additions & 6 deletions web/src/components/UploadLicenseFile.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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";
Expand Down Expand Up @@ -67,7 +67,7 @@ type Props = {
onUploadSuccess: () => Promise<void>;
logo: string | null;
snapshot?: { name: string };
isHelmVM: boolean;
isEmbeddedCluster: boolean;
};

const UploadLicenseFile = (props: Props) => {
Expand Down Expand Up @@ -261,7 +261,7 @@ const UploadLicenseFile = (props: Props) => {
return;
}

if (props.isHelmVM) {
if (props.isEmbeddedCluster) {
navigate(`/${data.slug}/cluster/manage`, { replace: true });
return;
}
Expand Down
21 changes: 10 additions & 11 deletions web/src/components/apps/AppDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand All @@ -30,7 +29,7 @@ type Props = {
refetchAppsList: () => void;
refetchAppMetadata: () => void;
snapshotInProgressApps: string[];
isHelmVM: boolean;
isEmbeddedCluster: boolean;
};

type State = {
Expand Down Expand Up @@ -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;
}
Expand Down
32 changes: 16 additions & 16 deletions web/src/components/apps/AppVersionHistory.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);
Expand All @@ -59,7 +59,7 @@ type Props = {
adminConsoleMetadata: {
isAirgap: boolean;
isKurl: boolean;
isHelmVM: boolean;
isEmbeddedCluster: boolean;
};
app: App;
displayErrorModal: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -43,7 +43,7 @@ const testData = {
// },
// ],
// ha: true,
// isHelmVMEnabled: true,
// isEmbeddedClusterEnabled: true,
// };

type State = {
Expand All @@ -56,7 +56,7 @@ type State = {
drainNodeSuccessful: boolean;
};

const HelmVMClusterManagement = ({
const EmbeddedClusterManagement = ({
fromLicenseFlow = false,
}: {
fromLicenseFlow?: boolean;
Expand Down Expand Up @@ -87,7 +87,7 @@ const HelmVMClusterManagement = ({
// #region queries
type NodesResponse = {
ha: boolean;
isHelmVMEnabled: boolean;
isEmbeddedClusterEnabled: boolean;
nodes: {
name: string;
isConnected: boolean;
Expand Down Expand Up @@ -122,9 +122,9 @@ const HelmVMClusterManagement = ({
isInitialLoading: nodesLoading,
error: nodesError,
} = useQuery<NodesResponse, Error, NodesResponse>({
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",
},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -334,7 +334,7 @@ const HelmVMClusterManagement = ({
// #endregion

return (
<div className="HelmVMClusterManagement--wrapper container u-overflow--auto u-paddingTop--50 tw-font-sans">
<div className="EmbeddedClusterManagement--wrapper container u-overflow--auto u-paddingTop--50 tw-font-sans">
<KotsPageTitle pageName="Cluster Management" />
<div className="flex1 tw-mb-10 tw-flex tw-flex-col tw-gap-4 card-bg">
<p className="flex-auto u-fontSize--larger u-fontWeight--bold u-textColor--primary">
Expand Down Expand Up @@ -517,4 +517,4 @@ const HelmVMClusterManagement = ({
);
};

export default HelmVMClusterManagement;
export default EmbeddedClusterManagement;
Loading

0 comments on commit 3206e2d

Please sign in to comment.