mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 00:25:53 +08:00
chore: add functionality to open entity details from nested table items in groupby mode (#6981)
This commit is contained in:
parent
93a8f97355
commit
5783f1555f
@ -201,6 +201,11 @@ function K8sClustersList({
|
|||||||
[groupedByRowData, groupBy],
|
[groupedByRowData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedClustersData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const { data, isFetching, isLoading, isError } = useGetK8sClustersList(
|
const { data, isFetching, isLoading, isError } = useGetK8sClustersList(
|
||||||
query as K8sClustersListPayload,
|
query as K8sClustersListPayload,
|
||||||
{
|
{
|
||||||
@ -283,12 +288,21 @@ function K8sClustersList({
|
|||||||
|
|
||||||
const selectedClusterData = useMemo(() => {
|
const selectedClusterData = useMemo(() => {
|
||||||
if (!selectedClusterName) return null;
|
if (!selectedClusterName) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the cluster from the formatted grouped by clusters data
|
||||||
|
return (
|
||||||
|
nestedClustersData.find(
|
||||||
|
(cluster) => cluster.meta.k8s_cluster_name === selectedClusterName,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If not grouped by, return the cluster from the clusters data
|
||||||
return (
|
return (
|
||||||
clustersData.find(
|
clustersData.find(
|
||||||
(cluster) => cluster.meta.k8s_cluster_name === selectedClusterName,
|
(cluster) => cluster.meta.k8s_cluster_name === selectedClusterName,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedClusterName, clustersData]);
|
}, [selectedClusterName, groupBy.length, clustersData, nestedClustersData]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sClustersRowData): void => {
|
const handleRowClick = (record: K8sClustersRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -341,6 +355,10 @@ function K8sClustersList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedClusterName(record.clusterUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -220,6 +220,11 @@ function K8sDaemonSetsList({
|
|||||||
[daemonSetsData, groupBy],
|
[daemonSetsData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedDaemonSetsData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const columns = useMemo(() => getK8sDaemonSetsListColumns(groupBy), [groupBy]);
|
const columns = useMemo(() => getK8sDaemonSetsListColumns(groupBy), [groupBy]);
|
||||||
|
|
||||||
const handleGroupByRowClick = (record: K8sDaemonSetsRowData): void => {
|
const handleGroupByRowClick = (record: K8sDaemonSetsRowData): void => {
|
||||||
@ -285,13 +290,26 @@ function K8sDaemonSetsList({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const selectedDaemonSetData = useMemo(() => {
|
const selectedDaemonSetData = useMemo(() => {
|
||||||
if (!selectedDaemonSetUID) return null;
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the daemonset from the formatted grouped by data
|
||||||
|
return (
|
||||||
|
nestedDaemonSetsData.find(
|
||||||
|
(daemonSet) => daemonSet.daemonSetName === selectedDaemonSetUID,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If not grouped by, return the daemonset from the daemonsets data
|
||||||
return (
|
return (
|
||||||
daemonSetsData.find(
|
daemonSetsData.find(
|
||||||
(daemonSet) => daemonSet.daemonSetName === selectedDaemonSetUID,
|
(daemonSet) => daemonSet.daemonSetName === selectedDaemonSetUID,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedDaemonSetUID, daemonSetsData]);
|
}, [
|
||||||
|
selectedDaemonSetUID,
|
||||||
|
groupBy.length,
|
||||||
|
daemonSetsData,
|
||||||
|
nestedDaemonSetsData,
|
||||||
|
]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sDaemonSetsRowData): void => {
|
const handleRowClick = (record: K8sDaemonSetsRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -344,6 +362,10 @@ function K8sDaemonSetsList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedDaemonSetUID(record.daemonsetUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -220,6 +220,11 @@ function K8sDeploymentsList({
|
|||||||
[deploymentsData, groupBy],
|
[deploymentsData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedDeploymentsData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const columns = useMemo(() => getK8sDeploymentsListColumns(groupBy), [
|
const columns = useMemo(() => getK8sDeploymentsListColumns(groupBy), [
|
||||||
groupBy,
|
groupBy,
|
||||||
]);
|
]);
|
||||||
@ -288,12 +293,26 @@ function K8sDeploymentsList({
|
|||||||
|
|
||||||
const selectedDeploymentData = useMemo(() => {
|
const selectedDeploymentData = useMemo(() => {
|
||||||
if (!selectedDeploymentUID) return null;
|
if (!selectedDeploymentUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the deployment from the formatted grouped by deployments data
|
||||||
|
return (
|
||||||
|
nestedDeploymentsData.find(
|
||||||
|
(deployment) => deployment.deploymentName === selectedDeploymentUID,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If not grouped by, return the deployment from the deployments data
|
||||||
return (
|
return (
|
||||||
deploymentsData.find(
|
deploymentsData.find(
|
||||||
(deployment) => deployment.deploymentName === selectedDeploymentUID,
|
(deployment) => deployment.deploymentName === selectedDeploymentUID,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedDeploymentUID, deploymentsData]);
|
}, [
|
||||||
|
selectedDeploymentUID,
|
||||||
|
groupBy.length,
|
||||||
|
deploymentsData,
|
||||||
|
nestedDeploymentsData,
|
||||||
|
]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sDeploymentsRowData): void => {
|
const handleRowClick = (record: K8sDeploymentsRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -346,6 +365,10 @@ function K8sDeploymentsList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedDeploymentUID(record.deploymentUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -884,3 +884,7 @@
|
|||||||
.ant-table-content {
|
.ant-table-content {
|
||||||
margin-bottom: 60px !important;
|
margin-bottom: 60px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.expanded-clickable-row {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
@ -195,6 +195,11 @@ function K8sJobsList({
|
|||||||
[groupedByRowData, groupBy],
|
[groupedByRowData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedJobsData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const { data, isFetching, isLoading, isError } = useGetK8sJobsList(
|
const { data, isFetching, isLoading, isError } = useGetK8sJobsList(
|
||||||
query as K8sJobsListPayload,
|
query as K8sJobsListPayload,
|
||||||
{
|
{
|
||||||
@ -274,9 +279,13 @@ function K8sJobsList({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const selectedJobData = useMemo(() => {
|
const selectedJobData = useMemo(() => {
|
||||||
if (!selectedJobUID) return null;
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the job from the formatted grouped by data
|
||||||
|
return nestedJobsData.find((job) => job.jobName === selectedJobUID) || null;
|
||||||
|
}
|
||||||
|
// If not grouped by, return the job from the jobs data
|
||||||
return jobsData.find((job) => job.jobName === selectedJobUID) || null;
|
return jobsData.find((job) => job.jobName === selectedJobUID) || null;
|
||||||
}, [selectedJobUID, jobsData]);
|
}, [selectedJobUID, groupBy.length, jobsData, nestedJobsData]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sJobsRowData): void => {
|
const handleRowClick = (record: K8sJobsRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -329,6 +338,10 @@ function K8sJobsList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedJobUID(record.jobUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -219,6 +219,11 @@ function K8sNamespacesList({
|
|||||||
[namespacesData, groupBy],
|
[namespacesData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedNamespacesData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const columns = useMemo(() => getK8sNamespacesListColumns(groupBy), [groupBy]);
|
const columns = useMemo(() => getK8sNamespacesListColumns(groupBy), [groupBy]);
|
||||||
|
|
||||||
const handleGroupByRowClick = (record: K8sNamespacesRowData): void => {
|
const handleGroupByRowClick = (record: K8sNamespacesRowData): void => {
|
||||||
@ -285,12 +290,26 @@ function K8sNamespacesList({
|
|||||||
|
|
||||||
const selectedNamespaceData = useMemo(() => {
|
const selectedNamespaceData = useMemo(() => {
|
||||||
if (!selectedNamespaceUID) return null;
|
if (!selectedNamespaceUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the namespace from the formatted grouped by namespaces data
|
||||||
|
return (
|
||||||
|
nestedNamespacesData.find(
|
||||||
|
(namespace) => namespace.namespaceName === selectedNamespaceUID,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If not grouped by, return the node from the nodes data
|
||||||
return (
|
return (
|
||||||
namespacesData.find(
|
namespacesData.find(
|
||||||
(namespace) => namespace.namespaceName === selectedNamespaceUID,
|
(namespace) => namespace.namespaceName === selectedNamespaceUID,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedNamespaceUID, namespacesData]);
|
}, [
|
||||||
|
selectedNamespaceUID,
|
||||||
|
groupBy.length,
|
||||||
|
namespacesData,
|
||||||
|
nestedNamespacesData,
|
||||||
|
]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sNamespacesRowData): void => {
|
const handleRowClick = (record: K8sNamespacesRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -343,6 +362,10 @@ function K8sNamespacesList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedNamespaceUID(record.namespaceUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -188,6 +188,11 @@ function K8sNodesList({
|
|||||||
return queryPayload;
|
return queryPayload;
|
||||||
}, [pageSize, currentPage, queryFilters, minTime, maxTime, orderBy, groupBy]);
|
}, [pageSize, currentPage, queryFilters, minTime, maxTime, orderBy, groupBy]);
|
||||||
|
|
||||||
|
const nestedNodesData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const formattedGroupedByNodesData = useMemo(
|
const formattedGroupedByNodesData = useMemo(
|
||||||
() =>
|
() =>
|
||||||
formatDataForTable(groupedByRowData?.payload?.data?.records || [], groupBy),
|
formatDataForTable(groupedByRowData?.payload?.data?.records || [], groupBy),
|
||||||
@ -274,8 +279,15 @@ function K8sNodesList({
|
|||||||
|
|
||||||
const selectedNodeData = useMemo(() => {
|
const selectedNodeData = useMemo(() => {
|
||||||
if (!selectedNodeUID) return null;
|
if (!selectedNodeUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the node from the formatted grouped by nodes data
|
||||||
|
return (
|
||||||
|
nestedNodesData.find((node) => node.nodeUID === selectedNodeUID) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If not grouped by, return the node from the nodes data
|
||||||
return nodesData.find((node) => node.nodeUID === selectedNodeUID) || null;
|
return nodesData.find((node) => node.nodeUID === selectedNodeUID) || null;
|
||||||
}, [selectedNodeUID, nodesData]);
|
}, [selectedNodeUID, groupBy.length, nodesData, nestedNodesData]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sNodesRowData): void => {
|
const handleRowClick = (record: K8sNodesRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -329,6 +341,10 @@ function K8sNodesList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedNodeUID(record.nodeUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -227,6 +227,11 @@ function K8sPodsList({
|
|||||||
const podsData = useMemo(() => data?.payload?.data?.records || [], [data]);
|
const podsData = useMemo(() => data?.payload?.data?.records || [], [data]);
|
||||||
const totalCount = data?.payload?.data?.total || 0;
|
const totalCount = data?.payload?.data?.total || 0;
|
||||||
|
|
||||||
|
const nestedPodsData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const formattedPodsData = useMemo(
|
const formattedPodsData = useMemo(
|
||||||
() => formatDataForTable(podsData, groupBy),
|
() => formatDataForTable(podsData, groupBy),
|
||||||
[podsData, groupBy],
|
[podsData, groupBy],
|
||||||
@ -313,8 +318,13 @@ function K8sPodsList({
|
|||||||
|
|
||||||
const selectedPodData = useMemo(() => {
|
const selectedPodData = useMemo(() => {
|
||||||
if (!selectedPodUID) return null;
|
if (!selectedPodUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
// If grouped by, return the pod from the formatted grouped by pods data
|
||||||
|
return nestedPodsData.find((pod) => pod.podUID === selectedPodUID) || null;
|
||||||
|
}
|
||||||
|
// If not grouped by, return the node from the nodes data
|
||||||
return podsData.find((pod) => pod.podUID === selectedPodUID) || null;
|
return podsData.find((pod) => pod.podUID === selectedPodUID) || null;
|
||||||
}, [selectedPodUID, podsData]);
|
}, [selectedPodUID, groupBy.length, podsData, nestedPodsData]);
|
||||||
|
|
||||||
const handleGroupByRowClick = (record: K8sPodsRowData): void => {
|
const handleGroupByRowClick = (record: K8sPodsRowData): void => {
|
||||||
setSelectedRowData(record);
|
setSelectedRowData(record);
|
||||||
@ -425,6 +435,10 @@ function K8sPodsList({
|
|||||||
spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData,
|
spinning: isFetchingGroupedByRowData || isLoadingGroupedByRowData,
|
||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setSelectedPodUID(record.podUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -202,6 +202,11 @@ function K8sStatefulSetsList({
|
|||||||
[groupedByRowData, groupBy],
|
[groupedByRowData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedStatefulSetsData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const { data, isFetching, isLoading, isError } = useGetK8sStatefulSetsList(
|
const { data, isFetching, isLoading, isError } = useGetK8sStatefulSetsList(
|
||||||
query as K8sStatefulSetsListPayload,
|
query as K8sStatefulSetsListPayload,
|
||||||
{
|
{
|
||||||
@ -288,12 +293,24 @@ function K8sStatefulSetsList({
|
|||||||
|
|
||||||
const selectedStatefulSetData = useMemo(() => {
|
const selectedStatefulSetData = useMemo(() => {
|
||||||
if (!selectedStatefulSetUID) return null;
|
if (!selectedStatefulSetUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
return (
|
||||||
|
nestedStatefulSetsData.find(
|
||||||
|
(statefulSet) => statefulSet.statefulSetName === selectedStatefulSetUID,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
statefulSetsData.find(
|
statefulSetsData.find(
|
||||||
(statefulSet) => statefulSet.statefulSetName === selectedStatefulSetUID,
|
(statefulSet) => statefulSet.statefulSetName === selectedStatefulSetUID,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedStatefulSetUID, statefulSetsData]);
|
}, [
|
||||||
|
selectedStatefulSetUID,
|
||||||
|
groupBy.length,
|
||||||
|
statefulSetsData,
|
||||||
|
nestedStatefulSetsData,
|
||||||
|
]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sStatefulSetsRowData): void => {
|
const handleRowClick = (record: K8sStatefulSetsRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -346,6 +363,10 @@ function K8sStatefulSetsList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedStatefulSetUID(record.statefulsetUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
@ -198,6 +198,11 @@ function K8sVolumesList({
|
|||||||
[groupedByRowData, groupBy],
|
[groupedByRowData, groupBy],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const nestedVolumesData = useMemo(() => {
|
||||||
|
if (!selectedRowData || !groupedByRowData?.payload?.data.records) return [];
|
||||||
|
return groupedByRowData?.payload?.data?.records || [];
|
||||||
|
}, [groupedByRowData, selectedRowData]);
|
||||||
|
|
||||||
const { data, isFetching, isLoading, isError } = useGetK8sVolumesList(
|
const { data, isFetching, isLoading, isError } = useGetK8sVolumesList(
|
||||||
query as K8sVolumesListPayload,
|
query as K8sVolumesListPayload,
|
||||||
{
|
{
|
||||||
@ -278,12 +283,19 @@ function K8sVolumesList({
|
|||||||
|
|
||||||
const selectedVolumeData = useMemo(() => {
|
const selectedVolumeData = useMemo(() => {
|
||||||
if (!selectedVolumeUID) return null;
|
if (!selectedVolumeUID) return null;
|
||||||
|
if (groupBy.length > 0) {
|
||||||
|
return (
|
||||||
|
nestedVolumesData.find(
|
||||||
|
(volume) => volume.persistentVolumeClaimName === selectedVolumeUID,
|
||||||
|
) || null
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
volumesData.find(
|
volumesData.find(
|
||||||
(volume) => volume.persistentVolumeClaimName === selectedVolumeUID,
|
(volume) => volume.persistentVolumeClaimName === selectedVolumeUID,
|
||||||
) || null
|
) || null
|
||||||
);
|
);
|
||||||
}, [selectedVolumeUID, volumesData]);
|
}, [selectedVolumeUID, volumesData, groupBy.length, nestedVolumesData]);
|
||||||
|
|
||||||
const handleRowClick = (record: K8sVolumesRowData): void => {
|
const handleRowClick = (record: K8sVolumesRowData): void => {
|
||||||
if (groupBy.length === 0) {
|
if (groupBy.length === 0) {
|
||||||
@ -336,6 +348,10 @@ function K8sVolumesList({
|
|||||||
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
indicator: <Spin indicator={<LoadingOutlined size={14} spin />} />,
|
||||||
}}
|
}}
|
||||||
showHeader={false}
|
showHeader={false}
|
||||||
|
onRow={(record): { onClick: () => void; className: string } => ({
|
||||||
|
onClick: (): void => setselectedVolumeUID(record.volumeUID),
|
||||||
|
className: 'expanded-clickable-row',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{groupedByRowData?.payload?.data?.total &&
|
{groupedByRowData?.payload?.data?.total &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user