aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/admin/AdminActions.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components/dashboard/admin/AdminActions.tsx')
-rw-r--r--apps/web/components/dashboard/admin/AdminActions.tsx79
1 files changed, 79 insertions, 0 deletions
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 (
+ <div>
+ <div className="mb-2 mt-8 text-xl font-medium">Actions</div>
+ <div className="flex flex-col gap-2 sm:w-1/2">
+ <ActionButton
+ variant="destructive"
+ loading={isRecrawlPending}
+ onClick={() =>
+ recrawlLinks({ crawlStatus: "failure", runInference: true })
+ }
+ >
+ Recrawl Failed Links Only
+ </ActionButton>
+ <ActionButton
+ variant="destructive"
+ loading={isRecrawlPending}
+ onClick={() =>
+ recrawlLinks({ crawlStatus: "all", runInference: true })
+ }
+ >
+ Recrawl All Links
+ </ActionButton>
+ <ActionButton
+ variant="destructive"
+ loading={isRecrawlPending}
+ onClick={() =>
+ recrawlLinks({ crawlStatus: "all", runInference: false })
+ }
+ >
+ Recrawl All Links (Without Inference)
+ </ActionButton>
+ <ActionButton
+ variant="destructive"
+ loading={isReindexPending}
+ onClick={() => reindexBookmarks()}
+ >
+ Reindex All Bookmarks
+ </ActionButton>
+ </div>
+ </div>
+ );
+}