Skip to content

Commit b5fcd3b

Browse files
authored
Show join command during restore in Embedded Cluster (#4826)
1 parent 70cc906 commit b5fcd3b

File tree

3 files changed

+43
-26
lines changed

3 files changed

+43
-26
lines changed

web/src/Root.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ const Root = () => {
501501
isEmbeddedClusterEnabled={Boolean(
502502
state.adminConsoleMetadata?.isEmbeddedCluster
503503
)}
504+
isEmbeddedClusterWaitingForNodes={
505+
state.isEmbeddedClusterWaitingForNodes
506+
}
504507
isGitOpsSupported={isGitOpsSupported()}
505508
isIdentityServiceSupported={isIdentityServiceSupported()}
506509
appsList={state.appsList}
@@ -636,7 +639,11 @@ const Root = () => {
636639
state.adminConsoleMetadata?.isKurl ? (
637640
<KurlClusterManagement />
638641
) : (
639-
<EmbeddedClusterManagement />
642+
<EmbeddedClusterManagement
643+
isEmbeddedClusterWaitingForNodes={
644+
state.isEmbeddedClusterWaitingForNodes
645+
}
646+
/>
640647
)
641648
}
642649
/>

web/src/components/apps/EmbeddedClusterManagement.tsx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ type State = {
3131

3232
const EmbeddedClusterManagement = ({
3333
fromLicenseFlow = false,
34+
isEmbeddedClusterWaitingForNodes = false,
3435
}: {
3536
fromLicenseFlow?: boolean;
37+
isEmbeddedClusterWaitingForNodes?: boolean;
3638
}) => {
3739
const [state, setState] = useReducer(
3840
(prevState: State, newState: Partial<State>) => ({
@@ -415,11 +417,13 @@ const EmbeddedClusterManagement = ({
415417
const AddNodeInstructions = () => {
416418
return (
417419
<div className="tw-mb-2 tw-text-base">
418-
<p>
419-
Optionally add nodes to the cluster. Click{" "}
420-
<span className="tw-font-semibold">Continue </span>
421-
to proceed with a single node.
422-
</p>
420+
{Utilities.isInitialAppInstall(app) && (
421+
<p>
422+
Optionally add nodes to the cluster. Click{" "}
423+
<span className="tw-font-semibold">Continue </span>
424+
to proceed with a single node.
425+
</p>
426+
)}
423427
<p>
424428
{rolesData?.roles &&
425429
rolesData.roles.length > 1 &&
@@ -517,6 +521,9 @@ const EmbeddedClusterManagement = ({
517521
);
518522
};
519523

524+
const isInitialInstallOrRestore =
525+
Utilities.isInitialAppInstall(app) || isEmbeddedClusterWaitingForNodes;
526+
520527
return (
521528
<div className="EmbeddedClusterManagement--wrapper container u-overflow--auto u-paddingTop--50 tw-font-sans">
522529
<KotsPageTitle pageName="Cluster Management" />
@@ -525,26 +532,26 @@ const EmbeddedClusterManagement = ({
525532
Nodes
526533
</p>
527534
<div className="tw-flex tw-gap-6 tw-items-center">
528-
{" "}
529-
{!Utilities.isInitialAppInstall(app) && (
530-
<div className="tw-flex tw-gap-6">
531-
<p>
532-
View the nodes in your cluster, generate commands to add nodes
533-
to the cluster, and view workloads running on each node.
534-
</p>
535-
</div>
535+
{!isInitialInstallOrRestore && (
536+
<>
537+
<div className="tw-flex tw-gap-6">
538+
<p>
539+
View the nodes in your cluster, generate commands to add nodes
540+
to the cluster, and view workloads running on each node.
541+
</p>
542+
</div>
543+
{Utilities.sessionRolesHasOneOf([rbacRoles.CLUSTER_ADMIN]) && (
544+
<button
545+
className="btn primary tw-ml-auto tw-w-fit tw-h-fit"
546+
onClick={onAddNodeClick}
547+
>
548+
Add node
549+
</button>
550+
)}
551+
</>
536552
)}
537-
{Utilities.sessionRolesHasOneOf([rbacRoles.CLUSTER_ADMIN]) &&
538-
!Utilities.isInitialAppInstall(app) && (
539-
<button
540-
className="btn primary tw-ml-auto tw-w-fit tw-h-fit"
541-
onClick={onAddNodeClick}
542-
>
543-
Add node
544-
</button>
545-
)}
546553
</div>
547-
{Utilities.isInitialAppInstall(app) && (
554+
{isInitialInstallOrRestore && (
548555
<div className="tw-mt-4 tw-flex tw-flex-col">
549556
<AddNodeInstructions />
550557
<AddNodeCommands />

web/src/components/shared/NavBar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Props = {
1919
isIdentityServiceSupported: boolean;
2020
isKurlEnabled: boolean;
2121
isEmbeddedClusterEnabled: boolean;
22+
isEmbeddedClusterWaitingForNodes: boolean;
2223
isSnapshotsSupported: boolean;
2324
logo: string | null;
2425
onLogoutError: (message: string) => void;
@@ -144,6 +145,7 @@ export class NavBar extends PureComponent<Props, State> {
144145
fetchingMetadata,
145146
isKurlEnabled,
146147
isEmbeddedClusterEnabled,
148+
isEmbeddedClusterWaitingForNodes,
147149
isGitOpsSupported,
148150
isIdentityServiceSupported,
149151
appsList,
@@ -206,7 +208,8 @@ export class NavBar extends PureComponent<Props, State> {
206208
</div>
207209
{Utilities.isLoggedIn() &&
208210
appsList?.length > 0 &&
209-
!isInitialEmbeddedInstall && (
211+
!isInitialEmbeddedInstall &&
212+
!isEmbeddedClusterWaitingForNodes && (
210213
<div className="flex flex-auto left-items">
211214
<div
212215
className={classNames("NavItem u-position--relative flex", {
@@ -286,7 +289,7 @@ export class NavBar extends PureComponent<Props, State> {
286289
</div>
287290
)}
288291
</div>
289-
{Utilities.isLoggedIn() && (
292+
{Utilities.isLoggedIn() && !isEmbeddedClusterWaitingForNodes && (
290293
<>
291294
<NavBarDropdown
292295
handleLogOut={this.handleLogOut}

0 commit comments

Comments
 (0)