mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Fix folder empty description issue and added icon to display it
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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">;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}[];
|
||||
};
|
||||
|
||||
@@ -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"] = [];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user