Skip to content

Commit

Permalink
start connecting additional api calls, add test pod data
Browse files Browse the repository at this point in the history
  • Loading branch information
alicenstar committed Oct 17, 2023
1 parent fed8758 commit 33f7395
Show file tree
Hide file tree
Showing 5 changed files with 433 additions and 165 deletions.
3 changes: 0 additions & 3 deletions web/dist/README.md

This file was deleted.

20 changes: 17 additions & 3 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ type State = {
selectedAppName: string | null;
snapshotInProgressApps: string[];
themeState: ThemeState;
isKurl: boolean | null;
isHelmVM: boolean | null;
};

let interval: ReturnType<typeof setInterval> | undefined;
Expand Down Expand Up @@ -132,6 +134,8 @@ const Root = () => {
navbarLogo: null,
},
app: null,
isKurl: null,
isHelmVM: null,
}
);

Expand Down Expand Up @@ -303,6 +307,8 @@ const Root = () => {
adminConsoleMetadata: data.adminConsoleMetadata,
featureFlags: data.consoleFeatureFlags,
fetchingMetadata: false,
isKurl: data.isKurl,
isHelmVM: data.isHelmVM,
});
})
.catch((err) => {
Expand Down Expand Up @@ -532,6 +538,8 @@ const Root = () => {
appSlugFromMetadata={state.appSlugFromMetadata || ""}
fetchingMetadata={state.fetchingMetadata}
onUploadSuccess={getAppsList}
isKurl={state.isKurl}
isHelmVM={state.isHelmVM}
/>
}
/>
Expand Down Expand Up @@ -574,10 +582,16 @@ const Root = () => {
}
/>
<Route path="/unsupported" element={<UnsupportedBrowser />} />
{/* {(state.adminConsoleMetadata?.isKurl ||
state.adminConsoleMetadata?.isHelmVM) && ( */}
{/* {state.adminConsoleMetadata?.isHelmVM && ( */}
<Route
path="/cluster/manage"
element={<HelmVMClusterManagement fromLicenseFlow={true} />}
/>
{/* )} */}
{/* {(state.adminConsoleMetadata?.isKurl ||
state.adminConsoleMetadata?.isHelmVM) && ( */}
<Route
path="/:slug/cluster/manage"
element={
state.adminConsoleMetadata?.isKurl ? (
<KurlClusterManagement appName={state.selectedAppName} />
Expand All @@ -588,7 +602,7 @@ const Root = () => {
/>
{/* )} */}
{/* {state.adminConsoleMetadata?.isHelmVM && ( */}
<Route path="/cluster/:nodeId" element={<HelmVMViewNode />} />
<Route path="/cluster/:nodeName" element={<HelmVMViewNode />} />
{/* )} */}
<Route
path="/gitops"
Expand Down
45 changes: 27 additions & 18 deletions web/src/components/UploadLicenseFile.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React, { useEffect, useReducer } from "react";
import { useNavigate } from "react-router-dom";
import { Link } from "react-router-dom";
import { KotsPageTitle } from "@components/Head";
import { Link, useNavigate } from "react-router-dom";
// TODO: upgrade this dependency
// @ts-ignore
import Dropzone from "react-dropzone";
import yaml from "js-yaml";
import size from "lodash/size";
import isEmpty from "lodash/isEmpty";
import keyBy from "lodash/keyBy";
import size from "lodash/size";
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 CodeSnippet from "./shared/CodeSnippet";
import Icon from "./Icon";
import LicenseUploadProgress from "./LicenseUploadProgress";
import CodeSnippet from "./shared/CodeSnippet";

import "../scss/components/troubleshoot/UploadSupportBundleModal.scss";
import "../scss/components/UploadLicenseFile.scss";
import Icon from "./Icon";

type LicenseYaml = {
spec: {
Expand All @@ -26,17 +26,6 @@ type LicenseYaml = {
};
};

type Props = {
appsListLength: number;
appName: string;
appSlugFromMetadata: string;
fetchingMetadata: boolean;
isBackupRestore?: boolean;
onUploadSuccess: () => Promise<void>;
logo: string | null;
snapshot?: { name: string };
};

type SelectedAppToInstall = {
label: string;
value: string;
Expand Down Expand Up @@ -68,6 +57,20 @@ type UploadLicenseResponse = {
slug: string;
success?: boolean;
};

type Props = {
appsListLength: number;
appName: string;
appSlugFromMetadata: string;
fetchingMetadata: boolean;
isBackupRestore?: boolean;
onUploadSuccess: () => Promise<void>;
logo: string | null;
snapshot?: { name: string };
isHelmVM: boolean;
isKurl: boolean;
};

const UploadLicenseFile = (props: Props) => {
const [state, setState] = useReducer(
(currentState: State, newState: Partial<State>) => ({
Expand Down Expand Up @@ -264,6 +267,12 @@ const UploadLicenseFile = (props: Props) => {
return;
}

if (props.isHelmVM && !props.isKurl) {
navigate(`/${data.slug}/cluster/manage`, { replace: true });
return;
}
// cluster manage -> config -> preflights

if (data.hasPreflight) {
navigate(`/${data.slug}/preflight`, { replace: true });
return;
Expand Down
Loading

0 comments on commit 33f7395

Please sign in to comment.