fix(dashboard+api): add cors + domain from onboarding
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
'use client';
|
||||
|
||||
import { pushModal, showConfirm } from '@/modals';
|
||||
import { api } from '@/trpc/client';
|
||||
import { Edit2Icon, TrashIcon } from 'lucide-react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import type { IServiceProject } from '@openpanel/db';
|
||||
|
||||
import { Button } from '../ui/button';
|
||||
|
||||
export function ProjectActions(project: Exclude<IServiceProject, null>) {
|
||||
const { id } = project;
|
||||
const router = useRouter();
|
||||
const deletion = api.project.remove.useMutation({
|
||||
onSuccess() {
|
||||
toast('Success', {
|
||||
description: 'Project deleted successfully.',
|
||||
});
|
||||
router.refresh();
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
pushModal('EditProject', project);
|
||||
}}
|
||||
icon={Edit2Icon}
|
||||
>
|
||||
Edit project
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="text-destructive"
|
||||
onClick={() => {
|
||||
showConfirm({
|
||||
title: 'Delete project',
|
||||
text: 'This will delete all events for this project. This action cannot be undone.',
|
||||
onConfirm() {
|
||||
deletion.mutate({
|
||||
id,
|
||||
});
|
||||
},
|
||||
});
|
||||
}}
|
||||
icon={TrashIcon}
|
||||
>
|
||||
Delete project
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { formatDate } from '@/utils/date';
|
||||
import type { ColumnDef } from '@tanstack/react-table';
|
||||
|
||||
import type { IServiceProject } from '@openpanel/db';
|
||||
|
||||
import { ACTIONS } from '../data-table';
|
||||
import { ProjectActions } from './project-actions';
|
||||
|
||||
export type Project = IServiceProject;
|
||||
export const columns: ColumnDef<IServiceProject>[] = [
|
||||
{
|
||||
accessorKey: 'name',
|
||||
header: 'Name',
|
||||
},
|
||||
{
|
||||
accessorKey: 'createdAt',
|
||||
header: 'Created at',
|
||||
cell({ row }) {
|
||||
const date = row.original.createdAt;
|
||||
return <div>{formatDate(date)}</div>;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: ACTIONS,
|
||||
header: 'Actions',
|
||||
cell: ({ row }) => <ProjectActions {...row.original} />,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user