From 80a808048340f7f5e95e71c4ee649fdae7c8c565 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 9 Mar 2025 13:22:18 +0000
Subject: feat: Move background jobs with the admin actions. Fixes #1083

---
 apps/web/components/admin/ServerStats.tsx | 82 +------------------------------
 1 file changed, 1 insertion(+), 81 deletions(-)

(limited to 'apps/web/components/admin/ServerStats.tsx')

diff --git a/apps/web/components/admin/ServerStats.tsx b/apps/web/components/admin/ServerStats.tsx
index ded2c19f..0842ac77 100644
--- a/apps/web/components/admin/ServerStats.tsx
+++ b/apps/web/components/admin/ServerStats.tsx
@@ -1,14 +1,6 @@
 "use client";
 
 import LoadingSpinner from "@/components/ui/spinner";
-import {
-  Table,
-  TableBody,
-  TableCell,
-  TableHead,
-  TableHeader,
-  TableRow,
-} from "@/components/ui/table";
 import { useClientConfig } from "@/lib/clientConfig";
 import { useTranslation } from "@/lib/i18n/client";
 import { api } from "@/lib/trpc";
@@ -64,7 +56,7 @@ function ReleaseInfo() {
 export default function ServerStats() {
   const { t } = useTranslation();
   const { data: serverStats } = api.admin.stats.useQuery(undefined, {
-    refetchInterval: 1000,
+    refetchInterval: 5000,
     placeholderData: keepPreviousData,
   });
 
@@ -99,78 +91,6 @@ export default function ServerStats() {
           <ReleaseInfo />
         </div>
       </div>
-
-      <div className="sm:w-1/2">
-        <div className="mb-2 mt-8 text-xl font-medium">
-          {t("admin.background_jobs.background_jobs")}
-        </div>
-        <Table className="rounded-md border">
-          <TableHeader className="bg-gray-200">
-            <TableHead>{t("admin.background_jobs.job")}</TableHead>
-            <TableHead>{t("admin.background_jobs.queued")}</TableHead>
-            <TableHead>{t("admin.background_jobs.pending")}</TableHead>
-            <TableHead>{t("admin.background_jobs.failed")}</TableHead>
-          </TableHeader>
-          <TableBody>
-            <TableRow>
-              <TableCell className="lg:w-2/3">
-                {t("admin.background_jobs.crawler_jobs")}
-              </TableCell>
-              <TableCell>{serverStats.crawlStats.queued}</TableCell>
-              <TableCell>{serverStats.crawlStats.pending}</TableCell>
-              <TableCell>{serverStats.crawlStats.failed}</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>{t("admin.background_jobs.indexing_jobs")}</TableCell>
-              <TableCell>{serverStats.indexingStats.queued}</TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>{t("admin.background_jobs.inference_jobs")}</TableCell>
-              <TableCell>{serverStats.inferenceStats.queued}</TableCell>
-              <TableCell>{serverStats.inferenceStats.pending}</TableCell>
-              <TableCell>{serverStats.inferenceStats.failed}</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>
-                {t("admin.background_jobs.tidy_assets_jobs")}
-              </TableCell>
-              <TableCell>{serverStats.tidyAssetsStats.queued}</TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>{t("admin.background_jobs.video_jobs")}</TableCell>
-              <TableCell>{serverStats.videoStats.queued}</TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>{t("admin.background_jobs.webhook_jobs")}</TableCell>
-              <TableCell>{serverStats.webhookStats.queued}</TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>
-                {t("admin.background_jobs.asset_preprocessing_jobs")}
-              </TableCell>
-              <TableCell>
-                {serverStats.assetPreprocessingStats.queued}
-              </TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-            <TableRow>
-              <TableCell>{t("admin.background_jobs.feed_jobs")}</TableCell>
-              <TableCell>{serverStats.feedStats.queued}</TableCell>
-              <TableCell>-</TableCell>
-              <TableCell>-</TableCell>
-            </TableRow>
-          </TableBody>
-        </Table>
-      </div>
     </div>
   );
 }
-- 
cgit v1.2.3-70-g09d2

