jusrhee 4 лет назад
Родитель
Сommit
db02a3274a

+ 9 - 18
dashboard/src/main/home/launch/launch-flow/LaunchFlow.tsx

@@ -68,17 +68,17 @@ const LaunchFlow: React.FC<PropsType> = (props) => {
   };
 
   const getFullActionConfig = (): FullActionConfigType => {
-    let imageRepoUri = `${selectedRegistry.url}/${templateName}-${selectedNamespace}`;
+    let imageRepoUri = `${selectedRegistry?.url}/${templateName}-${selectedNamespace}`;
 
     // DockerHub registry integration is per repo
-    if (selectedRegistry.service === "dockerhub") {
-      imageRepoUri = selectedRegistry.url;
+    if (selectedRegistry?.service === "dockerhub") {
+      imageRepoUri = selectedRegistry?.url;
     }
 
     return {
       git_repo: actionConfig.git_repo,
       branch: branch,
-      registry_id: selectedRegistry.id,
+      registry_id: selectedRegistry?.id,
       dockerfile_path: dockerfilePath,
       folder_path: folderPath,
       image_repo_uri: imageRepoUri,
@@ -324,21 +324,8 @@ const LaunchFlow: React.FC<PropsType> = (props) => {
 
     setRandomNameIfEmpty();
 
-    if (currentPage === "workflow" && currentTab === "porter") {
-      const fullActionConfig = getFullActionConfig();
-      return (
-        <WorkflowPage
-          name={templateName}
-          namespace={"default"}
-          fullActionConfig={fullActionConfig}
-          shouldCreateWorkflow={shouldCreateWorkflow}
-          setShouldCreateWorkflow={setShouldCreateWorkflow}
-          setPage={setCurrentPage}
-        />
-      );
-    }
-
     // Display main (non-source) settings page
+    const fullActionConfig = getFullActionConfig();
     return (
       <SettingsPage
         onSubmit={currentTab === "porter" ? handleSubmit : handleSubmitAddon}
@@ -353,6 +340,10 @@ const LaunchFlow: React.FC<PropsType> = (props) => {
         form={form}
         valuesToOverride={valuesToOverride}
         clearValuesToOverride={() => setValuesToOverride(null)}
+
+        fullActionConfig={fullActionConfig}
+        shouldCreateWorkflow={shouldCreateWorkflow}
+        setShouldCreateWorkflow={setShouldCreateWorkflow}
       />
     );
   };

+ 15 - 0
dashboard/src/main/home/launch/launch-flow/SettingsPage.tsx

@@ -10,6 +10,7 @@ import { isAlphanumeric } from "shared/common";
 
 import InputRow from "components/form-components/InputRow";
 import SaveButton from "components/SaveButton";
+import WorkflowPage from "./WorkflowPage";
 import Helper from "components/form-components/Helper";
 import PorterFormWrapper from "components/porter-form/PorterFormWrapper";
 import Selector from "components/Selector";
@@ -30,6 +31,10 @@ type PropsType = WithAuthProps & {
   selectedNamespace: string;
   setSelectedNamespace: (x: string) => void;
   saveValuesStatus: string;
+
+  setShouldCreateWorkflow: any;
+  shouldCreateWorkflow: boolean;
+  fullActionConfig: any;
 };
 
 type StateType = {
@@ -281,6 +286,16 @@ class SettingsPage extends Component<PropsType, StateType> {
               closeOverlay={true}
             />
           </ClusterSection>
+
+          <WorkflowPage
+            setPage={this.props.setPage}
+            setShouldCreateWorkflow={this.props.setShouldCreateWorkflow}
+            shouldCreateWorkflow={this.props.shouldCreateWorkflow}
+            fullActionConfig={this.props.fullActionConfig}
+            name={this.props.templateName}
+            namespace="default"
+          />
+
           {this.renderSettingsRegion()}
         </StyledSettingsPage>
       </PaddingWrapper>

+ 26 - 32
dashboard/src/main/home/launch/launch-flow/WorkflowPage.tsx

@@ -71,42 +71,36 @@ const WorkflowPage: React.FC<PropsType> = (props) => {
 
   return (
     <StyledWorkflowPage>
-      <BackButton width="155px" onClick={() => props.setPage("source")}>
-        <i className="material-icons">first_page</i>
-        Source Settings
-      </BackButton>
       <Heading>GitHub Actions</Heading>
       <Helper>
         To auto-deploy each time you push changes, Porter will write GitHub
-        Secrets and this GitHub Actions workflow to your repository.
+        Secrets and a GitHub Actions workflow to your repository.
       </Helper>
-      {renderWorkflow()}
-      <CheckboxRow
-        toggle={() => props.setShouldCreateWorkflow((x: boolean) => !x)}
-        checked={props.shouldCreateWorkflow}
-        label="Create workflow file"
-      />
-      <Helper>
-        You may copy the YAML to an existing workflow and uncheck this box to
-        prevent Porter from creating a new workflow file.
-        <GitHubActionLink show={!props.shouldCreateWorkflow}>
-          The GitHub Action can be found at{" "}
-          <a
-            href="https://github.com/porter-dev/porter-update-action"
-            target="_blank"
-          >
-            porter-dev/porter-update-action
-          </a>
-        </GitHubActionLink>
-      </Helper>
-      <Buffer />
-      <SaveButton
-        text="Continue"
-        makeFlush={true}
-        disabled={hasError}
-        onClick={() => props.setPage("settings")}
-        helper={getButtonHelper()}
-      />
+      {
+        isExpanded && (
+          <>
+          {renderWorkflow()}
+          <CheckboxRow
+            toggle={() => props.setShouldCreateWorkflow((x: boolean) => !x)}
+            checked={props.shouldCreateWorkflow}
+            label="Create workflow file"
+          />
+          <Helper>
+            You may copy the YAML to an existing workflow and uncheck this box to
+            prevent Porter from creating a new workflow file.
+            <GitHubActionLink show={!props.shouldCreateWorkflow}>
+              The GitHub Action can be found at{" "}
+              <a
+                href="https://github.com/porter-dev/porter-update-action"
+                target="_blank"
+              >
+                porter-dev/porter-update-action
+              </a>
+            </GitHubActionLink>
+          </Helper>
+          </>
+        )
+      }
     </StyledWorkflowPage>
   );
 };