Skip to content

feat(VDisk): add replication progress, remaining time, donors info #2588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 77 additions & 1 deletion src/components/VDiskInfo/VDiskInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ import React from 'react';
import {Flex} from '@gravity-ui/uikit';

import {getVDiskPagePath} from '../../routes';
import {EVDiskState} from '../../types/api/vdisk';
import {valueIsDefined} from '../../utils';
import {cn} from '../../utils/cn';
import {formatStorageValuesToGb} from '../../utils/dataFormatters/dataFormatters';
import {
formatStorageValuesToGb,
formatUptimeInSeconds,
} from '../../utils/dataFormatters/dataFormatters';
import {createVDiskDeveloperUILink} from '../../utils/developerUI/developerUI';
import {getSeverityColor} from '../../utils/disks/helpers';
import type {PreparedVDisk} from '../../utils/disks/types';
import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedToMakeChanges';
import {bytesToSpeed} from '../../utils/utils';
import {InfoViewer} from '../InfoViewer';
import {InternalLink} from '../InternalLink';
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
import {ProgressViewer} from '../ProgressViewer/ProgressViewer';
import {StatusIcon} from '../StatusIcon/StatusIcon';
Expand Down Expand Up @@ -46,6 +51,9 @@ export function VDiskInfo<T extends PreparedVDisk>({
FrontQueues,
Guid,
Replicated,
ReplicationProgress,
ReplicationSecondsRemaining,
Donors,
VDiskState,
VDiskSlotId,
Kind,
Expand Down Expand Up @@ -130,6 +138,35 @@ export function VDiskInfo<T extends PreparedVDisk>({
value: Replicated ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
});
}
// Only show replication progress and time remaining when disk is not replicated and state is OK
if (Replicated === false && VDiskState === EVDiskState.OK) {
if (valueIsDefined(ReplicationProgress)) {
rightColumn.push({
label: vDiskInfoKeyset('replication-progress'),
value: (
<ProgressViewer
value={ReplicationProgress}
capacity={1}
formatValues={(value) => [`${Math.round((value || 0) * 100)}%`]}
colorizeProgress={true}
inverseColorize={true}
dangerThreshold={0}
warningThreshold={0}
hideCapacity={true}
/>
),
});
}
if (valueIsDefined(ReplicationSecondsRemaining)) {
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
if (timeRemaining) {
rightColumn.push({
label: vDiskInfoKeyset('replication-time-remaining'),
value: timeRemaining,
});
}
}
}
if (valueIsDefined(VDiskSlotId)) {
rightColumn.push({label: vDiskInfoKeyset('slot-id'), value: VDiskSlotId});
}
Expand All @@ -153,6 +190,45 @@ export function VDiskInfo<T extends PreparedVDisk>({
});
}

// Show donors list when replication is in progress
if (Replicated === false && VDiskState === EVDiskState.OK && Donors && Donors.length > 0) {
const donorLinks = Donors.map((donor, index) => {
if (!donor.StringifiedId) {
return null;
}

// Parse StringifiedId format: "nodeId-pDiskId-vDiskSlotId"
const parts = donor.StringifiedId.split('-');
if (parts.length !== 3) {
return donor.StringifiedId;
}

const [nodeId, pDiskId, vDiskSlotId] = parts;
const vDiskPath = getVDiskPagePath({
nodeId: parseInt(nodeId),
pDiskId: parseInt(pDiskId),
vDiskSlotId: parseInt(vDiskSlotId),
});

return (
<InternalLink key={index} to={vDiskPath}>
{donor.StringifiedId}
</InternalLink>
);
}).filter(Boolean);

if (donorLinks.length > 0) {
rightColumn.push({
label: vDiskInfoKeyset('donors'),
value: (
<Flex direction="column" gap={1}>
{donorLinks}
</Flex>
),
});
}
}

const diskParamsDefined =
valueIsDefined(PDiskId) && valueIsDefined(NodeId) && valueIsDefined(VDiskSlotId);

Expand Down
3 changes: 3 additions & 0 deletions src/components/VDiskInfo/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"instance-guid": "Instance GUID",

"replication-status": "Replicated",
"replication-progress": "Replication Progress",
"replication-time-remaining": "Time Remaining",
"donors": "Donors",
"state-status": "VDisk State",
"space-status": "Disk Space",

Expand Down
25 changes: 24 additions & 1 deletion src/components/VDiskPopup/VDiskPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {Flex, Label} from '@gravity-ui/uikit';

import {selectNodesMap} from '../../store/reducers/nodesList';
import {EFlag} from '../../types/api/enums';
import {EVDiskState} from '../../types/api/vdisk';
import {valueIsDefined} from '../../utils';
import {cn} from '../../utils/cn';
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
import {formatUptimeInSeconds} from '../../utils/dataFormatters/dataFormatters';
import {createVDiskDeveloperUILink} from '../../utils/developerUI/developerUI';
import {isFullVDiskData} from '../../utils/disks/helpers';
import type {PreparedVDisk, UnavailableDonor} from '../../utils/disks/types';
Expand Down Expand Up @@ -73,6 +75,8 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
DiskSpace,
FrontQueues,
Replicated,
ReplicationProgress,
ReplicationSecondsRemaining,
UnsyncedVDisks,
AllocatedSize,
ReadThroughput,
Expand Down Expand Up @@ -125,8 +129,27 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
vdiskData.push({label: 'FrontQueues', value: FrontQueues});
}

if (Replicated === false) {
if (Replicated === false && VDiskState === EVDiskState.OK) {
vdiskData.push({label: 'Replicated', value: 'NO'});

// Only show replication progress and time remaining when disk is not replicated and state is OK
if (valueIsDefined(ReplicationProgress)) {
const progressPercent = Math.round(ReplicationProgress * 100);
vdiskData.push({
label: 'Progress',
value: `${progressPercent}%`,
});
}

if (valueIsDefined(ReplicationSecondsRemaining)) {
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
if (timeRemaining) {
vdiskData.push({
label: 'Remaining',
value: timeRemaining,
});
}
}
}

if (UnsyncedVDisks) {
Expand Down
23 changes: 21 additions & 2 deletions src/utils/disks/prepareDisks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,27 @@
const StringifiedId = stringifyVdiskId(VDiskId);

const preparedDonors = Donors?.map((donor) => {
return prepareWhiteboardVDiskData({...donor, DonorMode: true});
});
// Handle both TVDiskStateInfo and TVSlotId donor types
if (isFullVDiskData(donor)) {
// Full VDisk data
return prepareWhiteboardVDiskData({...donor, DonorMode: true});
} else {
// TVSlotId data - create a minimal PreparedVDisk
const {NodeId: dNodeId, PDiskId: dPDiskId, VSlotId} = donor;
const StringifiedId =

Check failure on line 73 in src/utils/disks/prepareDisks.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Delete `·`
valueIsDefined(dNodeId) && valueIsDefined(dPDiskId) && valueIsDefined(VSlotId)
? `${dNodeId}-${dPDiskId}-${VSlotId}`
: '';

Check failure on line 77 in src/utils/disks/prepareDisks.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Delete `············`
return {
NodeId: dNodeId,
PDiskId: dPDiskId,

Check failure on line 80 in src/utils/disks/prepareDisks.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Delete `·`
VDiskSlotId: VSlotId,
StringifiedId,
DonorMode: true,
} as PreparedVDisk;
}
}).filter((donor) => donor.StringifiedId);

return {
...restVDiskFields,
Expand Down
Loading