-
+
+
{t("disabled")}
)}
diff --git a/src/components/ResourcesTable.tsx b/src/components/ResourcesTable.tsx
index 252ac7d2..171f3491 100644
--- a/src/components/ResourcesTable.tsx
+++ b/src/components/ResourcesTable.tsx
@@ -17,7 +17,7 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- DropdownMenuCheckboxItem,
+ DropdownMenuCheckboxItem
} from "@app/components/ui/dropdown-menu";
import { Button } from "@app/components/ui/button";
import {
@@ -36,7 +36,7 @@ import {
Wifi,
WifiOff,
CheckCircle2,
- XCircle,
+ XCircle
} from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
@@ -75,13 +75,12 @@ import EditInternalResourceDialog from "@app/components/EditInternalResourceDial
import CreateInternalResourceDialog from "@app/components/CreateInternalResourceDialog";
import { Alert, AlertDescription } from "@app/components/ui/alert";
-
export type TargetHealth = {
targetId: number;
ip: string;
port: number;
enabled: boolean;
- healthStatus?: 'healthy' | 'unhealthy' | 'unknown';
+ healthStatus?: "healthy" | "unhealthy" | "unknown";
};
export type ResourceRow = {
@@ -102,45 +101,55 @@ export type ResourceRow = {
targets?: TargetHealth[];
};
-
-function getOverallHealthStatus(targets?: TargetHealth[]): 'online' | 'degraded' | 'offline' | 'unknown' {
+function getOverallHealthStatus(
+ targets?: TargetHealth[]
+): "online" | "degraded" | "offline" | "unknown" {
if (!targets || targets.length === 0) {
- return 'unknown';
+ return "unknown";
}
- const monitoredTargets = targets.filter(t => t.enabled && t.healthStatus && t.healthStatus !== 'unknown');
+ const monitoredTargets = targets.filter(
+ (t) => t.enabled && t.healthStatus && t.healthStatus !== "unknown"
+ );
if (monitoredTargets.length === 0) {
- return 'unknown';
+ return "unknown";
}
- const healthyCount = monitoredTargets.filter(t => t.healthStatus === 'healthy').length;
- const unhealthyCount = monitoredTargets.filter(t => t.healthStatus === 'unhealthy').length;
+ const healthyCount = monitoredTargets.filter(
+ (t) => t.healthStatus === "healthy"
+ ).length;
+ const unhealthyCount = monitoredTargets.filter(
+ (t) => t.healthStatus === "unhealthy"
+ ).length;
if (healthyCount === monitoredTargets.length) {
- return 'online';
+ return "online";
} else if (unhealthyCount === monitoredTargets.length) {
- return 'offline';
+ return "offline";
} else {
- return 'degraded';
+ return "degraded";
}
}
-function StatusIcon({ status, className = "" }: {
- status: 'online' | 'degraded' | 'offline' | 'unknown';
+function StatusIcon({
+ status,
+ className = ""
+}: {
+ status: "online" | "degraded" | "offline" | "unknown";
className?: string;
}) {
const iconClass = `h-4 w-4 ${className}`;
switch (status) {
- case 'online':
+ case "online":
return
;
- case 'degraded':
+ case "degraded":
return
;
- case 'offline':
+ case "offline":
return
;
- case 'unknown':
- return
;
+ case "unknown":
+ return
;
default:
return null;
}
@@ -171,15 +180,14 @@ type ResourcesTableProps = {
};
};
-
const STORAGE_KEYS = {
- PAGE_SIZE: 'datatable-page-size',
+ PAGE_SIZE: "datatable-page-size",
getTablePageSize: (tableId?: string) =>
tableId ? `datatable-${tableId}-page-size` : STORAGE_KEYS.PAGE_SIZE
};
const getStoredPageSize = (tableId?: string, defaultSize = 20): number => {
- if (typeof window === 'undefined') return defaultSize;
+ if (typeof window === "undefined") return defaultSize;
try {
const key = STORAGE_KEYS.getTablePageSize(tableId);
@@ -191,24 +199,22 @@ const getStoredPageSize = (tableId?: string, defaultSize = 20): number => {
}
}
} catch (error) {
- console.warn('Failed to read page size from localStorage:', error);
+ console.warn("Failed to read page size from localStorage:", error);
}
return defaultSize;
};
const setStoredPageSize = (pageSize: number, tableId?: string): void => {
- if (typeof window === 'undefined') return;
+ if (typeof window === "undefined") return;
try {
const key = STORAGE_KEYS.getTablePageSize(tableId);
localStorage.setItem(key, pageSize.toString());
} catch (error) {
- console.warn('Failed to save page size to localStorage:', error);
+ console.warn("Failed to save page size to localStorage:", error);
}
};
-
-
export default function ResourcesTable({
resources,
internalResources,
@@ -224,12 +230,11 @@ export default function ResourcesTable({
const api = createApiClient({ env });
-
const [proxyPageSize, setProxyPageSize] = useState
(() =>
- getStoredPageSize('proxy-resources', 20)
+ getStoredPageSize("proxy-resources", 20)
);
const [internalPageSize, setInternalPageSize] = useState(() =>
- getStoredPageSize('internal-resources', 20)
+ getStoredPageSize("internal-resources", 20)
);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
@@ -247,8 +252,10 @@ export default function ResourcesTable({
defaultSort ? [defaultSort] : []
);
- const [proxyColumnVisibility, setProxyColumnVisibility] = useState({});
- const [internalColumnVisibility, setInternalColumnVisibility] = useState({});
+ const [proxyColumnVisibility, setProxyColumnVisibility] =
+ useState({});
+ const [internalColumnVisibility, setInternalColumnVisibility] =
+ useState({});
const [proxyColumnFilters, setProxyColumnFilters] =
useState([]);
@@ -427,24 +434,34 @@ export default function ResourcesTable({
return (
- No targets
+
+ {t("resourcesTableNoTargets")}
+
);
}
- const monitoredTargets = targets.filter(t => t.enabled && t.healthStatus && t.healthStatus !== 'unknown');
- const unknownTargets = targets.filter(t => !t.enabled || !t.healthStatus || t.healthStatus === 'unknown');
+ const monitoredTargets = targets.filter(
+ (t) => t.enabled && t.healthStatus && t.healthStatus !== "unknown"
+ );
+ const unknownTargets = targets.filter(
+ (t) => !t.enabled || !t.healthStatus || t.healthStatus === "unknown"
+ );
return (
-