From e107f8b6c250759ab0f884b2fdd0283fae15cfe5 Mon Sep 17 00:00:00 2001 From: Md Saban <45597394+mdsaban@users.noreply.github.com> Date: Sun, 30 Jun 2024 03:44:44 +0530 Subject: ui: refactor admin settings page (#249) * ui: refactor admin ui * fix: pr comments * chore: lint fix * chore: refactor * minor tweaks --------- Co-authored-by: MohamedBassem --- .../components/dashboard/admin/AdminActions.tsx | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 apps/web/components/dashboard/admin/AdminActions.tsx (limited to 'apps/web/components/dashboard/admin/AdminActions.tsx') diff --git a/apps/web/components/dashboard/admin/AdminActions.tsx b/apps/web/components/dashboard/admin/AdminActions.tsx new file mode 100644 index 00000000..783f7e76 --- /dev/null +++ b/apps/web/components/dashboard/admin/AdminActions.tsx @@ -0,0 +1,79 @@ +"use client"; + +import { ActionButton } from "@/components/ui/action-button"; +import { toast } from "@/components/ui/use-toast"; +import { api } from "@/lib/trpc"; + +export default function AdminActions() { + const { mutate: recrawlLinks, isPending: isRecrawlPending } = + api.admin.recrawlLinks.useMutation({ + onSuccess: () => { + toast({ + description: "Recrawl enqueued", + }); + }, + onError: (e) => { + toast({ + variant: "destructive", + description: e.message, + }); + }, + }); + + const { mutate: reindexBookmarks, isPending: isReindexPending } = + api.admin.reindexAllBookmarks.useMutation({ + onSuccess: () => { + toast({ + description: "Reindex enqueued", + }); + }, + onError: (e) => { + toast({ + variant: "destructive", + description: e.message, + }); + }, + }); + + return ( +
+
Actions
+
+ + recrawlLinks({ crawlStatus: "failure", runInference: true }) + } + > + Recrawl Failed Links Only + + + recrawlLinks({ crawlStatus: "all", runInference: true }) + } + > + Recrawl All Links + + + recrawlLinks({ crawlStatus: "all", runInference: false }) + } + > + Recrawl All Links (Without Inference) + + reindexBookmarks()} + > + Reindex All Bookmarks + +
+
+ ); +} -- cgit v1.2.3-70-g09d2