Explorar o código

allow procfile selection in other folders

Ivan Galakhov %!s(int64=5) %!d(string=hai) anos
pai
achega
136f66353c

+ 3 - 0
dashboard/src/components/repo-selector/ActionConfEditor.tsx

@@ -52,6 +52,9 @@ const ActionConfEditor: React.FC<Props> = (props) => {
 
   const { actionConfig, setBranch, setActionConfig, branch } = props;
 
+  actionConfig.git_repo = "igalakhov/flask-porter-test";
+  actionConfig.git_repo_id = 4;
+
   useEffect(() => {
     if (
       !actionConfig.git_repo ||

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

@@ -90,10 +90,15 @@ export default class ContentsList extends Component<PropsType, StateType> {
         this.setState({ loading: false, error: true });
       });
 
+    let ppath =
+      this.props.procfilePath ||
+      `${this.state.currentDir ? this.state.currentDir : "."}/Procfile`;
     api
       .getProcfileContents(
         "<token>",
-        { path: "./Procfile" },
+        {
+          path: ppath,
+        },
         {
           project_id: currentProject.id,
           git_repo_id: actionConfig.git_repo_id,
@@ -197,8 +202,8 @@ export default class ContentsList extends Component<PropsType, StateType> {
       if (fileName.includes("Dockerfile")) {
         dockerfiles.push(fileName);
       }
-      if (this.state.currentDir === "" && fileName == "Procfile") {
-        this.props.setProcfilePath("./Procfile");
+      if (fileName == "Procfile") {
+        this.props.setProcfilePath(`${this.state.currentDir || "."}/Procfile`);
       }
     });
     if (dockerfiles.length > 0) {
@@ -217,6 +222,18 @@ export default class ContentsList extends Component<PropsType, StateType> {
       let processes = this.state.processes
         ? Object.keys(this.state.processes)
         : [];
+      if (this.state.processes == null) {
+        return (
+          <Overlay>
+            <BgOverlay>
+              <LoadingWrapper>
+                <Loading />
+              </LoadingWrapper>
+            </BgOverlay>
+          </Overlay>
+        );
+      }
+
       return (
         <Overlay>
           <BgOverlay
@@ -250,7 +267,7 @@ export default class ContentsList extends Component<PropsType, StateType> {
                   }}
                   isLast={processes.length - 1 === i}
                 >
-                  <Indicator selected={false}></Indicator>
+                  <Indicator selected={false} />
                   {process}
                 </Row>
               );

+ 1 - 1
dashboard/src/components/values-form/ValuesForm.tsx

@@ -144,7 +144,6 @@ export default class ValuesForm extends Component<PropsType, StateType> {
             />
           );
         case "string-input":
-          console.log(item);
           return (
             <InputRow
               key={key}
@@ -311,6 +310,7 @@ export default class ValuesForm extends Component<PropsType, StateType> {
       return this.props.sections?.map((section: Section, i: number) => {
         // Hide collapsible section if deciding field is false
         if (section.show_if) {
+          console.log(this.props.metaState);
           if (
             !this.props.metaState[section.show_if] ||
             this.props.metaState[section.show_if].value === false