diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-12-30 11:27:32 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-12-30 11:31:35 +0000 |
| commit | 179f00b15525b024b6823088ef8fb94b7106b4f0 (patch) | |
| tree | d64257778930965ed076ff9a081411470343fb3c /apps/web/components/dashboard/admin/AdminActions.tsx | |
| parent | aff4e60952321d06dc4cf517ff3b15206aaaebba (diff) | |
| download | karakeep-179f00b15525b024b6823088ef8fb94b7106b4f0.tar.zst | |
feat: Change the admin page to be tabbed similar to that of the settings page
Diffstat (limited to 'apps/web/components/dashboard/admin/AdminActions.tsx')
| -rw-r--r-- | apps/web/components/dashboard/admin/AdminActions.tsx | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/apps/web/components/dashboard/admin/AdminActions.tsx b/apps/web/components/dashboard/admin/AdminActions.tsx deleted file mode 100644 index 3b95045c..00000000 --- a/apps/web/components/dashboard/admin/AdminActions.tsx +++ /dev/null @@ -1,137 +0,0 @@ -"use client"; - -import { ActionButton } from "@/components/ui/action-button"; -import { toast } from "@/components/ui/use-toast"; -import { useTranslation } from "@/lib/i18n/client"; -import { api } from "@/lib/trpc"; - -export default function AdminActions() { - const { t } = useTranslation(); - 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, - }); - }, - }); - - const { - mutate: reRunInferenceOnAllBookmarks, - isPending: isInferencePending, - } = api.admin.reRunInferenceOnAllBookmarks.useMutation({ - onSuccess: () => { - toast({ - description: "Inference jobs enqueued", - }); - }, - onError: (e) => { - toast({ - variant: "destructive", - description: e.message, - }); - }, - }); - - const { mutateAsync: tidyAssets, isPending: isTidyAssetsPending } = - api.admin.tidyAssets.useMutation({ - onSuccess: () => { - toast({ - description: "Tidy assets request has been enqueued!", - }); - }, - onError: (e) => { - toast({ - variant: "destructive", - description: e.message, - }); - }, - }); - - return ( - <div> - <div className="mb-2 mt-8 text-xl font-medium">{t("common.actions")}</div> - <div className="flex flex-col gap-2 sm:w-1/2"> - <ActionButton - variant="destructive" - loading={isRecrawlPending} - onClick={() => - recrawlLinks({ crawlStatus: "failure", runInference: true }) - } - > - {t("admin.actions.recrawl_failed_links_only")} - </ActionButton> - <ActionButton - variant="destructive" - loading={isRecrawlPending} - onClick={() => - recrawlLinks({ crawlStatus: "all", runInference: true }) - } - > - {t("admin.actions.recrawl_all_links")} - </ActionButton> - <ActionButton - variant="destructive" - loading={isRecrawlPending} - onClick={() => - recrawlLinks({ crawlStatus: "all", runInference: false }) - } - > - {t("admin.actions.recrawl_all_links")} ( - {t("admin.actions.without_inference")}) - </ActionButton> - <ActionButton - variant="destructive" - loading={isInferencePending} - onClick={() => - reRunInferenceOnAllBookmarks({ taggingStatus: "failure" }) - } - > - {t("admin.actions.regenerate_ai_tags_for_failed_bookmarks_only")} - </ActionButton> - <ActionButton - variant="destructive" - loading={isInferencePending} - onClick={() => reRunInferenceOnAllBookmarks({ taggingStatus: "all" })} - > - {t("admin.actions.regenerate_ai_tags_for_all_bookmarks")} - </ActionButton> - <ActionButton - variant="destructive" - loading={isReindexPending} - onClick={() => reindexBookmarks()} - > - {t("admin.actions.reindex_all_bookmarks")} - </ActionButton> - <ActionButton - variant="destructive" - loading={isTidyAssetsPending} - onClick={() => tidyAssets()} - > - {t("admin.actions.compact_assets")} - </ActionButton> - </div> - </div> - ); -} |
