diff --git a/gui/app/(dashboard)/actions.ts b/gui/app/(dashboard)/actions.ts
index 885411004d..fab27412e9 100644
--- a/gui/app/(dashboard)/actions.ts
+++ b/gui/app/(dashboard)/actions.ts
@@ -1,20 +1,18 @@
'use server';
import { ApiUrl } from '@/lib/constant/api';
-import { CreateOption } from '@/lib/constant/common';
-import { get, post } from '@/lib/request';
+import { CreateOption, DropOption } from '@/lib/constant/common';
+import { drop, get, post } from '@/lib/request';
-export async function deleteProduct(formData: FormData) {
- // let id = Number(formData.get('id'));
- // await deleteProductById(id);
- // revalidatePath('/');
-}
-
-export async function createDatabaseAction(formData: FormData) {
- // let id = Number(formData.get('id'));
- // await deleteProductById(id);
- // revalidatePath('/');
-}
+export const listDatabase = async () => {
+ try {
+ const x = await get(`${ApiUrl.databases}`);
+ console.log('🚀 ~ x:', x);
+ return x;
+ } catch (error) {
+ console.log('🚀 ~ error:', error);
+ }
+};
export const createDatabase = async (params: {
database_name: string;
@@ -31,9 +29,24 @@ export const createDatabase = async (params: {
}
};
-export const listDatabase = async () => {
+export const dropDatabase = async (params: {
+ database_name: string;
+ drop_option: DropOption;
+}) => {
try {
- const x = await get(`${ApiUrl.databases}`);
+ const x = await drop(`${ApiUrl.databases}/${params.database_name}`, {
+ drop_option: params.drop_option
+ });
+ console.log('🚀 ~ x:', x);
+ return x;
+ } catch (error) {
+ console.log('🚀 ~ error:', error);
+ }
+};
+
+export const showDatabase = async (params: { database_name: string }) => {
+ try {
+ const x = await get(`${ApiUrl.database}/${params.database_name}`);
console.log('🚀 ~ x:', x);
return x;
} catch (error) {
diff --git a/gui/app/(dashboard)/database-card.tsx b/gui/app/(dashboard)/database-card.tsx
new file mode 100644
index 0000000000..d804ed77de
--- /dev/null
+++ b/gui/app/(dashboard)/database-card.tsx
@@ -0,0 +1,70 @@
+'use client';
+
+import { toast } from '@/components/hooks/use-toast';
+import {
+ Card,
+ CardDescription,
+ CardHeader,
+ CardTitle
+} from '@/components/ui/card';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuTrigger
+} from '@/components/ui/dropdown-menu';
+import { DropOption } from '@/lib/constant/common';
+import { DropdownMenuItem } from '@radix-ui/react-dropdown-menu';
+import { useRouter } from 'next/navigation';
+import { dropDatabase } from './actions';
+import DeleteIcon from '/public/delete.svg';
+import MoreIcon from '/public/more.svg';
+
+export const DeleteDropdown = ({
+ children,
+ deleteItem
+}: React.PropsWithChildren<{ deleteItem: () => void }>) => {
+ return (
+