Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view node page, add new add node modal #4065

Merged
merged 17 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,13 @@
"webpack-merge": "5.8.0"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@grafana/data": "^8.5.16",
"@maji/react-prism": "^1.0.1",
"@monaco-editor/react": "^4.4.5",
"@mui/icons-material": "^5.14.14",
"@mui/material": "^5.14.14",
"@storybook/addon-storysource": "^6.5.16",
"accounting": "^0.4.1",
"apexcharts": "^3.24.0",
Expand All @@ -142,6 +146,7 @@
"js-yaml": "3.14.0",
"lodash": "4.17.21",
"markdown-it": "^12.3.2",
"material-react-table": "^1.15.1",
"monaco-editor": "^0.33.0",
"monaco-editor-webpack-plugin": "^7.0.1",
"node-polyfill-webpack-plugin": "^1.1.4",
Expand Down
40 changes: 32 additions & 8 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +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";

// react-query client
const queryClient = new QueryClient();
Expand Down Expand Up @@ -100,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 @@ -131,6 +134,8 @@ const Root = () => {
navbarLogo: null,
},
app: null,
isKurl: null,
isHelmVM: null,
}
);

Expand Down Expand Up @@ -302,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 @@ -531,6 +538,8 @@ const Root = () => {
appSlugFromMetadata={state.appSlugFromMetadata || ""}
fetchingMetadata={state.fetchingMetadata}
onUploadSuccess={getAppsList}
isKurl={!!state.isKurl}
isHelmVM={!!state.isHelmVM}
/>
}
/>
Expand Down Expand Up @@ -573,16 +582,36 @@ const Root = () => {
}
/>
<Route path="/unsupported" element={<UnsupportedBrowser />} />
{/* {state.adminConsoleMetadata?.isHelmVM && ( */}
<Route
path="/:slug/cluster/manage"
element={
<HelmVMClusterManagement
fromLicenseFlow={true}
appName={state.selectedAppName || undefined}
/>
}
/>
{/* )} */}
{/* {(state.adminConsoleMetadata?.isKurl ||
state.adminConsoleMetadata?.isHelmVM) && ( */}
<Route
path="/cluster/manage"
element={
state.adminConsoleMetadata?.isKurl ? (
<KurlClusterManagement appName={state.selectedAppName} />
<KurlClusterManagement />
) : (
<HelmVMClusterManagement appName={state.selectedAppName} />
<HelmVMClusterManagement />
)
}
/>
{/* )} */}
{/* {state.adminConsoleMetadata?.isHelmVM && ( */}
<Route
path="/:slug/cluster/:nodeName"
element={<HelmVMViewNode />}
/>
{/* )} */}
<Route
path="/gitops"
element={<GitOps appName={state.selectedAppName || ""} />}
Expand Down Expand Up @@ -761,12 +790,7 @@ const Root = () => {
<Route path=":slug/license" element={<AppLicense />} />
<Route
path=":slug/registry-settings"
element={
<AppRegistrySettings
// app={selectedApp}
// updateCallback={refetchData}
/>
}
element={<AppRegistrySettings />}
/>
{/* WHERE IS SELECTEDAPP */}
{state.app?.isAppIdentityServiceSupported && (
Expand Down
48 changes: 28 additions & 20 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";
// TODO: upgrade this dependency
// @ts-ignore
import Dropzone from "react-dropzone";
import { Link, useNavigate } from "react-router-dom";
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";
// TODO: upgrade this dependency
// @ts-ignore
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,11 @@ const UploadLicenseFile = (props: Props) => {
return;
}

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

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