2026-10-05 18:10:18 -04:00
|
|
|
import { useDeleteSSHKey } from '@/api/account/ssh-keys/queries';
|
2022-06-20 11:17:33 -04:00
|
|
|
import { Dialog } from '@/components/elements/dialog';
|
|
|
|
|
import Code from '@/components/elements/Code';
|
2026-10-05 18:10:18 -04:00
|
|
|
import { DeleteAction } from '@/components/elements/table/RowActions';
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
export default function DeleteSSHKeyButton({ name, fingerprint }: { name: string; fingerprint: string }) {
|
|
|
|
|
const deleteSshKey = useDeleteSSHKey();
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
const onClick = (close: () => void) => {
|
|
|
|
|
deleteSshKey.mutate({ body: { fingerprint } }, { onSettled: close });
|
2022-05-14 17:31:53 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-10-05 18:10:18 -04:00
|
|
|
<Dialog.ConfirmTrigger
|
|
|
|
|
title={'Delete SSH Key'}
|
|
|
|
|
confirm={'Delete Key'}
|
|
|
|
|
pending={deleteSshKey.isPending}
|
|
|
|
|
onConfirmed={(_event, close) => onClick(close)}
|
|
|
|
|
trigger={({ onClick }) => <DeleteAction aria-label={`Delete ${name}`} onClick={onClick} />}
|
|
|
|
|
>
|
|
|
|
|
Removing the <Code>{name}</Code> SSH key will invalidate its usage across the Panel.
|
|
|
|
|
</Dialog.ConfirmTrigger>
|
2022-05-14 17:31:53 -04:00
|
|
|
);
|
2026-10-05 18:10:18 -04:00
|
|
|
}
|