Skip to content

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

fix table components in webhook

adilson87d0f542a2b4
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
index e256a3b277..8b6186b9f3 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/WebhooksTab.tsx
@@ -1,5 +1,14 @@
import { useTranslation } from "react-i18next";
-import { faInfoCircle, faPlug, faPlus } from "@fortawesome/free-solid-svg-icons";
+import {
+ faEllipsisV,
+ faInfoCircle,
+ faPencil,
+ faPlug,
+ faPlus,
+ faToggleOff,
+ faToggleOn,
+ faTrash
+} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
@@ -8,7 +17,12 @@ import { ProjectPermissionCan } from "@app/components/permissions";
import {
Button,
DeleteActionModal,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
EmptyState,
+ IconButton,
Table,
TableContainer,
TableSkeleton,
@@ -220,9 +234,16 @@ export const WebhooksTab = withProjectPermission(
return (
<Tr key={id}>
- <Td className="max-w-xs overflow-hidden text-ellipsis hover:overflow-auto hover:break-all">
- {url}
- <p className="text-xs text-mineshaft-400">{id}</p>
+ <Td>
+ <Tooltip
+ className="max-w-md"
+ content={<span className="break-all">{url}</span>}
+ >
+ <div className="w-[28rem] max-w-full">
+ <p className="truncate">{url}</p>
+ <p className="truncate text-xs text-mineshaft-400">{id}</p>
+ </div>
+ </Tooltip>
</Td>
<Td>{environment.slug}</Td>
<Td>{secretPath}</Td>
@@ -285,21 +306,6 @@ export const WebhooksTab = withProjectPermission(
</Td>
<Td>
<div className="flex items-center justify-end space-x-2">
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.Webhooks}
- >
- {(isAllowed) => (
- <Button
- variant="outline_bg"
- size="xs"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("editWebhook", webhook)}
- >
- Edit
- </Button>
- )}
- </ProjectPermissionCan>
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.Webhooks}
@@ -322,45 +328,74 @@ export const WebhooksTab = withProjectPermission(
</Button>
)}
</ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Edit}
- a={ProjectPermissionSub.Webhooks}
- >
- {(isAllowed) => (
- <Button
- variant="outline_bg"
- size="xs"
- onClick={() => handleWebhookDisable(id, !isDisabled)}
- isDisabled={
- (isUpdateWebhookSubmitting &&
- updateWebhookVars?.webhookId === id) ||
- !isAllowed
- }
- isLoading={
- isUpdateWebhookSubmitting && updateWebhookVars?.webhookId === id
- }
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ ariaLabel="Options"
+ colorSchema="secondary"
+ className="w-6"
+ variant="plain"
>
- {isDisabled ? "Enable" : "Disable"}
- </Button>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionActions.Delete}
- a={ProjectPermissionSub.Webhooks}
- >
- {(isAllowed) => (
- <Button
- variant="outline_bg"
- className="border-red-800 bg-red-800 hover:border-red-700 hover:bg-red-700"
- colorSchema="danger"
- size="xs"
- isDisabled={!isAllowed}
- onClick={() => handlePopUpOpen("deleteWebhook", id)}
+ <FontAwesomeIcon icon={faEllipsisV} />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ sideOffset={2}
+ align="end"
+ className="min-w-48 p-1"
+ >
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.Webhooks}
>
- Delete
- </Button>
- )}
- </ProjectPermissionCan>
+ {(isAllowed) => (
+ <DropdownMenuItem
+ onClick={() => handlePopUpOpen("editWebhook", webhook)}
+ isDisabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faPencil} />}
+ >
+ Edit
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Edit}
+ a={ProjectPermissionSub.Webhooks}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ onClick={() => handleWebhookDisable(id, !isDisabled)}
+ isDisabled={
+ (isUpdateWebhookSubmitting &&
+ updateWebhookVars?.webhookId === id) ||
+ !isAllowed
+ }
+ icon={
+ <FontAwesomeIcon
+ icon={isDisabled ? faToggleOn : faToggleOff}
+ />
+ }
+ >
+ {isDisabled ? "Enable" : "Disable"}
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionActions.Delete}
+ a={ProjectPermissionSub.Webhooks}
+ >
+ {(isAllowed) => (
+ <DropdownMenuItem
+ onClick={() => handlePopUpOpen("deleteWebhook", id)}
+ isDisabled={!isAllowed}
+ icon={<FontAwesomeIcon icon={faTrash} />}
+ >
+ Delete
+ </DropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
</Td>
</Tr>