diff --git a/backend/src/server/routes/v1/secret-folder-router.ts b/backend/src/server/routes/v1/secret-folder-router.ts index 82b3e6dcf..b0a22548a 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 7d3d4934a..bbe4c7223 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; diff --git a/frontend/src/hooks/api/secretFolders/types.ts b/frontend/src/hooks/api/secretFolders/types.ts index 34b1fda57..454e159e1 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 31c5c8c3f..f96aabf53 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 7b11f7a59..03ff3dd57 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 7c6aea890..78d075b4f 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; - onUpdateFolder?: (folderName: string, description: string | undefined) => Promise; + onCreateFolder?: (folderName: string, description: string | null) => Promise; + onUpdateFolder?: (folderName: string, description: string | null) => Promise; 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 d50d7fedd..28e204dfc 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)} > - -
{name}
-
- + {name} + { + description && + + + + } +