diff --git a/src-tauri/src/commands/metrics.rs b/src-tauri/src/commands/metrics.rs index a3236c42..08a2a9ed 100644 --- a/src-tauri/src/commands/metrics.rs +++ b/src-tauri/src/commands/metrics.rs @@ -52,7 +52,7 @@ pub async fn get_pod_metrics( } let json_output = &output.stdout; - crate::metrics::client::parse_pod_metrics(&json_output) + crate::metrics::client::parse_pod_metrics(json_output) .map_err(|e| format!("Failed to parse pod metrics: {e}")) } @@ -103,6 +103,6 @@ pub async fn get_node_metrics( } let json_output = &output.stdout; - crate::metrics::client::parse_node_metrics(&json_output) + crate::metrics::client::parse_node_metrics(json_output) .map_err(|e| format!("Failed to parse node metrics: {e}")) } diff --git a/src/components/Kubernetes/CronJobList.tsx b/src/components/Kubernetes/CronJobList.tsx index fb00bc4b..bdebb62a 100644 --- a/src/components/Kubernetes/CronJobList.tsx +++ b/src/components/Kubernetes/CronJobList.tsx @@ -1,6 +1,6 @@ import React, { useState } from "react"; -import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui"; -import { PauseCircle, PlayCircle, Play, Pencil, Trash2, FileText } from "lucide-react"; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Button } from "@/components/ui"; +import { PauseCircle, PlayCircle, Play, Pencil, Trash2, FileText, Settings } from "lucide-react"; import type { CronJobInfo } from "@/lib/tauriCommands"; import { suspendCronjobCmd, @@ -13,6 +13,9 @@ import { ResourceActionMenu } from "./ResourceActionMenu"; import { ConfirmDeleteDialog } from "./ConfirmDeleteDialog"; import { EditResourceModal } from "./EditResourceModal"; import { WorkloadLogsModal } from "./WorkloadLogsModal"; +import { useColumnConfig } from "@/hooks/useColumnConfig"; +import { DEFAULT_COLUMNS } from "@/config/defaultColumns"; +import { ColumnConfigModal } from "@/components/tables/ColumnConfigModal"; interface CronJobListProps { cronJobs: CronJobInfo[]; @@ -39,6 +42,11 @@ export function CronJobList({ const [activeModal, setActiveModal] = useState(null); const [isDeleting, setIsDeleting] = useState(false); const [actionError, setActionError] = useState(null); + const [showColumnConfig, setShowColumnConfig] = useState(false); + + // Configurable columns + const columnConfig = useColumnConfig("cronjobs", DEFAULT_COLUMNS.cronjobs); + const { isColumnVisible } = columnConfig; const openEdit = async (cj: CronJobInfo) => { setActionError(null); @@ -102,18 +110,32 @@ export function CronJobList({ {actionError && (

{actionError}

)} +
+
+ {cronJobs.length} {cronJobs.length === 1 ? "cron job" : "cron jobs"} +
+ +
- Name - Namespace - Schedule - Active - Last Schedule - Age - Labels - Actions + {isColumnVisible("name") && Name} + {isColumnVisible("namespace") && Namespace} + {isColumnVisible("schedule") && Schedule} + {isColumnVisible("active") && Active} + {isColumnVisible("lastSchedule") && Last Schedule} + {isColumnVisible("age") && Age} + {isColumnVisible("labels") && Labels} + {isColumnVisible("actions") && Actions} @@ -126,18 +148,27 @@ export function CronJobList({ ) : ( cronJobs.map((cj) => ( - {cj.name} - {cj.namespace} - {cj.schedule} - {cj.active} - {cj.last_schedule} - {cj.age} - - {Object.entries(cj.labels) - .map(([k, v]) => `${k}=${v}`) - .join(", ")} - - + {isColumnVisible("name") && ( + {cj.name} + )} + {isColumnVisible("namespace") && ( + {cj.namespace} + )} + {isColumnVisible("schedule") && {cj.schedule}} + {isColumnVisible("active") && {cj.active}} + {isColumnVisible("lastSchedule") && {cj.last_schedule}} + {isColumnVisible("age") && ( + {cj.age} + )} + {isColumnVisible("labels") && ( + + {Object.entries(cj.labels) + .map(([k, v]) => `${k}=${v}`) + .join(", ")} + + )} + {isColumnVisible("actions") && ( + - + + )} )) )} @@ -217,6 +249,23 @@ export function CronJobList({ onConfirm={handleDelete} /> )} + + ); }