Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
56 changes: 54 additions & 2 deletions src/components/VDiskInfo/VDiskInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import {Flex} from '@gravity-ui/uikit';
import {getVDiskPagePath} from '../../routes';
import {valueIsDefined} from '../../utils';
import {cn} from '../../utils/cn';
import {formatStorageValuesToGb} from '../../utils/dataFormatters/dataFormatters';
import {
formatStorageValuesToGb,
formatUptimeInSeconds,
stringifyVdiskId,
} from '../../utils/dataFormatters/dataFormatters';
import {createVDiskDeveloperUILink} from '../../utils/developerUI/developerUI';
import {getSeverityColor} from '../../utils/disks/helpers';
import {getSeverityColor, isFullVDiskData} from '../../utils/disks/helpers';
import type {PreparedVDisk} from '../../utils/disks/types';
import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedToMakeChanges';
import {bytesToSpeed} from '../../utils/utils';
Expand Down Expand Up @@ -46,6 +50,9 @@ export function VDiskInfo<T extends PreparedVDisk>({
FrontQueues,
Guid,
Replicated,
ReplicationProgress,
ReplicationSecondsRemaining,
Donors,
VDiskState,
VDiskSlotId,
Kind,
Expand Down Expand Up @@ -130,6 +137,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
if (Replicated === false) {
if (valueIsDefined(ReplicationProgress)) {
rightColumn.push({
label: vDiskInfoKeyset('replication-progress'),
value: (
<ProgressViewer
value={ReplicationProgress}
capacity={1}
formatValues={(value, capacity) => [
`${Math.round((value || 0) * 100)}%`,
`${Math.round((capacity || 1) * 100)}%`,
]}
colorizeProgress={true}
inverseColorize={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 @@ -152,6 +188,22 @@ export function VDiskInfo<T extends PreparedVDisk>({
value: HasUnreadableBlobs ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
});
}
if (Donors && Donors.length > 0) {
const donorsList = Donors.map((donor) => {
const isFullData = isFullVDiskData(donor);
const donorId = stringifyVdiskId(isFullData ? donor.VDiskId : donor);
return donorId;
})
.filter(Boolean)
.join(', ');

if (donorsList) {
rightColumn.push({
label: vDiskInfoKeyset('donors'),
value: donorsList,
});
}
}

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
22 changes: 22 additions & 0 deletions src/components/VDiskPopup/VDiskPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {EFlag} from '../../types/api/enums';
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 +74,8 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
DiskSpace,
FrontQueues,
Replicated,
ReplicationProgress,
ReplicationSecondsRemaining,
UnsyncedVDisks,
AllocatedSize,
ReadThroughput,
Expand Down Expand Up @@ -127,6 +130,25 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>

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

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

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

if (UnsyncedVDisks) {
Expand Down