Skip to content

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

ui: fix big paths on projects and groups

adilsonfaf08c2b5620
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 736b1ef6f6..c1fc179453 100644
--- a/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts
+++ b/backend/src/services/app-connection/gitlab/gitlab-connection-fns.ts
@@ -18,7 +18,7 @@ import { GitLabAccessTokenType, GitLabConnectionMethod } from "./gitlab-connecti
import { TGitLabConnection, TGitLabConnectionConfig, TGitLabGroup, TGitLabProject } from "./gitlab-connection-types";
// Cap provider list calls to the first page; users narrow further via server-side search.
-const SEARCH_ITEMS_LIMIT = 20;
+// const SEARCH_ITEMS_LIMIT = 20;
interface GitLabOAuthTokenResponse {
access_token: string;
@@ -354,14 +354,15 @@ export const listGitLabProjects = async ({
);
const projects = await client.Projects.all({
pagination: "offset",
- perPage: SEARCH_ITEMS_LIMIT,
+ // perPage: SEARCH_ITEMS_LIMIT,
maxPages: 1,
...(search ? { search } : {}),
archived: false,
includePendingDelete: false,
membership: true,
includeHidden: false,
- imported: false
+ imported: false,
+ searchNamespaces: !!search
});
return projects.map((project) => ({
@@ -402,7 +403,7 @@ export const listGitLabGroups = async ({
try {
const groups = await client.Groups.all({
pagination: "offset",
- perPage: SEARCH_ITEMS_LIMIT,
+ // perPage: SEARCH_ITEMS_LIMIT,
maxPages: 1,
orderBy: "name",
sort: "asc",
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabSyncFields.tsx
index 96e7fee61d..b4da410fce 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GitLabSyncFields.tsx
@@ -36,6 +36,29 @@ import { GitLabSyncScope } from "@app/hooks/api/secretSyncs/types/gitlab-sync";
import { TSecretSyncForm } from "../schemas";
+const formatGitLabGroupOptionLabel = (group: TGitLabGroup) => (
+ <div className="flex min-w-0 items-center gap-2">
+ <span className="shrink-0">{group.name}</span>
+ {group.fullPath !== group.name && (
+ <span className="min-w-0 truncate text-muted">{group.fullPath}</span>
+ )}
+ </div>
+);
+
+const formatGitLabProjectOptionLabel = (project: TGitLabProject) => {
+ const fullPathWithNamespace = project.name;
+ const shortName = fullPathWithNamespace.split("/").pop() || fullPathWithNamespace;
+
+ return (
+ <div className="flex min-w-0 items-center gap-2">
+ <span className="shrink-0">{shortName}</span>
+ {fullPathWithNamespace !== shortName && (
+ <span className="min-w-0 truncate text-muted">{fullPathWithNamespace}</span>
+ )}
+ </div>
+ );
+};
+
const SecretProtectionOption = ({
title,
description,
@@ -208,7 +231,8 @@ export const GitLabSyncFields = () => {
filterOption={null}
options={groupOptions}
placeholder="Search for a group..."
- getOptionLabel={(option) => option.fullName}
+ getOptionLabel={(option) => `${option.name} · ${option.fullPath}`}
+ formatOptionLabel={formatGitLabGroupOptionLabel}
getOptionValue={(option) => option.id}
noOptionsMessage={({ inputValue }) =>
inputValue ? "No groups found matching your search." : "No groups found."
@@ -256,7 +280,11 @@ export const GitLabSyncFields = () => {
filterOption={null}
options={projectOptions}
placeholder="Search for a project..."
- getOptionLabel={(option) => option.name}
+ getOptionLabel={(option) => {
+ const shortName = option.name.split("/").pop() || option.name;
+ return `${shortName} · ${option.name}`;
+ }}
+ formatOptionLabel={formatGitLabProjectOptionLabel}
getOptionValue={(option) => option.id}
noOptionsMessage={({ inputValue }) =>
inputValue ? "No projects found matching your search." : "No projects found."