Przeglądaj źródła

Dockerfile detection fix

Soham Dessai 3 lat temu
rodzic
commit
998fc7bdf4

+ 5 - 15
dashboard/src/components/repo-selector/DetectContentsList.tsx

@@ -87,24 +87,15 @@ const DetectContentsList: React.FC<PropsType> = (props) => {
   }, [contents]);
 
   const renderContentList = () => {
-    if (loading) {
-      return (
-        <LoadingWrapper>
-          <Loading />
-        </LoadingWrapper>
-      );
-    } else if (error || !contents) {
-      return <LoadingWrapper>Error loading repo contents.</LoadingWrapper>;
-    }
-
-    return contents.map((item: FileType, i: number) => {
+    contents.map((item: FileType, i: number) => {
       let splits = item.path.split("/");
       let fileName = splits[splits.length - 1];
       if (fileName.includes("Dockerfile")) {
-        props.setDockerfilePath(fileName);
-        return <></>;
+        return false;
       }
     });
+
+    return true;
   };
 
   const fetchContents = () => {
@@ -233,8 +224,7 @@ const DetectContentsList: React.FC<PropsType> = (props) => {
   };
   return (
     <>
-      {renderContentList()}
-      {props.dockerfilePath == null || props.dockerfilePath == "" ? (
+      {renderContentList() && props.dockerfilePath != "" ? (
         <AdvancedBuildSettings
           dockerfilePath={props.dockerfilePath}
           setDockerfilePath={props.setDockerfilePath}