diff --git a/src/App.tsx b/src/App.tsx index 7087140..be1d105 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -14,7 +14,7 @@ export default function App() { toast.error(`Something went wrong: ${error.message}`); } }, - staleTime: 10000, + refetchOnWindowFocus: "always", }, }); diff --git a/src/modules/clusters/cluster-information/ClusterInfo.tsx b/src/modules/clusters/cluster-information/ClusterInfo.tsx index 22b7efb..4237081 100644 --- a/src/modules/clusters/cluster-information/ClusterInfo.tsx +++ b/src/modules/clusters/cluster-information/ClusterInfo.tsx @@ -13,7 +13,7 @@ import { ResourceTable } from "@/modules/clusters/cluster-information/components import { ClusterConfig } from "@/modules/clusters/cluster-information/components/ClusterConfig"; import useClusterInfo from "@/modules/clusters/cluster-information/hooks/useClusterInfo"; import { useParams } from "react-router-dom"; -import { ClusterType } from "@/types/cluster"; +import { ClusterInfoType, ClusterType, Label } from "@/types/cluster"; import { useEffect, useState } from "react"; export const data = { @@ -89,13 +89,17 @@ export const data = { export function ClusterInfo() { const { tab: type, name, namespace } = useParams(); - const [infoData, setInfoData] = useState(null); + const [infoData, setInfoData] = useState(null); const queries = useClusterInfo(namespace, name, type as ClusterType); const [resourcesQuery, helmChartQuery, InfoQuery] = queries; useEffect(() => { - if(resourcesQuery.isSuccess && helmChartQuery.isSuccess && InfoQuery.isSuccess){ - setInfoData(InfoQuery.data.managedClusters[0]) + if ( + resourcesQuery.isSuccess && + helmChartQuery.isSuccess && + InfoQuery.isSuccess + ) { + setInfoData(InfoQuery.data.managedClusters[0]); } }, [InfoQuery]); @@ -111,6 +115,7 @@ export function ClusterInfo() { )} @@ -119,7 +124,7 @@ export function ClusterInfo() {
{InfoQuery.isSuccess && infoData && ( - + )} diff --git a/src/modules/clusters/cluster-information/components/LabelsCard.tsx b/src/modules/clusters/cluster-information/components/LabelsCard.tsx index e19fc8f..9cdb902 100644 --- a/src/modules/clusters/cluster-information/components/LabelsCard.tsx +++ b/src/modules/clusters/cluster-information/components/LabelsCard.tsx @@ -11,11 +11,9 @@ type LabelsCardProps = { export const LabelsCard = ({ labels }: LabelsCardProps) => { useEffect(() => { console.log("LabelsCard", labels); - }, [labels]); const labelEntries = Object.entries(labels || {}); return ( - <>
@@ -28,16 +26,16 @@ export const LabelsCard = ({ labels }: LabelsCardProps) => {
- {labelEntries.length>0 && labelEntries.map(([key, value]) => ( - - -

{`${key}: ${value}`}

-
- ))} + {labelEntries.length > 0 && + labelEntries.map(([key, value]) => ( + +

{`${key}: ${value}`}

+
+ ))}
diff --git a/src/modules/clusters/cluster-information/components/clusterHeading.tsx b/src/modules/clusters/cluster-information/components/clusterHeading.tsx index e8ad3e8..727a221 100644 --- a/src/modules/clusters/cluster-information/components/clusterHeading.tsx +++ b/src/modules/clusters/cluster-information/components/clusterHeading.tsx @@ -8,12 +8,14 @@ type ClusterHeadingProps = { name: string; version: string; status: boolean; + namespace?: string; }; export const ClusterHeading = ({ name, version, status, + namespace, }: ClusterHeadingProps) => { const navigate = useNavigate(); return ( @@ -37,6 +39,12 @@ export const ClusterHeading = ({ > version : {version} + + namespace : {namespace} + {status ? "Healthy" : "Failed"} +