import { ColumnDef } from '@tanstack/react-table'; import DateTime from '@/components/date-time'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu'; import { Button } from '@/components/ui/button'; import { useForm } from '@inertiajs/react'; import { LoaderCircleIcon, MoreVerticalIcon } from 'lucide-react'; import FormSuccessful from '@/components/form-successful'; import { useState } from 'react'; import { SSHKey } from '@/types/ssh-key'; function Delete({ sshKey }: { sshKey: SSHKey }) { const [open, setOpen] = useState(false); const form = useForm(); const submit = () => { form.delete(route('ssh-keys.destroy', sshKey.id), { onSuccess: () => { setOpen(false); }, }); }; return ( e.preventDefault()}> Delete Delete {sshKey.name} Delete ssh key Are you sure you want to delete this key? Cancel {form.processing && } Delete ); } export const columns: ColumnDef[] = [ { accessorKey: 'id', header: 'ID', enableColumnFilter: true, enableSorting: true, enableHiding: true, }, { accessorKey: 'name', header: 'Name', enableColumnFilter: true, enableSorting: true, }, { accessorKey: 'created_at', header: 'Created at', enableColumnFilter: true, enableSorting: true, cell: ({ row }) => { return ; }, }, { id: 'actions', enableColumnFilter: false, enableSorting: false, cell: ({ row }) => { return ( Open menu ); }, }, ];
Are you sure you want to delete this key?