import { faDownload, faEllipsis, faPencil, faServer, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import FileSaver from "file-saver"; import { twMerge } from "tailwind-merge"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, EmptyState, Table, TableContainer, TableSkeleton, TBody, Td, Th, THead, Tooltip, Tr } from "@app/components/v2"; import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { fetchSshHostUserCaPublicKey, useListWorkspaceSshHosts } from "@app/hooks/api"; import { UsePopUpState } from "@app/hooks/usePopUp"; type Props = { handlePopUpOpen: ( popUpName: keyof UsePopUpState<["deleteSshHost", "sshHost"]>, data?: object ) => void; }; export const SshHostsTable = ({ handlePopUpOpen }: Props) => { const { currentWorkspace } = useWorkspace(); const { data, isPending } = useListWorkspaceSshHosts(currentWorkspace?.id || ""); const downloadTxtFile = (filename: string, content: string) => { const blob = new Blob([content], { type: "text/plain;charset=utf-8" }); FileSaver.saveAs(blob, filename); }; const handleDownloadUserCaKey = async (sshHostId: string) => { try { const publicKey = await fetchSshHostUserCaPublicKey(sshHostId); downloadTxtFile("infisical_user_ca.pub", publicKey); } catch (err) { console.error("Failed to download User CA public key", err); createNotification({ type: "error", text: "Failed to download User CA public key" }); } }; return (
| Hostname | Login User - Authorized Principals Mapping | |
|---|---|---|
| {host.hostname} |
{host.loginMappings.length === 0 ? (
None
) : (
host.loginMappings.map(({ loginUser, allowedPrincipals }) => (
{loginUser}
{allowedPrincipals.usernames.map((username) => (
└─ {username}
))}
|
|