Browse Source

handle onboarding flow db on provision

Justin Rhee 3 năm trước cách đây
mục cha
commit
96ec19816c

+ 3 - 1
dashboard/src/components/ProvisionerSettings.tsx

@@ -2,6 +2,7 @@ import React, { useEffect, useState, useContext } from "react";
 import styled from "styled-components";
 import { RouteComponentProps, withRouter } from "react-router";
 
+import { OFState } from "main/home/onboarding/state";
 import api from "shared/api";
 import { Context } from "shared/Context";
 import { pushFiltered } from "shared/routing";
@@ -129,8 +130,9 @@ const ProvisionerSettings: React.FC<Props> = props => {
           .then(({ data }) => {
             data.forEach((cluster: ClusterType) => {
               if (cluster.id === res.data.cluster_id) {
-                setHasFinishedOnboarding(true);
+                // setHasFinishedOnboarding(true);
                 setCurrentCluster(cluster);
+                OFState.actions.goTo("clean_up");
                 pushFiltered(props, "/cluster-dashboard", ["project_id"], {
                   cluster: cluster.name,
                 });

+ 33 - 16
dashboard/src/main/home/cluster-dashboard/dashboard/Dashboard.tsx

@@ -176,6 +176,38 @@ export const Dashboard: React.FunctionComponent = () => {
     updateClusterWithDetailedData();
   }, []);
 
+  const renderContents = () => {
+    if (context.currentProject.capi_provisioner_enabled) {
+      return (
+        <>
+          {(
+            context.currentCluster.status === "UPDATING" ||
+            context.currentCluster.status === "UPDATING_UNAVAILABLE"
+          ) && (
+            <ProvisionerStatus />
+          )}
+          <TabSelector
+            options={currentTabOptions}
+            currentTab={currentTab}
+            setCurrentTab={(value: TabEnum) => setCurrentTab(value)}
+          />
+          {renderTab()}
+        </>
+      );
+    } else {
+      return (
+        <>
+          <TabSelector
+            options={currentTabOptions}
+            currentTab={currentTab}
+            setCurrentTab={(value: TabEnum) => setCurrentTab(value)}
+          />
+          {renderTab()}
+        </>
+      );
+    }
+  };
+
   return (
     <>
       <DashboardHeader
@@ -203,22 +235,7 @@ export const Dashboard: React.FunctionComponent = () => {
       </InfoSection>
       */}
 
-      {
-        context.currentProject.capi_provisioner_enabled &&
-        (
-          context.currentCluster.status === "UPDATING" ||
-          context.currentCluster.status === "UPDATING_UNAVAILABLE"
-        ) && (
-          <ProvisionerStatus />
-        )
-      }
-
-      <TabSelector
-        options={currentTabOptions}
-        currentTab={currentTab}
-        setCurrentTab={(value: TabEnum) => setCurrentTab(value)}
-      />
-      {renderTab()}
+      {renderContents()}
     </>
   );
 };