Skip to content

Commit

Permalink
Embedded Cluster: Improve UX for license installation process (#4799)
Browse files Browse the repository at this point in the history
  • Loading branch information
miaawong authored Aug 7, 2024
1 parent 0785f4c commit 8174de5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions web/src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import AppSnapshots from "@components/snapshots/AppSnapshots";
import AppSnapshotRestore from "@components/snapshots/AppSnapshotRestore";
import EmbeddedClusterViewNode from "@components/apps/EmbeddedClusterViewNode";
import UpgradeStatusModal from "@components/modals/UpgradeStatusModal";
import AppLoading from "@components/apps/AppLoading";

// react-query client
const queryClient = new QueryClient();
Expand Down Expand Up @@ -573,6 +574,7 @@ const Root = () => {
/>
}
/>
<Route path="/cluster/loading" element={<AppLoading />} />
<Route path="/install-with-helm" element={<InstallWithHelm />} />
<Route
path="/restore"
Expand Down
5 changes: 4 additions & 1 deletion web/src/components/UploadLicenseFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ const UploadLicenseFile = (props: Props) => {
if (appsListLength > 0 && isEmbeddedCluster) {
navigate(`/app/${appSlugFromMetadata}`, { replace: true });
}
}, [props.appsListLength]);
if (appsListLength === 0 && isEmbeddedCluster) {
navigate(`/cluster/loading`, { replace: true });
}
}, [props.appsListLength, props.isEmbeddedCluster]);

const exchangeRliFileForLicense = async (content: string) => {
return new Promise((resolve, reject) => {
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/apps/AppDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ function AppDetailPage(props: Props) {
// navigate to first app if available
if (appsList && appsList?.length > 0) {
navigate(`/app/${appsList[0].slug}`, { replace: true });
} else if (Utilities.isLoggedIn()) {
} else if (Utilities.isLoggedIn() && !props.isEmbeddedCluster) {
navigate("/upload-license", { replace: true });
} else if (Utilities.isLoggedIn() && props.isEmbeddedCluster) {
navigate("/cluster/loading", { replace: true });
} else {
navigate("/secure-console", { replace: true });
}
Expand Down
27 changes: 27 additions & 0 deletions web/src/components/apps/AppLoading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useApps } from "@features/App";
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";

const AppLoading = () => {
const navigate = useNavigate();

const { data: appsData } = useApps({ refetchInterval: 3000 });

const { apps: appsList } = appsData || {};

useEffect(() => {
// if no apps are present, return
if (appsList?.length === 0) {
return;
} else {
navigate("/");
}
}, [appsData]);
return (
<div className="flex justifyContent--center alignItems--center tw-h-full">
<p>Waiting for license to install...</p>
</div>
);
};

export default AppLoading;

0 comments on commit 8174de5

Please sign in to comment.