Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

Display placeholder /health page when repairs are disabled.

nzbdav-dev8868fb0a59d2
diff --git a/frontend/app/routes/health/components/health-table/health-table.tsx b/frontend/app/routes/health/components/health-table/health-table.tsx
index a5d6ee0b..443cb39f 100644
--- a/frontend/app/routes/health/components/health-table/health-table.tsx
+++ b/frontend/app/routes/health/components/health-table/health-table.tsx
@@ -4,10 +4,11 @@ import styles from "./health-table.module.css";
import { Truncate } from "~/routes/queue/components/truncate/truncate";
export type HealthTableProps = {
+ isEnabled: boolean,
healthCheckItems: HealthCheckQueueItem[],
}
-export function HealthTable({ healthCheckItems }: HealthTableProps) {
+export function HealthTable({ isEnabled, healthCheckItems }: HealthTableProps) {
return (
<div className={styles.container}>
@@ -18,7 +19,15 @@ export function HealthTable({ healthCheckItems }: HealthTableProps) {
</div>
</div>
- {healthCheckItems.length === 0 ? (
+ {!isEnabled ? (
+ <div className={styles.emptyState}>
+ <div className={styles.emptyIcon}>πŸ©ΊπŸ’™πŸ’ͺ</div>
+ <div className={styles.emptyTitle}>Enable Repairs In Settings</div>
+ <div className={styles.emptyDescription}>
+ Once you enable repairs, all mounted usenet files will be queued for continuous health monitoring
+ </div>
+ </div>
+ ) : healthCheckItems.length === 0 ? (
<div className={styles.emptyState}>
<div className={styles.emptyIcon}>πŸ©ΊπŸ’™πŸ’ͺ</div>
<div className={styles.emptyTitle}>No Items To Health-Check</div>
diff --git a/frontend/app/routes/health/route.tsx b/frontend/app/routes/health/route.tsx
index e1332cc0..a1cb4b73 100644
--- a/frontend/app/routes/health/route.tsx
+++ b/frontend/app/routes/health/route.tsx
@@ -5,20 +5,26 @@ import { HealthTable } from "./components/health-table/health-table";
import { HealthStats } from "./components/health-stats/health-stats";
export async function loader() {
- const [queueData, historyData] = await Promise.all([
+ const enabledKey = 'repair.enable';
+ const [queueData, historyData, config] = await Promise.all([
backendClient.getHealthCheckQueue(10),
- backendClient.getHealthCheckHistory()
+ backendClient.getHealthCheckHistory(),
+ backendClient.getConfig([enabledKey])
]);
return {
queueItems: queueData.items,
historyStats: historyData.stats,
- historyItems: historyData.items
+ historyItems: historyData.items,
+ isEnabled: config
+ .filter(x => x.configName === enabledKey)
+ .filter(x => x.configValue.toLowerCase() === "true")
+ .length > 0
};
}
export default function Health({ loaderData }: Route.ComponentProps) {
- const { queueItems, historyStats, historyItems } = loaderData;
+ const { queueItems, historyStats, historyItems, isEnabled } = loaderData;
return (
<div className={styles.container}>
@@ -26,7 +32,7 @@ export default function Health({ loaderData }: Route.ComponentProps) {
<HealthStats stats={historyStats} />
</div>
<div className={styles.section}>
- <HealthTable healthCheckItems={queueItems} />
+ <HealthTable isEnabled={isEnabled} healthCheckItems={queueItems} />
</div>
</div>
);