Skip to content

Commit b1c44ed

Browse files
committed
fix(PDisk): display vdisks donors
1 parent 5ebaafd commit b1c44ed

File tree

5 files changed

+55
-19
lines changed

5 files changed

+55
-19
lines changed

src/components/Stack/Stack.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.stack {
22
--ydb-stack-base-z-index: 100;
3-
--ydb-stack-offset-x: 4px;
4-
--ydb-stack-offset-y: 4px;
5-
--ydb-stack-offset-x-hover: 4px;
6-
--ydb-stack-offset-y-hover: 8px;
3+
--ydb-stack-offset-x: 0px;
4+
--ydb-stack-offset-y: -4px;
5+
--ydb-stack-offset-x-hover: 0px;
6+
--ydb-stack-offset-y-hover: -8px;
77

88
position: relative;
99

src/containers/Storage/PDisk/PDisk.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
&__vdisks-item {
2222
flex-basis: 5px;
2323
flex-shrink: 0;
24+
25+
.stack__layer {
26+
background: var(--yc-color-base-background);
27+
28+
.data-table__row:hover & {
29+
background: var(--ydb-data-table-color-hover);
30+
}
31+
}
2432
}
2533

2634
&__media-type {

src/containers/Storage/PDisk/PDisk.tsx

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, {useEffect, useState, useRef, useMemo} from 'react';
22
import cn from 'bem-cn-lite';
33

44
import {InternalLink} from '../../../components/InternalLink';
5+
import {Stack} from '../../../components/Stack/Stack';
56

67
import routes, {createHref} from '../../../routes';
78
import {getVDisksForPDisk} from '../../../store/reducers/storage';
@@ -10,6 +11,7 @@ import {TVDiskStateInfo} from '../../../types/api/vdisk';
1011
import {stringifyVdiskId} from '../../../utils';
1112
import {useTypedSelector} from '../../../utils/hooks';
1213
import {getPDiskType} from '../../../utils/pdisk';
14+
import {isFullVDiksData} from '../../../utils/storage';
1315

1416
import {STRUCTURE} from '../../Node/NodePages';
1517

@@ -109,19 +111,42 @@ export const PDisk = ({nodeId, data: rawData = {}}: PDiskProps) => {
109111

110112
return (
111113
<div className={b('vdisks')}>
112-
{vdisks.map((vdisk) => (
113-
<div
114-
key={stringifyVdiskId(vdisk.VDiskId)}
115-
className={b('vdisks-item')}
116-
style={{
117-
// 1 is small enough for empty disks to be of the minimum width
118-
// but if all of them are empty, `flex-grow: 1` would size them evenly
119-
flexGrow: Number(vdisk.AllocatedSize) || 1,
120-
}}
121-
>
122-
<VDisk data={vdisk} compact />
123-
</div>
124-
))}
114+
{vdisks.map((vdisk) => {
115+
const donors = vdisk.Donors;
116+
117+
return (
118+
<div
119+
key={stringifyVdiskId(vdisk.VDiskId)}
120+
className={b('vdisks-item')}
121+
style={{
122+
// 1 is small enough for empty disks to be of the minimum width
123+
// but if all of them are empty, `flex-grow: 1` would size them evenly
124+
flexGrow: Number(vdisk.AllocatedSize) || 1,
125+
}}
126+
>
127+
{donors && donors.length ? (
128+
<Stack key={stringifyVdiskId(vdisk.VDiskId)}>
129+
<VDisk data={vdisk} compact />
130+
{donors.map((donor) => {
131+
const isFullData = isFullVDiksData(donor);
132+
133+
return (
134+
<VDisk
135+
compact
136+
data={donor}
137+
key={stringifyVdiskId(
138+
isFullData ? donor.VDiskId : donor,
139+
)}
140+
/>
141+
);
142+
})}
143+
</Stack>
144+
) : (
145+
<VDisk data={vdisk} compact />
146+
)}
147+
</div>
148+
);
149+
})}
125150
</div>
126151
);
127152
};

src/containers/Storage/StorageNodes/StorageNodes.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
.global-storage-nodes {
2+
&__pdisks-column {
3+
overflow: visible; // to enable stacked disks overflow the row
4+
}
5+
26
&__pdisks-wrapper {
37
display: flex;
4-
overflow-x: auto;
5-
overflow-y: hidden;
68
justify-content: left;
79
align-items: flex-end;
810

src/containers/Storage/StorageNodes/StorageNodes.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ function StorageNodes({
128128
},
129129
{
130130
name: TableColumnsIds.PDisks,
131+
className: b('pdisks-column'),
131132
header: tableColumnsNames[TableColumnsIds.PDisks],
132133
render: ({value, row}) => (
133134
<div className={b('pdisks-wrapper')}>

0 commit comments

Comments
 (0)