jnfrati 4 лет назад
Родитель
Сommit
50bbcb538a

+ 12 - 1
dashboard/src/main/home/onboarding/state/StepHandler.ts

@@ -93,6 +93,12 @@ const flow: FlowType = {
           url: "/onboarding/registry/test_connection",
           on: {
             continue: "provision_resources",
+            /**
+             * Enable this go_back as soon as connect registry
+             * has a proper way of listing the registries and
+             * manage them inside the step
+             */
+            // go_back: "connect_registry",
           },
         },
       },
@@ -102,7 +108,12 @@ const flow: FlowType = {
       on: {
         skip: "provision_resources.connect_own_cluster",
         continue: "provision_resources.credentials",
-        go_back: "connect_registry",
+        /**
+         * Enable this go_back as soon as connect registry
+         * has a proper way of listing the registries and
+         * manage them inside the step
+         */
+        // go_back: "connect_registry",
       },
       execute: {
         on: {

+ 2 - 1
dashboard/src/main/home/onboarding/steps/ConnectRegistry/ConnectRegistry.tsx

@@ -58,7 +58,7 @@ const ConnectRegistry: React.FC<{
           : "Link to an existing Docker registry or continue."}
       </Helper>
 
-      {provider ? (
+      {step ? (
         <FormFlowWrapper
           provider={provider}
           onSaveCredentials={onSaveCredentials}
@@ -66,6 +66,7 @@ const ConnectRegistry: React.FC<{
           onSuccess={onSuccess}
           project={project}
           currentStep={step}
+          goBack={goBack}
         />
       ) : (
         <>

+ 1 - 1
dashboard/src/main/home/onboarding/steps/ConnectRegistry/ConnectRegistryWrapper.tsx

@@ -16,7 +16,7 @@ const ConnectRegistryWrapper = () => {
       onSaveSettings={(data) => OFState.actions.nextStep("continue", data)}
       onSuccess={() => OFState.actions.nextStep("continue")}
       onSkip={() => OFState.actions.nextStep("skip")}
-      enable_go_back={snap.StepHandler.canGoBack}
+      enable_go_back={snap.StepHandler.canGoBack && !snap.StepHandler.isSubFlow}
       goBack={() => OFState.actions.nextStep("go_back")}
     />
   );

+ 4 - 2
dashboard/src/main/home/onboarding/steps/ConnectRegistry/forms/FormFlow.tsx

@@ -64,6 +64,7 @@ type Props = {
   onSuccess: () => void;
   project: { id: number; name: string };
   currentStep: "credentials" | "settings" | "test_connection";
+  goBack: () => void;
 };
 
 const FormFlowWrapper: React.FC<Props> = ({
@@ -73,6 +74,7 @@ const FormFlowWrapper: React.FC<Props> = ({
   provider,
   project,
   currentStep,
+  goBack,
 }) => {
   const nextFormStep = (
     data?: Partial<Exclude<ConnectedRegistryConfig, SkipRegistryConnection>>
@@ -106,13 +108,13 @@ const FormFlowWrapper: React.FC<Props> = ({
   return (
     <FormWrapper>
       <FormHeader>
-        <CloseButton onClick={() => alert("go back")}>
+        <CloseButton onClick={() => goBack()}>
           <i className="material-icons">keyboard_backspace</i>
         </CloseButton>
         <img src={FormTitle[provider].icon} />
         {FormTitle[provider].label}
       </FormHeader>
-      <Breadcrumb 
+      <Breadcrumb
         currentStep={currentStep}
         steps={[
           { value: "credentials", label: "Credentials" },