feat: add refresh functionality to Kubernetes resource tables

This commit is contained in:
Nawaz Dhandala
2026-03-25 11:47:40 +00:00
parent 0eb096ca8f
commit 27e65caef2
14 changed files with 59 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ import KubernetesResourceUtils, {
import Card, { CardButtonSchema } from "Common/UI/Components/Card/Card";
import { ButtonStyleType } from "Common/UI/Components/Button/Button";
import IconProp from "Common/Types/Icon/IconProp";
import { getRefreshButton } from "Common/UI/Components/Card/CardButtons/Refresh";
import Table from "Common/UI/Components/Table/Table";
import FieldType from "Common/UI/Components/Types/FieldType";
import Link from "Common/UI/Components/Link/Link";
@@ -38,6 +39,7 @@ export interface ComponentProps {
getViewRoute?: (resource: KubernetesResource) => Route;
emptyMessage?: string;
isLoading?: boolean;
onRefreshClick?: (() => void) | undefined;
}
const PAGE_SIZE: number = 25;
@@ -427,17 +429,25 @@ const KubernetesResourceTable: FunctionComponent<ComponentProps> = (
const hasActiveFilters: boolean = Object.keys(filterData).length > 0;
const cardButtons: Array<CardButtonSchema> = [
{
title: "",
buttonStyle: ButtonStyleType.ICON,
className: "py-0 pr-0 pl-1 mt-1",
onClick: () => {
setShowFilterModal(true);
},
icon: IconProp.Filter,
const cardButtons: Array<CardButtonSchema> = [];
if (props.onRefreshClick) {
cardButtons.push({
...getRefreshButton(),
className: "py-0 pr-0 pl-0 mt-1",
onClick: props.onRefreshClick,
});
}
cardButtons.push({
title: "",
buttonStyle: ButtonStyleType.ICON,
className: "py-0 pr-0 pl-1 mt-1",
onClick: () => {
setShowFilterModal(true);
},
];
icon: IconProp.Filter,
});
return (
<Card

View File

@@ -134,6 +134,9 @@ const KubernetesClusterContainers: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Containers"
description="All containers running in this cluster."
resources={resources}

View File

@@ -136,6 +136,9 @@ const KubernetesClusterCronJobs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="CronJobs"
description="All cron jobs in this cluster."
resources={resources}

View File

@@ -141,6 +141,9 @@ const KubernetesClusterDaemonSets: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="DaemonSets"
description="All daemonsets running in this cluster."
resources={resources}

View File

@@ -160,6 +160,9 @@ const KubernetesClusterDeployments: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Deployments"
description="All deployments running in this cluster."
resources={resources}

View File

@@ -118,6 +118,9 @@ const KubernetesClusterHPAs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Horizontal Pod Autoscalers"
description="All HPAs in this cluster with their current scaling status."
resources={resources}

View File

@@ -147,6 +147,9 @@ const KubernetesClusterJobs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Jobs"
description="All jobs in this cluster."
resources={resources}

View File

@@ -108,6 +108,9 @@ const KubernetesClusterNamespaces: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Namespaces"
description="All namespaces in this cluster."
resources={resources}

View File

@@ -117,6 +117,9 @@ const KubernetesClusterNodes: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Nodes"
description="All nodes in this cluster with their current resource usage."
resources={resources}

View File

@@ -104,6 +104,9 @@ const KubernetesClusterPVCs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Persistent Volume Claims"
description="All PVCs in this cluster with their current status."
resources={resources}

View File

@@ -101,6 +101,9 @@ const KubernetesClusterPVs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Persistent Volumes"
description="All PVs in this cluster with their current status."
resources={resources}

View File

@@ -155,6 +155,9 @@ const KubernetesClusterPods: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Pods"
description="All pods running in this cluster with their current resource usage."
resources={resources}

View File

@@ -149,6 +149,9 @@ const KubernetesClusterStatefulSets: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="StatefulSets"
description="All statefulsets running in this cluster."
resources={resources}

View File

@@ -106,6 +106,9 @@ const KubernetesClusterVPAs: FunctionComponent<
return (
<KubernetesResourceTable
onRefreshClick={() => {
fetchData().catch(() => {});
}}
title="Vertical Pod Autoscalers"
description="All VPAs in this cluster with their current status."
resources={resources}