Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

address greptile comments

adilsond100ad22c42c
diff --git a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts
index 2b655b2d79..d5acdc7093 100644
--- a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts
+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts
@@ -434,7 +434,7 @@ export const listGitLabRootGroups = async (params: TNavigationParams): Promise<T
minAccessLevel: 20
});
- return groups.filter((g) => !g.parentId).map((g) => ({ id: g.id.toString(), name: g.name, fullPath: g.fullPath }));
+ return groups.map((g) => ({ id: g.id.toString(), name: g.name, fullPath: g.fullPath }));
} catch (error: unknown) {
if (error instanceof GitbeakerRequestError) {
throw new BadRequestError({
@@ -456,7 +456,8 @@ export const listGitLabSubgroups = async (
try {
const subgroups = await client.Groups.allSubgroups(Number(groupId), {
orderBy: "name",
- sort: "asc"
+ sort: "asc",
+ minAccessLevel: 20
});
return subgroups.map((g) => ({ id: g.id.toString(), name: g.name, fullPath: g.fullPath }));
@@ -527,7 +528,8 @@ export const searchGitLabGroupAndProject = async (
try {
const groups = await client.Groups.all({
- search
+ search,
+ minAccessLevel: 20
});
const projects = await client.Projects.all({
search,
diff --git a/backend/src/services/app-connection/gitlab/gitlab-connection-types.ts b/backend/src/services/app-connection/gitlab/gitlab-connection-types.ts
index 8f8f130e71..62048cd510 100644
--- a/backend/src/services/app-connection/gitlab/gitlab-connection-types.ts
+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-types.ts
@@ -26,13 +26,6 @@ export type TGitLabProject = {
id: string;
};
-export type TGitLabListProjectsParams = {
- owned?: boolean;
- search?: string;
- page?: number;
- perPage?: number;
-};
-
export type TGitLabAccessTokenCredentials = {
accessToken: string;
instanceUrl: string;
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx
index 9847d7fabc..eaa14780dc 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx
@@ -161,7 +161,7 @@ const SearchResultsList = ({
<BrowserRow
key={group.id}
icon={<Folder className="text-folder" />}
- label={<span className="truncate font-mono text-xs">{group.fullPath}</span>}
+ label={<span className="font-mono text-xs">{group.fullPath}</span>}
showChevron
onClick={() => onSelectGroup(group)}
/>
@@ -177,7 +177,7 @@ const SearchResultsList = ({
<BrowserRow
key={project.id}
icon={<Box />}
- label={<span className="truncate font-mono text-xs">{project.name}</span>}
+ label={<span className="font-mono text-xs">{project.name}</span>}
isSelected={project.id === selectedProjectId}
onClick={() => onSelectProject(project)}
/>
@@ -215,11 +215,9 @@ export const GitLabProjectPicker = ({
enabled: hasConnection
});
- const personalProjectsQuery = useGitLabConnectionListProjects(
- connectionId,
- { owned: true },
- { enabled: hasConnection }
- );
+ const personalProjectsQuery = useGitLabConnectionListProjects(connectionId, {
+ enabled: hasConnection
+ });
const groupsAndProjectsSearchQuery = useGitLabConnectionSearchGroupsAndProjects(
connectionId,
@@ -261,111 +259,107 @@ export const GitLabProjectPicker = ({
.slice(0, SEARCH_ITEMS_LIMIT);
return (
- <div className="flex min-w-0 flex-col gap-2">
- <div
- className={cn(
- "@container/picker flex min-w-0 flex-col gap-2 rounded-md border bg-container",
- isError ? "border-danger" : "border-border"
- )}
- >
- <div className="flex min-w-0 flex-wrap items-center gap-2 border-b border-border p-2">
- <div className="flex w-full items-center gap-0.5 rounded-md border border-border bg-bunker-700/30 p-0.5 @md/picker:inline-flex @md/picker:w-auto @md/picker:shrink-0">
- <SegmentedButton
- icon={<Folder />}
- label="Groups"
- isActive={tab === "groups"}
- count={rootGroupsQuery.data?.length}
- onClick={() => handleTabChange("groups")}
- />
- <SegmentedButton
- icon={<User />}
- label="Projects"
- isActive={tab === "yours"}
- count={personalProjects.length}
- onClick={() => handleTabChange("yours")}
- />
- </div>
- <div className="relative flex min-w-0 flex-1 items-center @md/picker:min-w-[160px]">
- <Search className="pointer-events-none absolute left-2.5 size-3.5 text-muted" />
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder={
- tab === "yours" ? "Search your projects..." : "Search groups & projects..."
- }
- className="h-8 w-full min-w-0 pr-7 pl-8 text-sm"
- disabled={!hasConnection}
- />
- {search.length > 0 && (
- <IconButton
- aria-label="Clear search"
- variant="ghost-muted"
- size="xs"
- className="absolute right-1"
- onClick={() => setSearch("")}
- >
- <X className="size-3.5" />
- </IconButton>
- )}
- </div>
+ <div
+ className={cn(
+ "@container/picker flex min-w-0 flex-col gap-2 rounded-md border bg-container",
+ isError ? "border-danger" : "border-border"
+ )}
+ >
+ <div className="flex min-w-0 flex-wrap items-center gap-2 border-b border-border p-2">
+ <div className="flex w-full items-center gap-0.5 rounded-md border border-border bg-bunker-700/30 p-0.5 @md/picker:inline-flex @md/picker:w-auto @md/picker:shrink-0">
+ <SegmentedButton
+ icon={<Folder />}
+ label="Groups"
+ isActive={tab === "groups"}
+ count={rootGroupsQuery.data?.length}
+ onClick={() => handleTabChange("groups")}
+ />
+ <SegmentedButton
+ icon={<User />}
+ label="Projects"
+ isActive={tab === "yours"}
+ count={personalProjects.length}
+ onClick={() => handleTabChange("yours")}
+ />
</div>
+ <div className="relative flex min-w-0 flex-1 items-center @md/picker:min-w-[160px]">
+ <Search className="pointer-events-none absolute left-2.5 size-3.5 text-muted" />
+ <Input
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder={
+ tab === "yours" ? "Search your projects..." : "Search groups & projects..."
+ }
+ className="h-8 w-full min-w-0 pr-7 pl-8 text-sm"
+ disabled={!hasConnection}
+ />
+ {search.length > 0 && (
+ <IconButton
+ aria-label="Clear search"
+ variant="ghost-muted"
+ size="xs"
+ className="absolute right-1"
+ onClick={() => setSearch("")}
+ >
+ <X />
+ </IconButton>
+ )}
+ </div>
+ </div>
- {!hasConnection && (
- <div
- className={cn(TREE_PICKER_SCROLL_CLASS, "px-3 py-10 text-center text-sm text-muted")}
- >
- Select a GitLab Connection above to browse projects.
- </div>
- )}
-
- {hasConnection && tab === "groups" && isSearching && (
- <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}>
- <SearchResultsList
- query={debouncedSearch}
- isLoading={groupsAndProjectsSearchQuery.isLoading || groupNameSearchQuery.isLoading}
- groups={groupNameSearchQuery.data ?? []}
- projects={searchedProjects}
- selectedProjectId={selectedProjectId}
- onSelectGroup={handleSearchGroupSelect}
- onSelectProject={handleProjectSelect}
- />
- </div>
- )}
+ {!hasConnection && (
+ <div className={cn(TREE_PICKER_SCROLL_CLASS, "px-3 py-10 text-center text-sm text-muted")}>
+ Select a GitLab Connection above to browse projects.
+ </div>
+ )}
- {hasConnection && tab === "groups" && !isSearching && (
- <TreePicker
- dataSource={treeDataSource}
- path={path}
- onPathChange={setPath}
- selectedItemId={selectedProjectId}
- onSelectItem={handleProjectSelect}
- rootLabel="Groups"
- subContainersHeading="Subgroups"
- itemsHeading="Projects"
- emptyRoot={{
- title: "No groups available.",
- description: "Your GitLab account isn't a member of any group."
- }}
- emptyContainer={{
- title: "This group is empty.",
- description: "No subgroups or projects available to your token here."
- }}
+ {hasConnection && tab === "groups" && isSearching && (
+ <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}>
+ <SearchResultsList
+ query={debouncedSearch}
+ isLoading={groupsAndProjectsSearchQuery.isLoading || groupNameSearchQuery.isLoading}
+ groups={groupNameSearchQuery.data ?? []}
+ projects={searchedProjects}
+ selectedProjectId={selectedProjectId}
+ onSelectGroup={handleSearchGroupSelect}
+ onSelectProject={handleProjectSelect}
/>
- )}
+ </div>
+ )}
- {hasConnection && tab === "yours" && (
- <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}>
- <PersonalProjectsList
- isLoading={personalProjectsQuery.isLoading}
- projects={filteredPersonalProjects}
- selectedProjectId={selectedProjectId}
- onSelect={handleProjectSelect}
- isSearching={isSearching}
- searchQuery={debouncedSearch}
- />
- </div>
- )}
- </div>
+ {hasConnection && tab === "groups" && !isSearching && (
+ <TreePicker
+ dataSource={treeDataSource}
+ path={path}
+ onPathChange={setPath}
+ selectedItemId={selectedProjectId}
+ onSelectItem={handleProjectSelect}
+ rootLabel="Groups"
+ subContainersHeading="Subgroups"
+ itemsHeading="Projects"
+ emptyRoot={{
+ title: "No groups available.",
+ description: "Your GitLab account isn't a member of any group."
+ }}
+ emptyContainer={{
+ title: "This group is empty.",
+ description: "No subgroups or projects available to your token here."
+ }}
+ />
+ )}
+
+ {hasConnection && tab === "yours" && (
+ <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}>
+ <PersonalProjectsList
+ isLoading={personalProjectsQuery.isLoading}
+ projects={filteredPersonalProjects}
+ selectedProjectId={selectedProjectId}
+ onSelect={handleProjectSelect}
+ isSearching={isSearching}
+ searchQuery={debouncedSearch}
+ />
+ </div>
+ )}
</div>
);
};
diff --git a/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx b/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx
index ff093e176f..3fb3fac0fc 100644
--- a/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx
+++ b/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx
@@ -163,10 +163,9 @@ export const TreePicker = ({
aria-label="Back"
variant="ghost-muted"
size="xs"
- className="shrink-0"
onClick={() => onPathChange(path.slice(0, -1))}
>
- <ChevronLeft className="size-3.5" />
+ <ChevronLeft />
</IconButton>
<nav
aria-label="breadcrumb"
diff --git a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx b/frontend/src/hooks/api/appConnections/gitlab/queries.tsx
index 15d4b807f0..f8a99075d6 100644
--- a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx
+++ b/frontend/src/hooks/api/appConnections/gitlab/queries.tsx
@@ -3,17 +3,12 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { appConnectionKeys } from "../queries";
-import {
- TGitLabGroup,
- TGitLabGroupTreeItem,
- TGitLabListProjectsParams,
- TGitLabProject
-} from "./types";
+import { TGitLabGroup, TGitLabGroupTreeItem, TGitLabProject } from "./types";
const gitlabConnectionKeys = {
all: [...appConnectionKeys.all, "gitlab"] as const,
- listProjects: (connectionId: string, params?: TGitLabListProjectsParams) =>
- [...gitlabConnectionKeys.all, "projects", connectionId, params ?? {}] as const,
+ listProjects: (connectionId: string) =>
+ [...gitlabConnectionKeys.all, "projects", connectionId] as const,
listGroups: (connectionId: string) =>
[...gitlabConnectionKeys.all, "groups", connectionId] as const,
listRootGroups: (connectionId: string) =>
@@ -28,17 +23,8 @@ const gitlabConnectionKeys = {
[...gitlabConnectionKeys.all, "group-projects", connectionId, groupId] as const
};
-const buildProjectsQueryParams = (params?: TGitLabListProjectsParams) => {
- const search = new URLSearchParams();
- if (params?.owned !== undefined) search.set("owned", String(params.owned));
- if (params?.search) search.set("search", params.search);
- const qs = search.toString();
- return qs ? `?${qs}` : "";
-};
-
export const useGitLabConnectionListProjects = (
connectionId: string,
- params?: TGitLabListProjectsParams,
options?: Omit<
UseQueryOptions<
TGitLabProject[],
@@ -50,10 +36,10 @@ export const useGitLabConnectionListProjects = (
>
) => {
return useQuery({
- queryKey: gitlabConnectionKeys.listProjects(connectionId, params),
+ queryKey: gitlabConnectionKeys.listProjects(connectionId),
queryFn: async () => {
const { data } = await apiRequest.get<TGitLabProject[]>(
- `/api/v1/app-connections/gitlab/${connectionId}/projects${buildProjectsQueryParams(params)}`
+ `/api/v1/app-connections/gitlab/${connectionId}/projects`
);
return data;
diff --git a/frontend/src/hooks/api/appConnections/gitlab/types.ts b/frontend/src/hooks/api/appConnections/gitlab/types.ts
index d4ae6c1a9f..25e6de00b1 100644
--- a/frontend/src/hooks/api/appConnections/gitlab/types.ts
+++ b/frontend/src/hooks/api/appConnections/gitlab/types.ts
@@ -14,11 +14,6 @@ export type TGitLabGroupTreeItem = {
fullPath: string;
};
-export type TGitLabListProjectsParams = {
- owned?: boolean;
- search?: string;
-};
-
export enum GitLabAccessTokenType {
Personal = "personal",
Project = "project",