Skip to content

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

Fix folder empty description issue and added icon to display it

carlosmonastyrski1512d4f49621
diff --git a/backend/src/server/routes/v1/secret-folder-router.ts b/backend/src/server/routes/v1/secret-folder-router.ts
index 82b3e6dcfb..b0a22548a9 100644
--- a/backend/src/server/routes/v1/secret-folder-router.ts
+++ b/backend/src/server/routes/v1/secret-folder-router.ts
@@ -48,7 +48,7 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
.transform(prefixWithSlash)
.transform(removeTrailingSlash)
.describe(FOLDERS.CREATE.directory),
- description: z.string().optional().describe(FOLDERS.CREATE.description)
+ description: z.string().optional().nullable().describe(FOLDERS.CREATE.description)
}),
response: {
200: z.object({
@@ -79,7 +79,7 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
folderId: folder.id,
folderName: folder.name,
folderPath: path,
- description: req.body.description
+ ...(req.body.description ? { description: req.body.description } : {})
}
}
});
@@ -129,7 +129,7 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
.transform(prefixWithSlash)
.transform(removeTrailingSlash)
.describe(FOLDERS.UPDATE.directory),
- description: z.string().optional().describe(FOLDERS.UPDATE.description)
+ description: z.string().optional().nullable().describe(FOLDERS.UPDATE.description)
}),
response: {
200: z.object({
@@ -201,7 +201,7 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
.transform(prefixWithSlash)
.transform(removeTrailingSlash)
.describe(FOLDERS.UPDATE.path),
- description: z.string().optional().describe(FOLDERS.UPDATE.description)
+ description: z.string().optional().nullable().describe(FOLDERS.UPDATE.description)
})
.array()
.min(1)
diff --git a/backend/src/services/secret-folder/secret-folder-types.ts b/backend/src/services/secret-folder/secret-folder-types.ts
index 7d3d4934a5..bbe4c72232 100644
--- a/backend/src/services/secret-folder/secret-folder-types.ts
+++ b/backend/src/services/secret-folder/secret-folder-types.ts
@@ -9,7 +9,7 @@ export type TCreateFolderDTO = {
environment: string;
path: string;
name: string;
- description?: string;
+ description?: string | null;
} & TProjectPermission;
export type TUpdateFolderDTO = {
@@ -17,7 +17,7 @@ export type TUpdateFolderDTO = {
path: string;
id: string;
name: string;
- description?: string;
+ description?: string | null;
} & TProjectPermission;
export type TUpdateManyFoldersDTO = {
@@ -27,7 +27,7 @@ export type TUpdateManyFoldersDTO = {
path: string;
id: string;
name: string;
- description?: string;
+ description?: string | null;
}[];
} & Omit<TProjectPermission, "projectId">;
diff --git a/frontend/src/hooks/api/secretFolders/types.ts b/frontend/src/hooks/api/secretFolders/types.ts
index 34b1fda572..454e159e1d 100644
--- a/frontend/src/hooks/api/secretFolders/types.ts
+++ b/frontend/src/hooks/api/secretFolders/types.ts
@@ -25,7 +25,7 @@ export type TCreateFolderDTO = {
environment: string;
name: string;
path?: string;
- description?: string
+ description?: string | null;
};
export type TUpdateFolderDTO = {
@@ -34,7 +34,7 @@ export type TUpdateFolderDTO = {
name: string;
folderId: string;
path?: string;
- description?: string
+ description?: string | null;
};
export type TDeleteFolderDTO = {
@@ -52,6 +52,6 @@ export type TUpdateFolderBatchDTO = {
environment: string;
id: string;
path?: string;
- description?: string;
+ description?: string | null;
}[];
};
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 31c5c8c3fe..f96aabf53b 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -251,7 +251,7 @@ export const OverviewPage = () => {
"updateFolder"
] as const);
- const handleFolderCreate = async (folderName: string, description: string | undefined) => {
+ const handleFolderCreate = async (folderName: string, description: string | null) => {
const promises = userAvailableEnvs.map((env) => {
const environment = env.slug;
return createFolder({
@@ -280,7 +280,7 @@ export const OverviewPage = () => {
}
};
- const handleFolderUpdate = async (newFolderName: string, description: string | undefined) => {
+ const handleFolderUpdate = async (newFolderName: string, description: string | null) => {
const { name: oldFolderName } = popUp.updateFolder.data as TSecretFolder;
const updatedFolders: TUpdateFolderBatchDTO["folders"] = [];
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
index 7b11f7a593..03ff3dd57c 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
@@ -128,7 +128,7 @@ export const ActionBar = ({
const { currentWorkspace } = useWorkspace();
- const handleFolderCreate = async (folderName: string, description: string | undefined) => {
+ const handleFolderCreate = async (folderName: string, description: string | null) => {
try {
await createFolder({
name: folderName,
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/FolderForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/FolderForm.tsx
index 7c6aea8901..78d075b4f8 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/FolderForm.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/FolderForm.tsx
@@ -7,8 +7,8 @@ import { Button, FormControl, Input, ModalClose } from "@app/components/v2";
import { TextArea } from "@app/components/v2/TextArea/TextArea";
type Props = {
- onCreateFolder?: (folderName: string, description: string | undefined) => Promise<void>;
- onUpdateFolder?: (folderName: string, description: string | undefined) => Promise<void>;
+ onCreateFolder?: (folderName: string, description: string | null) => Promise<void>;
+ onUpdateFolder?: (folderName: string, description: string | null) => Promise<void>;
isEdit?: boolean;
defaultFolderName?: string;
defaultDescription?: string;
@@ -48,7 +48,7 @@ export const FolderForm = ({
resolver: zodResolver(formSchema),
defaultValues: {
name: defaultFolderName,
- description:defaultDescription
+ description: defaultDescription || ""
}
});
@@ -67,7 +67,7 @@ export const FolderForm = ({
};
const onSubmit = async ({ name, description }: TFormData) => {
- const descriptionShaped = description?.trim() === "" ? undefined : description;
+ const descriptionShaped = description && description.trim() !== "" ? description : null;
if (isEdit) {
await onUpdateFolder?.(name, descriptionShaped);
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
index d50d7fedd9..28e204dfc5 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/FolderListView/FolderListView.tsx
@@ -1,5 +1,5 @@
import { subject } from "@casl/ability";
-import { faClose, faFolder, faPencilSquare } from "@fortawesome/free-solid-svg-icons";
+import { faClose, faFolder, faPencilSquare, faInfoCircle } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate, useSearch } from "@tanstack/react-router";
@@ -43,7 +43,7 @@ export const FolderListView = ({
const { mutateAsync: updateFolder } = useUpdateFolder();
const { mutateAsync: deleteFolder } = useDeleteFolder();
- const handleFolderUpdate = async (newFolderName: string, newFolderDescription: string | undefined) => {
+ const handleFolderUpdate = async (newFolderName: string, newFolderDescription: string | null) => {
try {
const { id: folderId } = popUp.updateFolder.data as TSecretFolder;
await updateFolder({
@@ -117,14 +117,18 @@ export const FolderListView = ({
}}
onClick={() => handleFolderClick(name)}
>
- <Tooltip
- position="right"
- className="flex items-center space-x-4 max-w-lg py-4 whitespace-pre-wrap"
- content={description}
- >
- <div>{name}</div>
- </Tooltip>
- </div>
+ {name}
+ {
+ description &&
+ <Tooltip
+ position="right"
+ className="flex items-center space-x-4 max-w-lg py-4 whitespace-pre-wrap"
+ content={description}
+ >
+ <FontAwesomeIcon icon={faInfoCircle} className="text-mineshaft-400 ml-1" />
+ </Tooltip>
+ }
+ </div>
<div className="flex items-center space-x-4 border-l border-mineshaft-600 px-3 py-3">
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}