Skip to content

Commit 2ebbecb

Browse files
Copilotadameat
andcommitted
Convert donors list to clickable links to VDisk pages
Co-authored-by: adameat <[email protected]>
1 parent 2ae6ca8 commit 2ebbecb

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src/components/VDiskInfo/VDiskInfo.tsx

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import type {PreparedVDisk} from '../../utils/disks/types';
1616
import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedToMakeChanges';
1717
import {bytesToSpeed} from '../../utils/utils';
1818
import {InfoViewer} from '../InfoViewer';
19+
import {InternalLink} from '../InternalLink';
1920
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
2021
import {ProgressViewer} from '../ProgressViewer/ProgressViewer';
2122
import {StatusIcon} from '../StatusIcon/StatusIcon';
@@ -191,14 +192,36 @@ export function VDiskInfo<T extends PreparedVDisk>({
191192

192193
// Show donors list when replication is in progress
193194
if (Replicated === false && VDiskState === EVDiskState.OK && Donors && Donors.length > 0) {
194-
const donorsList = Donors.map((donor) => donor.StringifiedId)
195-
.filter(Boolean)
196-
.join(', ');
195+
const donorLinks = Donors.map((donor, index) => {
196+
if (!donor.StringifiedId) {
197+
return null;
198+
}
199+
200+
// Parse StringifiedId format: "nodeId-pDiskId-vDiskSlotId"
201+
const parts = donor.StringifiedId.split('-');
202+
if (parts.length !== 3) {
203+
return donor.StringifiedId;
204+
}
205+
206+
const [nodeId, pDiskId, vDiskSlotId] = parts;
207+
const vDiskPath = getVDiskPagePath({
208+
nodeId: parseInt(nodeId),
209+
pDiskId: parseInt(pDiskId),
210+
vDiskSlotId: parseInt(vDiskSlotId),
211+
});
212+
213+
return (
214+
<React.Fragment key={index}>
215+
{index > 0 && ', '}
216+
<InternalLink to={vDiskPath}>{donor.StringifiedId}</InternalLink>
217+
</React.Fragment>
218+
);
219+
}).filter(Boolean);
197220

198-
if (donorsList) {
221+
if (donorLinks.length > 0) {
199222
rightColumn.push({
200223
label: vDiskInfoKeyset('donors'),
201-
value: donorsList,
224+
value: <>{donorLinks}</>,
202225
});
203226
}
204227
}

0 commit comments

Comments
 (0)