Skip to content

Commit

Permalink
chore: fix expand issues
Browse files Browse the repository at this point in the history
  • Loading branch information
amlannandy committed Dec 19, 2024
1 parent 7f95f65 commit b5d57e1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/container/InfraMonitoringK8s/Nodes/K8sNodesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ function K8sNodesList({

const [currentPage, setCurrentPage] = useState(1);

const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);

const [orderBy, setOrderBy] = useState<{
columnName: string;
order: 'asc' | 'desc';
Expand Down Expand Up @@ -194,6 +196,12 @@ function K8sNodesList({

const handleGroupByRowClick = (record: K8sNodesRowData): void => {
setSelectedRowData(record);

if (expandedRowKeys.includes(record.key)) {
setExpandedRowKeys(expandedRowKeys.filter((key) => key !== record.key));
} else {
setExpandedRowKeys([record.key]);
}
};

useEffect(() => {
Expand Down Expand Up @@ -396,6 +404,7 @@ function K8sNodesList({
}

setGroupBy(groupBy);
setExpandedRowKeys([]);
},
[groupByFiltersData],
);
Expand Down Expand Up @@ -469,6 +478,7 @@ function K8sNodesList({
expandable={{
expandedRowRender: isGroupedByAttribute ? expandedRowRender : undefined,
expandIcon: expandRowIconRenderer,
expandedRowKeys,
}}
/>
)}
Expand Down

0 comments on commit b5d57e1

Please sign in to comment.