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

Show join command during restore in Embedded Cluster #4826

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
9 changes: 8 additions & 1 deletion web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ const Root = () => {
isEmbeddedClusterEnabled={Boolean(
state.adminConsoleMetadata?.isEmbeddedCluster
)}
isEmbeddedClusterWaitingForNodes={
state.isEmbeddedClusterWaitingForNodes
}
isGitOpsSupported={isGitOpsSupported()}
isIdentityServiceSupported={isIdentityServiceSupported()}
appsList={state.appsList}
Expand Down Expand Up @@ -636,7 +639,11 @@ const Root = () => {
state.adminConsoleMetadata?.isKurl ? (
<KurlClusterManagement />
) : (
<EmbeddedClusterManagement />
<EmbeddedClusterManagement
isEmbeddedClusterWaitingForNodes={
state.isEmbeddedClusterWaitingForNodes
}
/>
)
}
/>
Expand Down
53 changes: 30 additions & 23 deletions web/src/components/apps/EmbeddedClusterManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@

const EmbeddedClusterManagement = ({
fromLicenseFlow = false,
isEmbeddedClusterWaitingForNodes = false,
}: {
fromLicenseFlow?: boolean;
isEmbeddedClusterWaitingForNodes?: boolean;
}) => {
const [state, setState] = useReducer(
(prevState: State, newState: Partial<State>) => ({
Expand Down Expand Up @@ -415,11 +417,13 @@
const AddNodeInstructions = () => {
return (
<div className="tw-mb-2 tw-text-base">
<p>
Optionally add nodes to the cluster. Click{" "}
<span className="tw-font-semibold">Continue </span>
to proceed with a single node.
</p>
{Utilities.isInitialAppInstall(app) && (
<p>
Optionally add nodes to the cluster. Click{" "}
<span className="tw-font-semibold">Continue </span>
to proceed with a single node.
</p>
)}
<p>
{rolesData?.roles &&
rolesData.roles.length > 1 &&
Expand Down Expand Up @@ -498,7 +502,7 @@
{generateAddNodeCommandError?.message}
</p>
)}
{!generateAddNodeCommandLoading && generateAddNodeCommand?.command && (

Check warning on line 505 in web/src/components/apps/EmbeddedClusterManagement.tsx

View workflow job for this annotation

GitHub Actions / lint-web

This line has a length of 81. Maximum allowed is 80
<>
<CodeSnippet
key={selectedNodeTypes.toString()}
Expand All @@ -517,6 +521,9 @@
);
};

const isInitialInstallOrRestore =
Utilities.isInitialAppInstall(app) || isEmbeddedClusterWaitingForNodes;

return (
<div className="EmbeddedClusterManagement--wrapper container u-overflow--auto u-paddingTop--50 tw-font-sans">
<KotsPageTitle pageName="Cluster Management" />
Expand All @@ -525,26 +532,26 @@
Nodes
</p>
<div className="tw-flex tw-gap-6 tw-items-center">
{" "}
{!Utilities.isInitialAppInstall(app) && (
<div className="tw-flex tw-gap-6">
<p>
View the nodes in your cluster, generate commands to add nodes
to the cluster, and view workloads running on each node.
</p>
</div>
{!isInitialInstallOrRestore && (
<>
<div className="tw-flex tw-gap-6">
<p>
View the nodes in your cluster, generate commands to add nodes
to the cluster, and view workloads running on each node.
</p>
</div>
{Utilities.sessionRolesHasOneOf([rbacRoles.CLUSTER_ADMIN]) && (
<button
className="btn primary tw-ml-auto tw-w-fit tw-h-fit"
onClick={onAddNodeClick}
>
Add node
</button>
)}
</>
)}
{Utilities.sessionRolesHasOneOf([rbacRoles.CLUSTER_ADMIN]) &&
!Utilities.isInitialAppInstall(app) && (
<button
className="btn primary tw-ml-auto tw-w-fit tw-h-fit"
onClick={onAddNodeClick}
>
Add node
</button>
)}
</div>
{Utilities.isInitialAppInstall(app) && (
{isInitialInstallOrRestore && (
<div className="tw-mt-4 tw-flex tw-flex-col">
<AddNodeInstructions />
<AddNodeCommands />
Expand Down
7 changes: 5 additions & 2 deletions web/src/components/shared/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Props = {
isIdentityServiceSupported: boolean;
isKurlEnabled: boolean;
isEmbeddedClusterEnabled: boolean;
isEmbeddedClusterWaitingForNodes: boolean;
isSnapshotsSupported: boolean;
logo: string | null;
onLogoutError: (message: string) => void;
Expand Down Expand Up @@ -144,6 +145,7 @@ export class NavBar extends PureComponent<Props, State> {
fetchingMetadata,
isKurlEnabled,
isEmbeddedClusterEnabled,
isEmbeddedClusterWaitingForNodes,
isGitOpsSupported,
isIdentityServiceSupported,
appsList,
Expand Down Expand Up @@ -206,7 +208,8 @@ export class NavBar extends PureComponent<Props, State> {
</div>
{Utilities.isLoggedIn() &&
appsList?.length > 0 &&
!isInitialEmbeddedInstall && (
!isInitialEmbeddedInstall &&
!isEmbeddedClusterWaitingForNodes && (
<div className="flex flex-auto left-items">
<div
className={classNames("NavItem u-position--relative flex", {
Expand Down Expand Up @@ -286,7 +289,7 @@ export class NavBar extends PureComponent<Props, State> {
</div>
)}
</div>
{Utilities.isLoggedIn() && (
{Utilities.isLoggedIn() && !isEmbeddedClusterWaitingForNodes && (
<>
<NavBarDropdown
handleLogOut={this.handleLogOut}
Expand Down
Loading