@@ -3,7 +3,6 @@ import cn from 'bem-cn-lite';
33import DataTable , { Column , Settings , SortOrder } from '@yandex-cloud/react-data-table' ;
44import { Popover , PopoverBehavior } from '@yandex-cloud/uikit' ;
55
6- import Vdisk from '../Vdisk/Vdisk' ;
76import { Stack } from '../../../components/Stack/Stack' ;
87//@ts -ignore
98import EntityStatus from '../../../components/EntityStatus/EntityStatus' ;
@@ -16,6 +15,9 @@ import {bytesToGB, bytesToSpeed} from '../../../utils/utils';
1615//@ts -ignore
1716import { stringifyVdiskId } from '../../../utils' ;
1817
18+ import Vdisk from '../Vdisk/Vdisk' ;
19+ import { isFullDonorData } from '../utils' ;
20+
1921import './StorageGroups.scss' ;
2022
2123enum TableColumnsIds {
@@ -197,34 +199,38 @@ function StorageGroups({data, tableSettings, visibleEntities, nodes}: StorageGro
197199 header : tableColumnsNames [ TableColumnsIds . VDisks ] ,
198200 render : ( { value, row} ) => (
199201 < div className = { b ( 'vdisks-wrapper' ) } >
200- { _ . map ( value as TVDiskStateInfo [ ] , ( el ) => (
201- Array . isArray ( el . Donors ) && el . Donors . length > 0 ? (
202- < Stack className = { b ( 'vdisks-item' ) } key = { stringifyVdiskId ( el . VDiskId ) } >
203- < Vdisk
204- { ...el }
205- PoolName = { row [ TableColumnsIds . PoolName ] }
206- nodes = { nodes }
207- />
208- { el . Donors . map ( ( donor ) => (
202+ { _ . map ( value as TVDiskStateInfo [ ] , ( el ) => {
203+ const donors = Array . isArray ( el . Donors ) ? el . Donors . filter ( isFullDonorData ) : [ ] ;
204+
205+ return (
206+ donors . length > 0 ? (
207+ < Stack className = { b ( 'vdisks-item' ) } key = { stringifyVdiskId ( el . VDiskId ) } >
208+ < Vdisk
209+ { ...el }
210+ PoolName = { row [ TableColumnsIds . PoolName ] }
211+ nodes = { nodes }
212+ />
213+ { donors . map ( ( donor ) => (
214+ < Vdisk
215+ { ...donor }
216+ // donor and acceptor are always in the same group
217+ PoolName = { row [ TableColumnsIds . PoolName ] }
218+ nodes = { nodes }
219+ key = { stringifyVdiskId ( donor . VDiskId ) }
220+ />
221+ ) ) }
222+ </ Stack >
223+ ) : (
224+ < div className = { b ( 'vdisks-item' ) } key = { stringifyVdiskId ( el . VDiskId ) } >
209225 < Vdisk
210- { ...donor }
211- // donor and acceptor are always in the same group
226+ { ...el }
212227 PoolName = { row [ TableColumnsIds . PoolName ] }
213228 nodes = { nodes }
214- key = { stringifyVdiskId ( donor . VDiskId ) }
215229 />
216- ) ) }
217- </ Stack >
218- ) : (
219- < div className = { b ( 'vdisks-item' ) } key = { stringifyVdiskId ( el . VDiskId ) } >
220- < Vdisk
221- { ...el }
222- PoolName = { row [ TableColumnsIds . PoolName ] }
223- nodes = { nodes }
224- />
225- </ div >
226- )
227- ) ) }
230+ </ div >
231+ )
232+ ) ;
233+ } ) }
228234 </ div >
229235 ) ,
230236 align : DataTable . CENTER ,
0 commit comments