@@ -12,7 +12,6 @@ import type {PreparedVDisk} from '../../utils/disks/types';
12
12
import { useIsUserAllowedToMakeChanges } from '../../utils/hooks/useIsUserAllowedToMakeChanges' ;
13
13
import { bytesToSpeed } from '../../utils/utils' ;
14
14
import { InfoViewer } from '../InfoViewer' ;
15
- import type { InfoViewerProps } from '../InfoViewer/InfoViewer' ;
16
15
import { LinkWithIcon } from '../LinkWithIcon/LinkWithIcon' ;
17
16
import { ProgressViewer } from '../ProgressViewer/ProgressViewer' ;
18
17
import { StatusIcon } from '../StatusIcon/StatusIcon' ;
@@ -23,18 +22,21 @@ import './VDiskInfo.scss';
23
22
24
23
const b = cn ( 'ydb-vdisk-info' ) ;
25
24
26
- interface VDiskInfoProps < T extends PreparedVDisk > extends Omit < InfoViewerProps , 'info' > {
25
+ interface VDiskInfoProps < T extends PreparedVDisk > {
27
26
data ?: T ;
28
27
withVDiskPageLink ?: boolean ;
29
28
withTitle ?: boolean ;
29
+ className ?: string ;
30
+ wrap ?: true ;
30
31
}
31
32
32
33
// eslint-disable-next-line complexity
33
34
export function VDiskInfo < T extends PreparedVDisk > ( {
34
35
data,
35
36
withVDiskPageLink,
36
37
withTitle,
37
- ...infoViewerProps
38
+ className,
39
+ wrap,
38
40
} : VDiskInfoProps < T > ) {
39
41
const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges ( ) ;
40
42
@@ -59,22 +61,27 @@ export function VDiskInfo<T extends PreparedVDisk>({
59
61
NodeId,
60
62
} = data || { } ;
61
63
62
- const vdiskInfo = [ ] ;
64
+ const generalInfo = [ ] ;
65
+ const statuses = [ ] ;
66
+ const stats = [ ] ;
67
+ const additionalParams = [ ] ;
63
68
64
69
if ( valueIsDefined ( VDiskSlotId ) ) {
65
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'slot-id' ) , value : VDiskSlotId } ) ;
70
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'slot-id' ) , value : VDiskSlotId } ) ;
66
71
}
67
72
if ( valueIsDefined ( StoragePoolName ) ) {
68
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'pool-name' ) , value : StoragePoolName } ) ;
73
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'pool-name' ) , value : StoragePoolName } ) ;
69
74
}
75
+
70
76
if ( valueIsDefined ( VDiskState ) ) {
71
- vdiskInfo . push ( {
77
+ statuses . push ( {
72
78
label : vDiskInfoKeyset ( 'state-status' ) ,
73
79
value : VDiskState ,
74
80
} ) ;
75
81
}
82
+
76
83
if ( Number ( AllocatedSize ) >= 0 && Number ( AvailableSize ) >= 0 ) {
77
- vdiskInfo . push ( {
84
+ stats . push ( {
78
85
label : vDiskInfoKeyset ( 'size' ) ,
79
86
value : (
80
87
< ProgressViewer
@@ -87,61 +94,62 @@ export function VDiskInfo<T extends PreparedVDisk>({
87
94
} ) ;
88
95
}
89
96
if ( valueIsDefined ( Kind ) ) {
90
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'kind' ) , value : Kind } ) ;
97
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'kind' ) , value : Kind } ) ;
91
98
}
92
99
if ( valueIsDefined ( Guid ) ) {
93
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'guid' ) , value : Guid } ) ;
100
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'guid' ) , value : Guid } ) ;
94
101
}
95
102
if ( valueIsDefined ( IncarnationGuid ) ) {
96
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'incarnation-guid' ) , value : IncarnationGuid } ) ;
103
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'incarnation-guid' ) , value : IncarnationGuid } ) ;
97
104
}
98
105
if ( valueIsDefined ( InstanceGuid ) ) {
99
- vdiskInfo . push ( { label : vDiskInfoKeyset ( 'instance-guid' ) , value : InstanceGuid } ) ;
106
+ generalInfo . push ( { label : vDiskInfoKeyset ( 'instance-guid' ) , value : InstanceGuid } ) ;
100
107
}
108
+
101
109
if ( valueIsDefined ( Replicated ) ) {
102
- vdiskInfo . push ( {
110
+ statuses . push ( {
103
111
label : vDiskInfoKeyset ( 'replication-status' ) ,
104
112
value : Replicated ? vDiskInfoKeyset ( 'yes' ) : vDiskInfoKeyset ( 'no' ) ,
105
113
} ) ;
106
114
}
107
115
if ( valueIsDefined ( DiskSpace ) ) {
108
- vdiskInfo . push ( {
116
+ statuses . push ( {
109
117
label : vDiskInfoKeyset ( 'space-status' ) ,
110
118
value : < StatusIcon status = { DiskSpace } /> ,
111
119
} ) ;
112
120
}
113
121
if ( valueIsDefined ( SatisfactionRank ?. FreshRank ?. Flag ) ) {
114
- vdiskInfo . push ( {
122
+ statuses . push ( {
115
123
label : vDiskInfoKeyset ( 'fresh-rank-satisfaction' ) ,
116
124
value : < StatusIcon status = { SatisfactionRank ?. FreshRank ?. Flag } /> ,
117
125
} ) ;
118
126
}
119
127
if ( valueIsDefined ( SatisfactionRank ?. LevelRank ?. Flag ) ) {
120
- vdiskInfo . push ( {
128
+ statuses . push ( {
121
129
label : vDiskInfoKeyset ( 'level-rank-satisfaction' ) ,
122
130
value : < StatusIcon status = { SatisfactionRank ?. LevelRank ?. Flag } /> ,
123
131
} ) ;
124
132
}
125
133
if ( valueIsDefined ( FrontQueues ) ) {
126
- vdiskInfo . push ( {
134
+ statuses . push ( {
127
135
label : vDiskInfoKeyset ( 'front-queues' ) ,
128
136
value : < StatusIcon status = { FrontQueues } /> ,
129
137
} ) ;
130
138
}
131
139
if ( valueIsDefined ( HasUnreadableBlobs ) ) {
132
- vdiskInfo . push ( {
140
+ statuses . push ( {
133
141
label : vDiskInfoKeyset ( 'has-unreadable-blobs' ) ,
134
142
value : HasUnreadableBlobs ? vDiskInfoKeyset ( 'yes' ) : vDiskInfoKeyset ( 'no' ) ,
135
143
} ) ;
136
144
}
137
145
if ( valueIsDefined ( ReadThroughput ) ) {
138
- vdiskInfo . push ( {
146
+ stats . push ( {
139
147
label : vDiskInfoKeyset ( 'read-throughput' ) ,
140
148
value : bytesToSpeed ( ReadThroughput ) ,
141
149
} ) ;
142
150
}
143
151
if ( valueIsDefined ( WriteThroughput ) ) {
144
- vdiskInfo . push ( {
152
+ stats . push ( {
145
153
label : vDiskInfoKeyset ( 'write-throughput' ) ,
146
154
value : bytesToSpeed ( WriteThroughput ) ,
147
155
} ) ;
@@ -186,7 +194,7 @@ export function VDiskInfo<T extends PreparedVDisk>({
186
194
}
187
195
188
196
if ( links . length ) {
189
- vdiskInfo . push ( {
197
+ additionalParams . push ( {
190
198
label : vDiskInfoKeyset ( 'links' ) ,
191
199
value : (
192
200
< Flex wrap = "wrap" gap = { 2 } >
@@ -199,7 +207,20 @@ export function VDiskInfo<T extends PreparedVDisk>({
199
207
200
208
const title = data && withTitle ? < VDiskTitle data = { data } /> : null ;
201
209
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
+ ) ;
203
224
}
204
225
205
226
interface VDiskTitleProps < T extends PreparedVDisk > {
0 commit comments