Просмотр исходного кода

temporary hotfix to support general Dockerfiles (will be overridden)

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

+ 0 - 8
dashboard/src/components/repo-selector/ActionDetails.tsx

@@ -22,14 +22,6 @@ export default class ActionDetails extends Component<PropsType, StateType> {
     error: false,
   };
 
-  componentDidMount() {
-    if (this.props.actionConfig.dockerfile_path) {
-      this.setPath("/Dockerfile");
-    } else {
-      this.setPath("Dockerfile");
-    }
-  }
-
   setPath = (x: string) => {
     let { actionConfig, setActionConfig } = this.props;
     let updatedConfig = actionConfig;

+ 9 - 4
dashboard/src/components/repo-selector/ContentsList.tsx

@@ -30,12 +30,17 @@ export default class ContentsList extends Component<PropsType, StateType> {
     contents: [] as FileType[],
   };
 
-  setSubdirectory = (x: string) => {
+  setSubdirectory = (x: string, fileName?: string) => {
     let { actionConfig, setActionConfig } = this.props;
     let updatedConfig = actionConfig;
-    updatedConfig.dockerfile_path = x;
+    let path = x;
+    console.log(fileName)
+    updatedConfig.dockerfile_path = path;
     setActionConfig(updatedConfig);
     this.updateContents();
+    if (fileName?.includes("Dockerfile")) {
+      this.props.setPath();
+    }
   };
 
   updateContents = () => {
@@ -113,13 +118,13 @@ export default class ContentsList extends Component<PropsType, StateType> {
         );
       }
 
-      if (fileName === "Dockerfile") {
+      if (fileName.includes("Dockerfile")) {
         return (
           <FileItem
             key={i}
             lastItem={i === contents.length - 1}
             isADocker
-            onClick={() => this.props.setPath()}
+            onClick={() => this.setSubdirectory(item.Path, fileName)}
           >
             <img src={file} />
             {fileName}

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

@@ -81,7 +81,6 @@ export default class LaunchTemplate extends Component<PropsType, StateType> {
   createGHAction = (chartName: string, chartNamespace: string) => {
     let { currentProject, currentCluster } = this.context;
     let { actionConfig } = this.state;
-
     api
       .createGHAction(
         "<token>",