@@ -12,7 +12,6 @@ import type {PreparedVDisk} from '../../utils/disks/types';
1212import { useIsUserAllowedToMakeChanges } from '../../utils/hooks/useIsUserAllowedToMakeChanges' ;
1313import { bytesToSpeed } from '../../utils/utils' ;
1414import { InfoViewer } from '../InfoViewer' ;
15- import type { InfoViewerProps } from '../InfoViewer/InfoViewer' ;
1615import { LinkWithIcon } from '../LinkWithIcon/LinkWithIcon' ;
1716import { ProgressViewer } from '../ProgressViewer/ProgressViewer' ;
1817import { StatusIcon } from '../StatusIcon/StatusIcon' ;
@@ -23,18 +22,21 @@ import './VDiskInfo.scss';
2322
2423const b = cn ( 'ydb-vdisk-info' ) ;
2524
26- interface VDiskInfoProps < T extends PreparedVDisk > extends Omit < InfoViewerProps , 'info' > {
25+ interface VDiskInfoProps < T extends PreparedVDisk > {
2726 data ?: T ;
2827 withVDiskPageLink ?: boolean ;
2928 withTitle ?: boolean ;
29+ className ?: string ;
30+ wrap ?: true ;
3031}
3132
3233// eslint-disable-next-line complexity
3334export function VDiskInfo < T extends PreparedVDisk > ( {
3435 data,
3536 withVDiskPageLink,
3637 withTitle,
37- ...infoViewerProps
38+ className,
39+ wrap,
3840} : VDiskInfoProps < T > ) {
3941 const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges ( ) ;
4042
@@ -59,22 +61,27 @@ export function VDiskInfo<T extends PreparedVDisk>({
5961 NodeId,
6062 } = data || { } ;
6163
62- const vdiskInfo = [ ] ;
64+ const generalInfo = [ ] ;
65+ const statuses = [ ] ;
66+ const stats = [ ] ;
67+ const additionalParams = [ ] ;
6368
6469 if ( valueIsDefined ( VDiskSlotId ) ) {
65- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'slot-id' ) , value : VDiskSlotId } ) ;
70+ generalInfo . push ( { label : vDiskInfoKeyset ( 'slot-id' ) , value : VDiskSlotId } ) ;
6671 }
6772 if ( valueIsDefined ( StoragePoolName ) ) {
68- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'pool-name' ) , value : StoragePoolName } ) ;
73+ generalInfo . push ( { label : vDiskInfoKeyset ( 'pool-name' ) , value : StoragePoolName } ) ;
6974 }
75+
7076 if ( valueIsDefined ( VDiskState ) ) {
71- vdiskInfo . push ( {
77+ statuses . push ( {
7278 label : vDiskInfoKeyset ( 'state-status' ) ,
7379 value : VDiskState ,
7480 } ) ;
7581 }
82+
7683 if ( Number ( AllocatedSize ) >= 0 && Number ( AvailableSize ) >= 0 ) {
77- vdiskInfo . push ( {
84+ stats . push ( {
7885 label : vDiskInfoKeyset ( 'size' ) ,
7986 value : (
8087 < ProgressViewer
@@ -87,61 +94,62 @@ export function VDiskInfo<T extends PreparedVDisk>({
8794 } ) ;
8895 }
8996 if ( valueIsDefined ( Kind ) ) {
90- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'kind' ) , value : Kind } ) ;
97+ generalInfo . push ( { label : vDiskInfoKeyset ( 'kind' ) , value : Kind } ) ;
9198 }
9299 if ( valueIsDefined ( Guid ) ) {
93- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'guid' ) , value : Guid } ) ;
100+ generalInfo . push ( { label : vDiskInfoKeyset ( 'guid' ) , value : Guid } ) ;
94101 }
95102 if ( valueIsDefined ( IncarnationGuid ) ) {
96- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'incarnation-guid' ) , value : IncarnationGuid } ) ;
103+ generalInfo . push ( { label : vDiskInfoKeyset ( 'incarnation-guid' ) , value : IncarnationGuid } ) ;
97104 }
98105 if ( valueIsDefined ( InstanceGuid ) ) {
99- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'instance-guid' ) , value : InstanceGuid } ) ;
106+ generalInfo . push ( { label : vDiskInfoKeyset ( 'instance-guid' ) , value : InstanceGuid } ) ;
100107 }
108+
101109 if ( valueIsDefined ( Replicated ) ) {
102- vdiskInfo . push ( {
110+ statuses . push ( {
103111 label : vDiskInfoKeyset ( 'replication-status' ) ,
104112 value : Replicated ? vDiskInfoKeyset ( 'yes' ) : vDiskInfoKeyset ( 'no' ) ,
105113 } ) ;
106114 }
107115 if ( valueIsDefined ( DiskSpace ) ) {
108- vdiskInfo . push ( {
116+ statuses . push ( {
109117 label : vDiskInfoKeyset ( 'space-status' ) ,
110118 value : < StatusIcon status = { DiskSpace } /> ,
111119 } ) ;
112120 }
113121 if ( valueIsDefined ( SatisfactionRank ?. FreshRank ?. Flag ) ) {
114- vdiskInfo . push ( {
122+ statuses . push ( {
115123 label : vDiskInfoKeyset ( 'fresh-rank-satisfaction' ) ,
116124 value : < StatusIcon status = { SatisfactionRank ?. FreshRank ?. Flag } /> ,
117125 } ) ;
118126 }
119127 if ( valueIsDefined ( SatisfactionRank ?. LevelRank ?. Flag ) ) {
120- vdiskInfo . push ( {
128+ statuses . push ( {
121129 label : vDiskInfoKeyset ( 'level-rank-satisfaction' ) ,
122130 value : < StatusIcon status = { SatisfactionRank ?. LevelRank ?. Flag } /> ,
123131 } ) ;
124132 }
125133 if ( valueIsDefined ( FrontQueues ) ) {
126- vdiskInfo . push ( {
134+ statuses . push ( {
127135 label : vDiskInfoKeyset ( 'front-queues' ) ,
128136 value : < StatusIcon status = { FrontQueues } /> ,
129137 } ) ;
130138 }
131139 if ( valueIsDefined ( HasUnreadableBlobs ) ) {
132- vdiskInfo . push ( {
140+ statuses . push ( {
133141 label : vDiskInfoKeyset ( 'has-unreadable-blobs' ) ,
134142 value : HasUnreadableBlobs ? vDiskInfoKeyset ( 'yes' ) : vDiskInfoKeyset ( 'no' ) ,
135143 } ) ;
136144 }
137145 if ( valueIsDefined ( ReadThroughput ) ) {
138- vdiskInfo . push ( {
146+ stats . push ( {
139147 label : vDiskInfoKeyset ( 'read-throughput' ) ,
140148 value : bytesToSpeed ( ReadThroughput ) ,
141149 } ) ;
142150 }
143151 if ( valueIsDefined ( WriteThroughput ) ) {
144- vdiskInfo . push ( {
152+ stats . push ( {
145153 label : vDiskInfoKeyset ( 'write-throughput' ) ,
146154 value : bytesToSpeed ( WriteThroughput ) ,
147155 } ) ;
@@ -186,7 +194,7 @@ export function VDiskInfo<T extends PreparedVDisk>({
186194 }
187195
188196 if ( links . length ) {
189- vdiskInfo . push ( {
197+ additionalParams . push ( {
190198 label : vDiskInfoKeyset ( 'links' ) ,
191199 value : (
192200 < Flex wrap = "wrap" gap = { 2 } >
@@ -199,7 +207,20 @@ export function VDiskInfo<T extends PreparedVDisk>({
199207
200208 const title = data && withTitle ? < VDiskTitle data = { data } /> : null ;
201209
202- return < InfoViewer info = { vdiskInfo } title = { title } { ...infoViewerProps } /> ;
210+ // Component is used both on vdisk page and in popups
211+ // Display in two columns on page (row + wrap) and in one column in popups (column + nowrap)
212+ return (
213+ < Flex className = { className } gap = { 2 } direction = { wrap ? 'row' : 'column' } wrap = { wrap } >
214+ < Flex direction = "column" gap = { 2 } width = { 500 } >
215+ < InfoViewer title = { title } info = { generalInfo } renderEmptyState = { ( ) => null } />
216+ < InfoViewer info = { stats } renderEmptyState = { ( ) => null } />
217+ </ Flex >
218+ < Flex direction = "column" gap = { 2 } width = { 500 } >
219+ < InfoViewer info = { statuses } renderEmptyState = { ( ) => null } />
220+ < InfoViewer info = { additionalParams } renderEmptyState = { ( ) => null } />
221+ </ Flex >
222+ </ Flex >
223+ ) ;
203224}
204225
205226interface VDiskTitleProps < T extends PreparedVDisk > {
0 commit comments