Browse Source

add path to telemetry for get github contents (#3904)

Feroze Mohideen 2 years ago
parent
commit
a7a430ccdf

+ 1 - 0
api/server/handlers/gitinstallation/get_contents.go

@@ -66,6 +66,7 @@ func (c *GithubGetContentsHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ
 		telemetry.AttributeKV{Key: "repo-owner", Value: owner},
 		telemetry.AttributeKV{Key: "repo-name", Value: name},
 		telemetry.AttributeKV{Key: "repo-branch", Value: branch},
+		telemetry.AttributeKV{Key: "repo-path", Value: request.Dir},
 	)
 
 	repoContentOptions := github.RepositoryContentGetOptions{}

+ 4 - 0
dashboard/src/lib/hooks/useGithubContents.ts

@@ -22,6 +22,10 @@ const githubContentsValidator = z.discriminatedUnion("type", [
         path: z.string(),
         type: z.literal("dir"),
     }),
+    z.object({
+        path: z.string(),
+        type: z.literal("symlink"),
+    }),
 ]);
 type GithubContents = z.infer<typeof githubContentsValidator>;
 

+ 11 - 0
dashboard/src/main/home/app-dashboard/validate-apply/build-settings/FileSelector.tsx

@@ -100,6 +100,17 @@ const FileSelector: React.FC<Props> = ({
                                     {relativePath}
                                 </Item>
                             ))
+                            .with({ type: "symlink" }, (content) => (
+                                <FileItem 
+                                    key={i} 
+                                    onClick={() => ({})}
+                                    isHeaderItem={false}
+                                    isFileSelectable={false}
+                                >
+                                    <img src={folder} />
+                                    {relativePath}
+                                </FileItem>
+                            ))
                         .exhaustive();
                     }
                 )}