Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
move the gitlab picker to a generic one
adilson42f7dab23f8a
diff --git a/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.tsindex 6e4e075182..501eee0436 100644--- a/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/gitlab-connection-router.ts@@ -168,7 +168,7 @@ export const registerGitLabConnectionRouter = async (server: FastifyZodProvider)server.route({method: "GET",- url: `/:connectionId/root-groups`,+ url: `/:connectionId/groups/root`,config: {rateLimit: readLimit},diff --git a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsxindex bd8710478c..e3511fb774 100644--- a/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx+++ b/frontend/src/components/secret-scanning/forms/SecretScanningDataSourceConfigFields/GitLabDataSourceConfigFields.tsx@@ -36,12 +36,11 @@ export const GitLabDataSourceConfigFields = () => {const groupName = watch("config.groupName");const includeProjects = watch("config.includeProjects");- const { data: projectsData, isPending: isProjectsPending } = useGitLabConnectionListProjects(+ const { data: projects, isPending: isProjectsPending } = useGitLabConnectionListProjects(connectionId,- { perPage: 100 },+ undefined,{ enabled: Boolean(connectionId) });- const projects = projectsData?.items;const { data: groups, isPending: isGroupsPending } = useGitLabConnectionListGroups(connectionId, {enabled: Boolean(connectionId) && scope === GitLabDataSourceScope.Groupdiff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsxindex 04273e2bed..9847d7fabc 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabProjectPicker.tsx@@ -1,19 +1,21 @@-import { useEffect, useState } from "react";-import { Box, Check, ChevronLeft, ChevronRight, Folder, Search, User, X } from "lucide-react";+import { useState } from "react";+import { Box, Folder, Search, User, X } from "lucide-react";import {- Button,- Empty,- EmptyDescription,- EmptyTitle,+ BrowserRow,IconButton,+ InlineEmpty,Input,- Skeleton+ ListSkeleton,+ SectionHeading,+ TREE_PICKER_SCROLL_CLASS,+ TreePicker,+ TTreePickerDataSource,+ TTreePickerItem,+ TTreePickerPathEntry} from "@app/components/v3";import { cn } from "@app/components/v3/utils";import {- TGitLabGroupTreeItem,- TGitLabProject,useGitLabConnectionListGroupProjects,useGitLabConnectionListProjects,useGitLabConnectionListRootGroups,@@ -23,17 +25,10 @@ import {} from "@app/hooks/api/appConnections/gitlab";import { useDebounce } from "@app/hooks/useDebounce";-const PERSONAL_PROJECTS_PER_PAGE = 20;-const GROUPS_SEARCH_PER_PAGE = 25;+const SEARCH_ITEMS_LIMIT = 25;type TabKey = "groups" | "yours";-type BreadcrumbEntry = {- id: string;- name: string;- fullPath: string;-};-type GitLabProjectPickerProps = {connectionId: string;selectedProjectId: string;@@ -82,156 +77,6 @@ const SegmentedButton = ({</button>);-const ListSkeleton = () => (- <div className="flex flex-col gap-1 p-1">- {Array.from({ length: 5 }).map((_, i) => (- // eslint-disable-next-line react/no-array-index-key- <Skeleton key={i} className="h-8 w-full" />- ))}- </div>-);--const SectionHeading = ({ children }: { children: React.ReactNode }) => (- <div className="px-2 pt-2 pb-1 text-[10px] font-medium tracking-wider text-muted uppercase">- {children}- </div>-);--const InlineEmpty = ({ title, description }: { title: string; description?: string }) => (- <Empty className="border-0 bg-transparent p-6 shadow-none">- <EmptyTitle>{title}</EmptyTitle>- {description && <EmptyDescription>{description}</EmptyDescription>}- </Empty>-);--const BrowserRow = ({- icon,- label,- meta,- isSelected = false,- showChevron = false,- onClick-}: {- icon: React.ReactNode;- label: React.ReactNode;- meta?: React.ReactNode;- isSelected?: boolean;- showChevron?: boolean;- onClick: () => void;-}) => (- <button- type="button"- onClick={onClick}- className={cn(- "group flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition-colors",- "[&_svg]:size-3.5 [&_svg]:shrink-0",- isSelected- ? "bg-primary/10 text-foreground"- : "text-accent hover:bg-foreground/5 hover:text-foreground"- )}- >- <span className={cn("inline-flex shrink-0", isSelected ? "text-primary" : "text-muted")}>- {icon}- </span>- <span className="min-w-0 flex-1 truncate">{label}</span>- {meta != null && <span className="shrink-0 text-xs text-muted">{meta}</span>}- {showChevron && <ChevronRight className="text-muted" />}- {isSelected && !showChevron && <Check className="text-primary" />}- </button>-);--const GroupList = ({- groups,- onDrillIn,- emptyMessage,- emptyHint-}: {- groups: TGitLabGroupTreeItem[];- onDrillIn: (group: TGitLabGroupTreeItem) => void;- emptyMessage: string;- emptyHint?: string;-}) => {- if (groups.length === 0) {- return <InlineEmpty title={emptyMessage} description={emptyHint} />;- }-- return (- <div className="flex flex-col gap-0.5 p-1">- {groups.map((group) => (- <BrowserRow- key={group.id}- icon={<Folder className="text-folder" />}- label={group.name}- meta={group.fullPath !== group.name ? group.fullPath : undefined}- showChevron- onClick={() => onDrillIn(group)}- />- ))}- </div>- );-};--const GroupDetailList = ({- subgroups,- projects,- selectedProjectId,- onDrillIn,- onSelectProject-}: {- subgroups: TGitLabGroupTreeItem[];- projects: TGitLabProject[];- selectedProjectId: string;- onDrillIn: (group: TGitLabGroupTreeItem) => void;- onSelectProject: (project: TGitLabProject) => void;-}) => {- if (subgroups.length === 0 && projects.length === 0) {- return (- <InlineEmpty- title="This group is empty."- description="No subgroups or projects available to your token here."- />- );- }-- return (- <div className="flex flex-col">- {subgroups.length > 0 && (- <>- <SectionHeading>Subgroups</SectionHeading>- <div className="flex flex-col gap-0.5 p-1">- {subgroups.map((subgroup) => (- <BrowserRow- key={subgroup.id}- icon={<Folder className="text-folder" />}- label={subgroup.name}- meta={subgroup.fullPath}- showChevron- onClick={() => onDrillIn(subgroup)}- />- ))}- </div>- </>- )}- {projects.length > 0 && (- <>- <SectionHeading>Projects</SectionHeading>- <div className="flex flex-col gap-0.5 p-1">- {projects.map((project) => (- <BrowserRow- key={project.id}- icon={<Box />}- label={project.name}- isSelected={project.id === selectedProjectId}- onClick={() => onSelectProject(project)}- />- ))}- </div>- </>- )}- </div>- );-};-const PersonalProjectsList = ({isLoading,projects,@@ -241,9 +86,9 @@ const PersonalProjectsList = ({searchQuery}: {isLoading: boolean;- projects: TGitLabProject[];+ projects: TTreePickerItem[];selectedProjectId: string;- onSelect: (project: TGitLabProject) => void;+ onSelect: (project: TTreePickerItem) => void;isSearching: boolean;searchQuery: string;}) => {@@ -289,11 +134,11 @@ const SearchResultsList = ({}: {query: string;isLoading: boolean;- groups: TGitLabGroupTreeItem[];- projects: TGitLabProject[];+ groups: { id: string; fullPath: string }[];+ projects: TTreePickerItem[];selectedProjectId: string;- onSelectGroup: (group: TGitLabGroupTreeItem) => void;- onSelectProject: (project: TGitLabProject) => void;+ onSelectGroup: (group: { id: string; fullPath: string }) => void;+ onSelectProject: (project: TTreePickerItem) => void;}) => {if (isLoading) return <ListSkeleton />;@@ -351,18 +196,20 @@ export const GitLabProjectPicker = ({onChange}: GitLabProjectPickerProps) => {const [tab, setTab] = useState<TabKey>("groups");- const [breadcrumb, setBreadcrumb] = useState<BreadcrumbEntry[]>([]);+ const [path, setPath] = useState<TTreePickerPathEntry[]>([]);const [search, setSearch] = useState("");const [debouncedSearch] = useDebounce(search.trim(), 300);- const [personalPage, setPersonalPage] = useState(1);-- useEffect(() => {- setPersonalPage(1);- }, [debouncedSearch, tab]);const hasConnection = Boolean(connectionId);const isSearching = debouncedSearch.length > 0;- const currentGroup = breadcrumb[breadcrumb.length - 1] ?? null;++ const treeDataSource: TTreePickerDataSource = {+ useRootContainers: (opts) => useGitLabConnectionListRootGroups(connectionId, opts),+ useSubContainers: (groupId, opts) =>+ useGitLabConnectionListSubgroups(connectionId, groupId, opts),+ useContainerItems: (groupId, opts) =>+ useGitLabConnectionListGroupProjects(connectionId, groupId, opts)+ };const rootGroupsQuery = useGitLabConnectionListRootGroups(connectionId, {enabled: hasConnection@@ -374,24 +221,10 @@ export const GitLabProjectPicker = ({{ enabled: hasConnection });- const subgroupsQuery = useGitLabConnectionListSubgroups(connectionId, currentGroup?.id ?? "", {- enabled: hasConnection && tab === "groups" && !isSearching && Boolean(currentGroup)- });-- const groupProjectsQuery = useGitLabConnectionListGroupProjects(- connectionId,- currentGroup?.id ?? "",- {- enabled: hasConnection && tab === "groups" && !isSearching && Boolean(currentGroup)- }- );-const groupsAndProjectsSearchQuery = useGitLabConnectionSearchGroupsAndProjects(connectionId,debouncedSearch,- {- enabled: hasConnection && tab === "groups" && isSearching- }+ { enabled: hasConnection && tab === "groups" && isSearching });const groupNameSearchQuery = useGitLabConnectionSearchGroups(connectionId, debouncedSearch, {@@ -402,68 +235,30 @@ export const GitLabProjectPicker = ({if (next === tab) return;setTab(next);setSearch("");- setBreadcrumb([]);- };-- const handleDrillIn = (group: TGitLabGroupTreeItem) => {- setBreadcrumb((prev) => [- ...prev,- { id: group.id, name: group.name, fullPath: group.fullPath }- ]);- };-- const handleBreadcrumbJump = (index: number) => {- setBreadcrumb((prev) => prev.slice(0, index + 1));- };-- const handleBack = () => {- setBreadcrumb((prev) => prev.slice(0, -1));+ setPath([]);};- const handleProjectSelect = (project: TGitLabProject) => {+ const handleProjectSelect = (project: { id: string; name: string }) => {onChange({ id: project.id, name: project.name });};- const handleSearchGroupSelect = (group: TGitLabGroupTreeItem) => {+ const handleSearchGroupSelect = (group: { id: string; fullPath: string }) => {setSearch("");- setBreadcrumb([{ id: group.id, name: group.fullPath, fullPath: group.fullPath }]);+ setPath([{ id: group.id, name: group.fullPath }]);};- const isLoadingGroupsView =- tab === "groups" &&- !isSearching &&- (currentGroup- ? subgroupsQuery.isLoading || groupProjectsQuery.isLoading- : rootGroupsQuery.isLoading);-const normalizedSearch = debouncedSearch.toLowerCase();const personalProjects = personalProjectsQuery.data ?? [];const filteredPersonalProjects = personalProjects.filter((project) =>project.name.toLowerCase().includes(normalizedSearch));- const personalTotalCount = filteredPersonalProjects.length;- const personalTotalPages = Math.ceil(personalTotalCount / PERSONAL_PROJECTS_PER_PAGE);- const paginatedPersonalProjects = filteredPersonalProjects.slice(- (personalPage - 1) * PERSONAL_PROJECTS_PER_PAGE,- personalPage * PERSONAL_PROJECTS_PER_PAGE- );+const searchedGroupIds = new Set((groupNameSearchQuery.data ?? []).map((group) => group.id));- const searchedGroupProjects = (groupsAndProjectsSearchQuery.data ?? [])+ const searchedProjects = (groupsAndProjectsSearchQuery.data ?? []).filter((item) => !searchedGroupIds.has(item.id)).filter((project) => project.name.toLowerCase().includes(normalizedSearch)).map((project) => ({ id: project.id, name: project.name }))- .slice(0, GROUPS_SEARCH_PER_PAGE);-- useEffect(() => {- if (personalTotalPages === 0) {- if (personalPage !== 1) setPersonalPage(1);- return;- }-- if (personalPage > personalTotalPages) {- setPersonalPage(personalTotalPages);- }- }, [personalPage, personalTotalPages]);+ .slice(0, SEARCH_ITEMS_LIMIT);return (<div className="flex min-w-0 flex-col gap-2">@@ -484,7 +279,7 @@ export const GitLabProjectPicker = ({/><SegmentedButtonicon={<User />}- label="Your projects"+ label="Projects"isActive={tab === "yours"}count={personalProjects.length}onClick={() => handleTabChange("yours")}@@ -515,138 +310,59 @@ export const GitLabProjectPicker = ({</div></div>- {tab === "groups" && !isSearching && breadcrumb.length > 0 && (- <div className="flex min-w-0 items-center gap-2 border-b border-border px-2 py-1.5">- <IconButton- aria-label="Back"- variant="ghost-muted"- size="xs"- className="shrink-0"- onClick={handleBack}- >- <ChevronLeft className="size-3.5" />- </IconButton>- <nav- aria-label="breadcrumb"- className="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-xs"- >- <button- type="button"- onClick={() => setBreadcrumb([])}- className="shrink-0 cursor-pointer whitespace-nowrap text-muted hover:text-foreground"- >- Groups- </button>- {breadcrumb.map((entry, index) => {- const isLast = index === breadcrumb.length - 1;- return (- <span key={entry.id} className="inline-flex min-w-0 items-center gap-1">- <ChevronRight className="size-3 shrink-0 text-muted/70" />- {isLast ? (- <span aria-current="page" className="truncate text-foreground">- {entry.name}- </span>- ) : (- <button- type="button"- onClick={() => handleBreadcrumbJump(index)}- className="cursor-pointer truncate text-muted hover:text-foreground"- >- {entry.name}- </button>- )}- </span>- );- })}- </nav>+ {!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>)}- <div className="max-h-[320px] min-h-[260px] overflow-y-auto p-1">- {!hasConnection && (- <div className="px-3 py-10 text-center text-sm text-muted">- Select a GitLab Connection above to browse projects.- </div>- )}-- {hasConnection && tab === "groups" && isSearching && (+ {hasConnection && tab === "groups" && isSearching && (+ <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}><SearchResultsListquery={debouncedSearch}isLoading={groupsAndProjectsSearchQuery.isLoading || groupNameSearchQuery.isLoading}groups={groupNameSearchQuery.data ?? []}- projects={searchedGroupProjects}+ projects={searchedProjects}selectedProjectId={selectedProjectId}onSelectGroup={handleSearchGroupSelect}onSelectProject={handleProjectSelect}/>- )}-- {hasConnection && tab === "groups" && !isSearching && isLoadingGroupsView && (- <ListSkeleton />- )}-- {hasConnection &&- tab === "groups" &&- !isSearching &&- !isLoadingGroupsView &&- !currentGroup && (- <GroupList- groups={rootGroupsQuery.data ?? []}- onDrillIn={handleDrillIn}- emptyMessage="No groups available."- emptyHint="Your GitLab account isn't a member of any group."- />- )}+ </div>+ )}- {hasConnection &&- tab === "groups" &&- !isSearching &&- !isLoadingGroupsView &&- currentGroup && (- <GroupDetailList- subgroups={subgroupsQuery.data ?? []}- projects={groupProjectsQuery.data ?? []}- selectedProjectId={selectedProjectId}- onDrillIn={handleDrillIn}- onSelectProject={handleProjectSelect}- />- )}+ {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" && (+ {hasConnection && tab === "yours" && (+ <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}><PersonalProjectsListisLoading={personalProjectsQuery.isLoading}- projects={paginatedPersonalProjects}+ projects={filteredPersonalProjects}selectedProjectId={selectedProjectId}onSelect={handleProjectSelect}isSearching={isSearching}searchQuery={debouncedSearch}/>- )}- </div>-- {tab === "yours" && hasConnection && personalTotalCount > PERSONAL_PROJECTS_PER_PAGE && (- <div className="flex flex-wrap items-center justify-between gap-2 border-t border-border px-2 py-2 text-xs text-muted">- <span className="whitespace-nowrap">- Page {personalPage} of {personalTotalPages}- </span>- <div className="flex shrink-0 items-center gap-1">- <Button- variant="ghost"- size="xs"- isDisabled={personalPage <= 1 || personalProjectsQuery.isFetching}- onClick={() => setPersonalPage((p) => Math.max(1, p - 1))}- >- <ChevronLeft className="size-3.5" /> Prev- </Button>- <Button- variant="ghost"- size="xs"- isDisabled={personalPage >= personalTotalPages || personalProjectsQuery.isFetching}- onClick={() => setPersonalPage((p) => p + 1)}- >- Next <ChevronRight className="size-3.5" />- </Button>- </div></div>)}</div>diff --git a/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx b/frontend/src/components/v3/platform/TreePicker/TreePicker.tsxnew file mode 100644index 0000000000..ff093e176f--- /dev/null+++ b/frontend/src/components/v3/platform/TreePicker/TreePicker.tsx@@ -0,0 +1,242 @@+import { ReactNode } from "react";+import { Box, ChevronLeft, ChevronRight, Folder } from "lucide-react";++import { IconButton } from "@app/components/v3/generic/IconButton";+import { cn } from "@app/components/v3/utils";++import {+ BrowserRow,+ InlineEmpty,+ ListSkeleton,+ SectionHeading,+ TREE_PICKER_SCROLL_CLASS+} from "./primitives";+import { TreePickerProps, TTreePickerContainer, TTreePickerItem } from "./types";++const ContainerList = ({+ containerIcon,+ containers,+ onDrillIn,+ emptyTitle,+ emptyDescription+}: {+ containerIcon: ReactNode;+ containers: TTreePickerContainer[];+ onDrillIn: (container: TTreePickerContainer) => void;+ emptyTitle: string;+ emptyDescription?: string;+}) => {+ if (containers.length === 0) {+ return <InlineEmpty title={emptyTitle} description={emptyDescription} />;+ }++ return (+ <div className="flex flex-col gap-0.5 p-1">+ {containers.map((container) => (+ <BrowserRow+ key={container.id}+ icon={containerIcon}+ label={container.name}+ meta={+ container.fullPath && container.fullPath !== container.name+ ? container.fullPath+ : undefined+ }+ showChevron+ onClick={() => onDrillIn(container)}+ />+ ))}+ </div>+ );+};++const ContainerDetailList = ({+ containerIcon,+ itemIcon,+ subContainers,+ items,+ selectedItemId,+ subContainersHeading,+ itemsHeading,+ onDrillIn,+ onSelectItem,+ emptyTitle,+ emptyDescription+}: {+ containerIcon: ReactNode;+ itemIcon: ReactNode;+ subContainers: TTreePickerContainer[];+ items: TTreePickerItem[];+ selectedItemId: string;+ subContainersHeading: string;+ itemsHeading: string;+ onDrillIn: (container: TTreePickerContainer) => void;+ onSelectItem: (item: TTreePickerItem) => void;+ emptyTitle: string;+ emptyDescription?: string;+}) => {+ if (subContainers.length === 0 && items.length === 0) {+ return <InlineEmpty title={emptyTitle} description={emptyDescription} />;+ }++ return (+ <div className="flex flex-col">+ {subContainers.length > 0 && (+ <>+ <SectionHeading>{subContainersHeading}</SectionHeading>+ <div className="flex flex-col gap-0.5 p-1">+ {subContainers.map((subContainer) => (+ <BrowserRow+ key={subContainer.id}+ icon={containerIcon}+ label={subContainer.name}+ meta={subContainer.fullPath}+ showChevron+ onClick={() => onDrillIn(subContainer)}+ />+ ))}+ </div>+ </>+ )}+ {items.length > 0 && (+ <>+ <SectionHeading>{itemsHeading}</SectionHeading>+ <div className="flex flex-col gap-0.5 p-1">+ {items.map((item) => (+ <BrowserRow+ key={item.id}+ icon={itemIcon}+ label={item.name}+ meta={item.meta}+ isSelected={item.id === selectedItemId}+ onClick={() => onSelectItem(item)}+ />+ ))}+ </div>+ </>+ )}+ </div>+ );+};++export const TreePicker = ({+ dataSource,+ path,+ onPathChange,+ selectedItemId,+ onSelectItem,+ disabled = false,+ rootLabel,+ subContainersHeading = "Folders",+ itemsHeading = "Items",+ emptyRoot,+ emptyContainer,+ containerIcon = <Folder className="text-folder" />,+ itemIcon = <Box />+}: TreePickerProps) => {+ const isEnabled = !disabled;+ const current = path[path.length - 1] ?? null;++ const rootContainersQuery = dataSource.useRootContainers({ enabled: isEnabled });++ const subContainersQuery = dataSource.useSubContainers(current?.id ?? "", {+ enabled: isEnabled && Boolean(current)+ });++ const containerItemsQuery = dataSource.useContainerItems(current?.id ?? "", {+ enabled: isEnabled && Boolean(current)+ });++ const handleDrillIn = (container: TTreePickerContainer) => {+ onPathChange([...path, { id: container.id, name: container.name }]);+ };++ const isLoading = current+ ? subContainersQuery.isLoading || containerItemsQuery.isLoading+ : rootContainersQuery.isLoading;++ return (+ <div className="flex min-w-0 flex-col">+ {path.length > 0 && (+ <div className="flex min-w-0 items-center gap-2 border-b border-border px-2 py-1.5">+ <IconButton+ aria-label="Back"+ variant="ghost-muted"+ size="xs"+ className="shrink-0"+ onClick={() => onPathChange(path.slice(0, -1))}+ >+ <ChevronLeft className="size-3.5" />+ </IconButton>+ <nav+ aria-label="breadcrumb"+ className="flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-xs"+ >+ <button+ type="button"+ onClick={() => onPathChange([])}+ className="shrink-0 cursor-pointer whitespace-nowrap text-muted hover:text-foreground"+ >+ {rootLabel}+ </button>+ {path.map((entry, index) => {+ const isLast = index === path.length - 1;+ return (+ <span key={entry.id} className="inline-flex min-w-0 items-center gap-1">+ <ChevronRight className="size-3 shrink-0 text-muted/70" />+ {isLast ? (+ <span aria-current="page" className="truncate text-foreground">+ {entry.name}+ </span>+ ) : (+ <button+ type="button"+ onClick={() => onPathChange(path.slice(0, index + 1))}+ className="cursor-pointer truncate text-muted hover:text-foreground"+ >+ {entry.name}+ </button>+ )}+ </span>+ );+ })}+ </nav>+ </div>+ )}++ <div className={cn(TREE_PICKER_SCROLL_CLASS, "p-1")}>+ {(() => {+ if (isLoading) return <ListSkeleton />;++ if (!current) {+ return (+ <ContainerList+ containerIcon={containerIcon}+ containers={rootContainersQuery.data ?? []}+ onDrillIn={handleDrillIn}+ emptyTitle={emptyRoot.title}+ emptyDescription={emptyRoot.description}+ />+ );+ }++ return (+ <ContainerDetailList+ containerIcon={containerIcon}+ itemIcon={itemIcon}+ subContainers={subContainersQuery.data ?? []}+ items={containerItemsQuery.data ?? []}+ selectedItemId={selectedItemId}+ subContainersHeading={subContainersHeading}+ itemsHeading={itemsHeading}+ onDrillIn={handleDrillIn}+ onSelectItem={onSelectItem}+ emptyTitle={emptyContainer.title}+ emptyDescription={emptyContainer.description}+ />+ );+ })()}+ </div>+ </div>+ );+};diff --git a/frontend/src/components/v3/platform/TreePicker/index.ts b/frontend/src/components/v3/platform/TreePicker/index.tsnew file mode 100644index 0000000000..99ae86e573--- /dev/null+++ b/frontend/src/components/v3/platform/TreePicker/index.ts@@ -0,0 +1,3 @@+export * from "./primitives";+export * from "./TreePicker";+export * from "./types";diff --git a/frontend/src/components/v3/platform/TreePicker/primitives.tsx b/frontend/src/components/v3/platform/TreePicker/primitives.tsxnew file mode 100644index 0000000000..99f31d9c3c--- /dev/null+++ b/frontend/src/components/v3/platform/TreePicker/primitives.tsx@@ -0,0 +1,67 @@+import { ReactNode } from "react";+import { Check, ChevronRight } from "lucide-react";++import { Empty, EmptyDescription, EmptyTitle } from "@app/components/v3/generic/Empty";+import { Skeleton } from "@app/components/v3/generic/Skeleton";+import { cn } from "@app/components/v3/utils";++// Shared scroll-region height so every view block (tree, search, personal) lines up.+export const TREE_PICKER_SCROLL_CLASS = "max-h-[320px] min-h-[260px] overflow-y-auto";++export const ListSkeleton = () => (+ <div className="flex flex-col gap-1 p-1">+ {Array.from({ length: 5 }).map((_, i) => (+ // eslint-disable-next-line react/no-array-index-key+ <Skeleton key={i} className="h-8 w-full" />+ ))}+ </div>+);++export const SectionHeading = ({ children }: { children: ReactNode }) => (+ <div className="px-2 pt-2 pb-1 text-[10px] font-medium tracking-wider text-muted uppercase">+ {children}+ </div>+);++export const InlineEmpty = ({ title, description }: { title: string; description?: string }) => (+ <Empty className="border-0 bg-transparent p-6 shadow-none">+ <EmptyTitle>{title}</EmptyTitle>+ {description && <EmptyDescription>{description}</EmptyDescription>}+ </Empty>+);++export const BrowserRow = ({+ icon,+ label,+ meta,+ isSelected = false,+ showChevron = false,+ onClick+}: {+ icon: ReactNode;+ label: ReactNode;+ meta?: ReactNode;+ isSelected?: boolean;+ showChevron?: boolean;+ onClick: () => void;+}) => (+ <button+ type="button"+ onClick={onClick}+ className={cn(+ "group flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition-colors",+ "[&_svg]:size-3.5 [&_svg]:shrink-0",+ isSelected+ ? "bg-primary/10 text-foreground"+ : "text-accent hover:bg-foreground/5 hover:text-foreground"+ )}+ >+ <span className={cn("inline-flex shrink-0", isSelected ? "text-primary" : "text-muted")}>+ {icon}+ </span>+ <span className="min-w-0 flex-1 truncate">{label}</span>+ {meta != null && <span className="shrink-0 text-xs text-muted">{meta}</span>}+ {showChevron && <ChevronRight className="text-muted" />}+ {isSelected && !showChevron && <Check className="text-primary" />}+ </button>+);diff --git a/frontend/src/components/v3/platform/TreePicker/types.ts b/frontend/src/components/v3/platform/TreePicker/types.tsnew file mode 100644index 0000000000..3072e99ff2--- /dev/null+++ b/frontend/src/components/v3/platform/TreePicker/types.ts@@ -0,0 +1,45 @@+import { ReactNode } from "react";++export type TTreePickerContainer = { id: string; name: string; fullPath?: string };+export type TTreePickerItem = { id: string; name: string; meta?: string };+export type TTreePickerPathEntry = { id: string; name: string };++type QueryOpts = { enabled: boolean };++// Minimal subset of a React Query result the picker reads; a UseQueryResult satisfies it+// structurally, so passthrough adapters can return query results directly.+export type TTreePickerQueryResult<T> = {+ data: T | undefined;+ isLoading: boolean;+ isFetching?: boolean;+};++export type TTreePickerDataSource = {+ useRootContainers: (opts: QueryOpts) => TTreePickerQueryResult<TTreePickerContainer[]>;+ useSubContainers: (+ containerId: string,+ opts: QueryOpts+ ) => TTreePickerQueryResult<TTreePickerContainer[]>;+ useContainerItems: (+ containerId: string,+ opts: QueryOpts+ ) => TTreePickerQueryResult<TTreePickerItem[]>;+};++type EmptyCopy = { title: string; description?: string };++export type TreePickerProps = {+ dataSource: TTreePickerDataSource;+ path: TTreePickerPathEntry[];+ onPathChange: (path: TTreePickerPathEntry[]) => void;+ selectedItemId: string;+ onSelectItem: (item: { id: string; name: string }) => void;+ disabled?: boolean;+ rootLabel: string;+ subContainersHeading?: string;+ itemsHeading?: string;+ emptyRoot: EmptyCopy;+ emptyContainer: EmptyCopy;+ containerIcon?: ReactNode;+ itemIcon?: ReactNode;+};diff --git a/frontend/src/components/v3/platform/index.ts b/frontend/src/components/v3/platform/index.tsindex bdb3389b35..d9567da35b 100644--- a/frontend/src/components/v3/platform/index.ts+++ b/frontend/src/components/v3/platform/index.ts@@ -6,3 +6,4 @@ export * from "./PasswordGenerator";export * from "./ScopeIcons";export * from "./SecretInput";export * from "./SecretPathInput";+export * from "./TreePicker";diff --git a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx b/frontend/src/hooks/api/appConnections/gitlab/queries.tsxindex 5bce53c43d..15d4b807f0 100644--- a/frontend/src/hooks/api/appConnections/gitlab/queries.tsx+++ b/frontend/src/hooks/api/appConnections/gitlab/queries.tsx@@ -1,4 +1,4 @@-import { keepPreviousData, useQuery, UseQueryOptions } from "@tanstack/react-query";+import { useQuery, UseQueryOptions } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";@@ -17,7 +17,7 @@ const gitlabConnectionKeys = {listGroups: (connectionId: string) =>[...gitlabConnectionKeys.all, "groups", connectionId] as const,listRootGroups: (connectionId: string) =>- [...gitlabConnectionKeys.all, "root-groups", connectionId] as const,+ [...gitlabConnectionKeys.all, "groups", "root", connectionId] as const,searchGroups: (connectionId: string, search: string) =>[...gitlabConnectionKeys.all, "search-groups", connectionId, search] as const,searchGroupsAndProjects: (connectionId: string, search: string) =>@@ -32,8 +32,6 @@ 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);- if (params?.page !== undefined) search.set("page", String(params.page));- if (params?.perPage !== undefined) search.set("perPage", String(params.perPage));const qs = search.toString();return qs ? `?${qs}` : "";};@@ -60,7 +58,6 @@ export const useGitLabConnectionListProjects = (return data;},- placeholderData: keepPreviousData,...options});};@@ -106,7 +103,7 @@ export const useGitLabConnectionListRootGroups = (queryKey: gitlabConnectionKeys.listRootGroups(connectionId),queryFn: async () => {const { data } = await apiRequest.get<TGitLabGroupTreeItem[]>(- `/api/v1/app-connections/gitlab/${connectionId}/root-groups`+ `/api/v1/app-connections/gitlab/${connectionId}/groups/root`);return data;diff --git a/frontend/src/hooks/api/appConnections/gitlab/types.ts b/frontend/src/hooks/api/appConnections/gitlab/types.tsindex 111f71557c..d4ae6c1a9f 100644--- a/frontend/src/hooks/api/appConnections/gitlab/types.ts+++ b/frontend/src/hooks/api/appConnections/gitlab/types.ts@@ -17,8 +17,6 @@ export type TGitLabGroupTreeItem = {export type TGitLabListProjectsParams = {owned?: boolean;search?: string;- page?: number;- perPage?: number;};export enum GitLabAccessTokenType {