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
ui changes
Matheus Nogueira7afaee259733
diff --git a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsxindex 663e7525ed..b50b2c7fbc 100644--- a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx+++ b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx@@ -1,5 +1,5 @@import { useMemo, useState } from "react";-import { ArrowRight, Box, FolderIcon, KeyRound, Layers, Plus, SlashIcon, Trash2 } from "lucide-react";+import { ArrowRight, Box, FolderIcon, KeyRound, Layers, Plus, Trash2 } from "lucide-react";import { createNotification } from "@app/components/notifications";import {@@ -16,11 +16,6 @@ import {AlertDialogHeader,AlertDialogTitle,Badge,- Breadcrumb,- BreadcrumbItem,- BreadcrumbList,- BreadcrumbPage,- BreadcrumbSeparator,Button,Card,CardContent,@@ -52,6 +47,8 @@ type ProjectGroup = {targetProjectId: string;targetProjectName: string;totalSecrets: number;+ uniqueEnvCount: number;+ uniqueFolderCount: number;grants: TProjectFolderGrant[];};@@ -63,31 +60,19 @@ const groupGrantsByProject = (grants: TProjectFolderGrant[]): ProjectGroup[] =>byProject.set(grant.targetProjectId, existing);}- return Array.from(byProject.entries()).map(([targetProjectId, projectGrants]) => ({- targetProjectId,- targetProjectName: projectGrants[0].targetProjectName,- totalSecrets: projectGrants.reduce((sum, g) => sum + g.secretCount, 0),- grants: projectGrants- }));-};--type FolderPathProps = { folderName: string };+ return Array.from(byProject.entries()).map(([targetProjectId, projectGrants]) => {+ const uniqueEnvs = new Set(projectGrants.map((g) => g.environmentSlug));+ const uniqueFolders = new Set(projectGrants.map((g) => g.folderName));-const FolderPath = ({ folderName }: FolderPathProps) => {- const isRoot = folderName === "root";- return (- <Breadcrumb>- <BreadcrumbList className="flex-nowrap gap-1 sm:gap-1">- <BreadcrumbItem>- <FolderIcon className="size-3.5" />- </BreadcrumbItem>- <BreadcrumbSeparator>- <SlashIcon className="size-3 -rotate-12" />- </BreadcrumbSeparator>- {!isRoot && <BreadcrumbPage className="text-muted">{folderName}</BreadcrumbPage>}- </BreadcrumbList>- </Breadcrumb>- );+ return {+ targetProjectId,+ targetProjectName: projectGrants[0].targetProjectName,+ totalSecrets: projectGrants.reduce((sum, g) => sum + g.secretCount, 0),+ uniqueEnvCount: uniqueEnvs.size,+ uniqueFolderCount: uniqueFolders.size,+ grants: projectGrants+ };+ });};type DeleteGrantDialogProps = {@@ -230,76 +215,92 @@ export const CrossProjectSharingSection = () => {</p></CardHeader><CardContent>- <div className="mb-2 flex items-center gap-2">- <span className="text-sm text-mineshaft-400">Linked Projects</span>- <Badge variant="neutral">{projectGroups.length}</Badge>- </div>- {grants.length === 0 ? (- <Empty>- <EmptyHeader>- <EmptyTitle>No projects have access yet</EmptyTitle>- <EmptyDescription>- Share secrets to grant another project read access.- </EmptyDescription>- </EmptyHeader>- </Empty>- ) : (- <Accordion type="multiple" defaultValue={projectGroups.map((g) => g.targetProjectId)}>- {projectGroups.map((projectGroup) => (- <AccordionItem key={projectGroup.targetProjectId} value={projectGroup.targetProjectId}>- <AccordionTrigger>- <div className="flex flex-1 items-center justify-between">- <Badge variant="project" className="gap-1.5">- <Box className="size-3" />- {projectGroup.targetProjectName}- </Badge>- <span className="mr-2 text-xs text-muted">- {projectGroup.totalSecrets} secrets shared- </span>- </div>- </AccordionTrigger>- <AccordionContent>- <Table>- <TableBody>- {projectGroup.grants.map((grant) => (- <TableRow key={grant.id}>- <TableCell>- <div className="flex items-center gap-2">- <Badge variant="neutral" className="gap-1.5">- <Layers className="size-3" />- {grant.environmentName}- </Badge>- <ArrowRight className="size-3.5 shrink-0 text-muted" />- <FolderPath folderName={grant.folderName} />- </div>- </TableCell>- <TableCell className="text-right">- <div className="flex items-center justify-end gap-1.5 text-xs whitespace-nowrap text-muted">- <KeyRound className="size-3 shrink-0" />- <span className="tabular-nums">- {grant.secretCount}{" "}- {grant.secretCount === 1 ? "secret" : "secrets"}- </span>- </div>- </TableCell>- <TableCell className="w-10">- <IconButton- variant="ghost-muted"- size="xs"- onClick={() => setGrantToDelete(grant)}- >- <Trash2 />- </IconButton>- </TableCell>- </TableRow>- ))}- </TableBody>- </Table>- </AccordionContent>- </AccordionItem>- ))}- </Accordion>- )}+ <div className="mb-2 flex items-center gap-2">+ <span className="text-sm text-mineshaft-400">Granted Projects</span>+ <Badge variant="neutral">{projectGroups.length}</Badge>+ </div>+ {grants.length === 0 ? (+ <Empty>+ <EmptyHeader>+ <EmptyTitle>No projects have access yet</EmptyTitle>+ <EmptyDescription>+ Share secrets to grant another project read access.+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ ) : (+ <Accordion type="multiple" defaultValue={projectGroups.map((g) => g.targetProjectId)}>+ {projectGroups.map((projectGroup) => (+ <AccordionItem+ key={projectGroup.targetProjectId}+ value={projectGroup.targetProjectId}+ >+ <AccordionTrigger>+ <div className="flex flex-1 items-center gap-3">+ <Badge variant="project" className="gap-1.5">+ <Box className="size-3" />+ {projectGroup.targetProjectName}+ </Badge>+ <span className="text-xs text-muted">+ {projectGroup.uniqueEnvCount}{" "}+ {projectGroup.uniqueEnvCount === 1 ? "environment" : "environments"}+ {" · "}+ {projectGroup.uniqueFolderCount}{" "}+ {projectGroup.uniqueFolderCount === 1 ? "folder" : "folders"}+ {" · "}+ {projectGroup.totalSecrets}{" "}+ {projectGroup.totalSecrets === 1 ? "secret" : "secrets"}+ </span>+ </div>+ </AccordionTrigger>+ <AccordionContent>+ <Table>+ <TableBody>+ {projectGroup.grants.map((grant) => (+ <TableRow key={grant.id}>+ <TableCell>+ <div className="flex items-center gap-2">+ <Badge variant="neutral" className="gap-1.5">+ <Layers className="size-3" />+ {grant.environmentName}+ </Badge>+ <ArrowRight className="size-3.5 shrink-0 text-muted" />+ <div className="flex items-center gap-1.5">+ <FolderIcon className="size-3.5 text-muted" />+ <span className="text-sm text-muted">+ {grant.folderName === "root" ? "/" : `/${grant.folderName}`}+ </span>+ </div>+ </div>+ </TableCell>+ <TableCell className="text-right">+ <div className="flex items-center justify-end gap-1.5 text-xs whitespace-nowrap text-muted">+ <KeyRound className="size-3 shrink-0" />+ <span className="tabular-nums">+ {grant.secretCount}{" "}+ {grant.secretCount === 1 ? "secret" : "secrets"}+ </span>+ </div>+ </TableCell>+ <TableCell className="w-10">+ <IconButton+ variant="ghost-muted"+ size="xs"+ onClick={() => setGrantToDelete(grant)}+ >+ <Trash2 />+ </IconButton>+ </TableCell>+ </TableRow>+ ))}+ </TableBody>+ </Table>+ </AccordionContent>+ </AccordionItem>+ ))}+ </Accordion>+ )}+ </CardContent><DeleteGrantDialoggrant={grantToDelete}onOpenChange={(open) => {@@ -307,7 +308,6 @@ export const CrossProjectSharingSection = () => {}}sourceProjectId={currentProject.id}/>- </CardContent></Card>);};diff --git a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsxindex 73da18b950..503b6f6fef 100644--- a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx+++ b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/ShareSecretsSheet.tsx@@ -33,6 +33,7 @@ import {} from "@app/hooks/api/projectFolderGrants";import { useGetUserProjectsByType } from "@app/hooks/api/projects";import { Project, ProjectType } from "@app/hooks/api/projects/types";+import { useGetProjectFolders } from "@app/hooks/api/secretFolders";import { useGetSecretImports } from "@app/hooks/api/secretImports";type Props = {@@ -58,12 +59,26 @@ export const ShareSecretsSheet = ({ isOpen, onOpenChange }: Props) => {const { data: existingGrants = [] } = useListProjectFolderGrants(currentProject.id);const createGrant = useCreateProjectFolderGrant();- const expectedFolderName =- folderPath === "/" ? "root" : folderPath.split("/").filter(Boolean).pop() ?? "root";+ const pathSegments = folderPath.split("/").filter(Boolean);+ const parentPath = pathSegments.length <= 1 ? "/" : `/${pathSegments.slice(0, -1).join("/")}`;+ const leafName = pathSegments.at(-1) ?? "";++ const { data: parentFolders = [] } = useGetProjectFolders({+ projectId: currentProject.id,+ environment,+ path: parentPath,+ options: { enabled: Boolean(environment) && folderPath !== "/" }+ });++ const selectedFolderId = parentFolders.find((f) => f.name === leafName)?.id;const grantedProjectIds = new Set(existingGrants- .filter((g) => g.environmentSlug === environment && g.folderName === expectedFolderName)+ .filter((g) =>+ selectedFolderId+ ? g.sourceFolderId === selectedFolderId+ : g.environmentSlug === environment && g.folderName === "root"+ ).map((g) => g.targetProjectId));