Przeglądaj źródła

Parse gitlab detect response

jnfrati 4 lat temu
rodzic
commit
76a1ed99c2

+ 22 - 11
dashboard/src/components/repo-selector/ContentsList.tsx

@@ -68,17 +68,28 @@ export default class ContentsList extends Component<PropsType, StateType> {
     const { actionConfig, branch } = this.props;
 
     if (actionConfig.kind === "gitlab") {
-      return api.getGitlabFolderContent(
-        "<token>",
-        { dir: this.state.currentDir || "./" },
-        {
-          project_id: currentProject.id,
-          integration_id: actionConfig.gitlab_integration_id,
-          repo_owner: actionConfig.git_repo.split("/")[0],
-          repo_name: actionConfig.git_repo.split("/")[1],
-          branch: branch,
-        }
-      );
+      return api
+        .getGitlabFolderContent(
+          "<token>",
+          { dir: this.state.currentDir || "./" },
+          {
+            project_id: currentProject.id,
+            integration_id: actionConfig.gitlab_integration_id,
+            repo_owner: actionConfig.git_repo.split("/")[0],
+            repo_name: actionConfig.git_repo.split("/")[1],
+            branch: branch,
+          }
+        )
+        .then((res) => {
+          const { data } = res;
+
+          return {
+            data: data.map((x: FileType) => ({
+              ...x,
+              type: x.type === "tree" ? "dir" : "file",
+            })),
+          };
+        });
     }
     return api.getBranchContents(
       "<token>",