فهرست منبع

procfile not found error

sunguroku 5 سال پیش
والد
کامیت
c8e58d2939

+ 9 - 6
dashboard/src/components/repo-selector/ActionDetails.tsx

@@ -169,21 +169,24 @@ export default class ActionDetails extends Component<PropsType, StateType> {
             <i className="material-icons">keyboard_backspace</i>
             <i className="material-icons">keyboard_backspace</i>
             Select Folder
             Select Folder
           </BackButton>
           </BackButton>
-          {this.props.selectedRegistry ? (
-            <StatusWrapper successful={true}>
-              <i className="material-icons">done</i> Source selected
-            </StatusWrapper>
-          ) : (!this.props.procfilePath && !this.props.dockerfilePath) ? (
+          {
+          
+          (!this.props.procfilePath && !this.props.dockerfilePath) ? (
             <StatusWrapper>
             <StatusWrapper>
               <i className="material-icons">error_outline</i>
               <i className="material-icons">error_outline</i>
               Procfile not detected.
               Procfile not detected.
             </StatusWrapper>
             </StatusWrapper>
+          ) : this.props.selectedRegistry ? (
+            <StatusWrapper successful={true}>
+              <i className="material-icons">done</i> Source selected
+            </StatusWrapper>
           ) : (
           ) : (
             <StatusWrapper>
             <StatusWrapper>
               <i className="material-icons">error_outline</i>A connected
               <i className="material-icons">error_outline</i>A connected
               container registry is required
               container registry is required
             </StatusWrapper>
             </StatusWrapper>
-          )}
+          )          
+          }
         </Flex>
         </Flex>
       </>
       </>
     );
     );

+ 39 - 19
dashboard/src/components/repo-selector/ContentsList.tsx

@@ -28,6 +28,7 @@ type StateType = {
   contents: FileType[];
   contents: FileType[];
   currentDir: string;
   currentDir: string;
   dockerfiles: string[];
   dockerfiles: string[];
+  processes: Record<string, string>;
 };
 };
 
 
 export default class ContentsList extends Component<PropsType, StateType> {
 export default class ContentsList extends Component<PropsType, StateType> {
@@ -37,6 +38,7 @@ export default class ContentsList extends Component<PropsType, StateType> {
     contents: [] as FileType[],
     contents: [] as FileType[],
     currentDir: "",
     currentDir: "",
     dockerfiles: [] as string[],
     dockerfiles: [] as string[],
+    processes: null as Record<string, string>,
   };
   };
 
 
   componentDidMount() {
   componentDidMount() {
@@ -87,6 +89,26 @@ export default class ContentsList extends Component<PropsType, StateType> {
 
 
         this.setState({ loading: false, error: true });
         this.setState({ loading: false, error: true });
       });
       });
+
+    api
+      .getProcfileContents(
+        "<token>",
+        { path: "./Procfile" },
+        {
+          project_id: currentProject.id,
+          git_repo_id: actionConfig.git_repo_id,
+          kind: "github",
+          owner: actionConfig.git_repo.split("/")[0],
+          name: actionConfig.git_repo.split("/")[1],
+          branch: branch,
+        }
+      )
+      .then((res) => {
+        this.setState({ processes: res.data})
+      })
+      .catch((err) => {
+        console.log(err);
+      });
   };
   };
 
 
   renderContentList = () => {
   renderContentList = () => {
@@ -192,6 +214,7 @@ export default class ContentsList extends Component<PropsType, StateType> {
 
 
   renderOverlay = () => {
   renderOverlay = () => {
     if (this.props.procfilePath) {
     if (this.props.procfilePath) {
+      let processes = Object.keys(this.state.processes);
       return (
       return (
         <Overlay>
         <Overlay>
           <BgOverlay onClick={() => this.setState({ dockerfiles: [] }, () => {
           <BgOverlay onClick={() => this.setState({ dockerfiles: [] }, () => {
@@ -208,24 +231,21 @@ export default class ContentsList extends Component<PropsType, StateType> {
             like to run?
             like to run?
           </Label>
           </Label>
           <DockerfileList>
           <DockerfileList>
-            {this.state.dockerfiles.map((dockerfile: string, i: number) => {
-              return (
-                <Row
-                  key={i}
-                  onClick={() => {
-                    console.log('ok')
-                    this.props.setProcfileProcess(
-                      'web'
-                    )
-                  }
-                  }
-                  isLast={this.state.dockerfiles.length - 1 === i}
-                >
-                  <Indicator selected={false}></Indicator>
-                  {dockerfile}
-                </Row>
-              );
-            })}
+            {
+              processes.map((process: string, i: number) => {
+                return (
+                  <Row
+                    key={i}
+                    onClick={() => { this.props.setProcfileProcess(process) }
+                    }
+                    isLast={processes.length - 1 === i}
+                  >
+                    <Indicator selected={false}></Indicator>
+                    {process}
+                  </Row>
+                );
+              })            
+            }
           </DockerfileList>
           </DockerfileList>
         </Overlay>
         </Overlay>
       );
       );
@@ -262,7 +282,7 @@ export default class ContentsList extends Component<PropsType, StateType> {
           <ConfirmButton
           <ConfirmButton
             onClick={() => {
             onClick={() => {
               this.props.setFolderPath(this.state.currentDir || "./")
               this.props.setFolderPath(this.state.currentDir || "./")
-              this.props.setProcfilePath(`${this.state.currentDir}/Procfile` || `./Procfile`)
+              this.props.setProcfilePath("./Procfile")
             }
             }
             }
             }
           >
           >

+ 8 - 8
dashboard/src/main/home/launch/expanded-template/LaunchTemplate.tsx

@@ -383,6 +383,14 @@ class LaunchTemplate extends Component<PropsType, StateType> {
       procfilePath,
       procfilePath,
     } = this.state;
     } = this.state;
 
 
+    if (
+      sourceType === "repo" &&
+      (!dockerfilePath && folderPath) &&
+      !procfilePath
+    ) {
+      return "Procfile not detected."
+    }
+
     if (!this.submitIsDisabled()) {
     if (!this.submitIsDisabled()) {
       return this.state.saveValuesStatus;
       return this.state.saveValuesStatus;
     }
     }
@@ -392,14 +400,6 @@ class LaunchTemplate extends Component<PropsType, StateType> {
       return "loading"
       return "loading"
     }
     }
 
 
-    if (
-      sourceType === "repo" &&
-      (!dockerfilePath && folderPath) &&
-      !procfilePath
-    ) {
-      return "Procfile not detected."
-    }
-
     if (
     if (
       sourceType === "repo" &&
       sourceType === "repo" &&
       (dockerfilePath || folderPath) &&
       (dockerfilePath || folderPath) &&