import { Helmet } from "react-helmet"; import { useTranslation } from "react-i18next"; import { useNavigate, useParams } from "@tanstack/react-router"; import { twMerge } from "tailwind-merge"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; import { Button, DeleteActionModal, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, PageHeader, Tooltip } from "@app/components/v2"; import { ROUTE_PATHS } from "@app/const/routes"; import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context"; import { useDeleteSshHostGroup, useGetSshHostGroupById } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { SshHostGroupModal } from "../SshHostsPage/components/SshHostGroupModal"; import { SshHostGroupDetailsSection, SshHostGroupHostsSection } from "./components"; const Page = () => { const { currentProject } = useProject(); const navigate = useNavigate(); const projectId = currentProject?.id || ""; const sshHostGroupId = useParams({ from: ROUTE_PATHS.Ssh.SshHostGroupDetailsByIDPage.id, select: (el) => el.sshHostGroupId }); const { data } = useGetSshHostGroupById(sshHostGroupId); const { mutateAsync: deleteSshHostGroup } = useDeleteSshHostGroup(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "sshHostGroup", "deleteSshHostGroup" ] as const); const onRemoveSshGroupSubmit = async (groupIdToDelete: string) => { try { if (!projectId) return; await deleteSshHostGroup({ sshHostGroupId: groupIdToDelete }); createNotification({ text: "Successfully deleted SSH group", type: "success" }); handlePopUpClose("deleteSshHostGroup"); navigate({ to: "/projects/ssh/$projectId/overview", params: { projectId } }); } catch (err) { console.error(err); createNotification({ text: "Failed to delete SSH group", type: "error" }); } }; return (