Skip to content

Commit 763bb57

Browse files
Copilotadameat
andcommitted
Fix VDisk replication UI issues: state condition, progress color, duplicate donors
Co-authored-by: adameat <[email protected]>
1 parent 3740536 commit 763bb57

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

src/components/VDiskInfo/VDiskInfo.tsx

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import React from 'react';
33
import {Flex} from '@gravity-ui/uikit';
44

55
import {getVDiskPagePath} from '../../routes';
6+
import {EVDiskState} from '../../types/api/vdisk';
67
import {valueIsDefined} from '../../utils';
78
import {cn} from '../../utils/cn';
89
import {
910
formatStorageValuesToGb,
1011
formatUptimeInSeconds,
11-
stringifyVdiskId,
1212
} from '../../utils/dataFormatters/dataFormatters';
1313
import {createVDiskDeveloperUILink} from '../../utils/developerUI/developerUI';
14-
import {getSeverityColor, isFullVDiskData} from '../../utils/disks/helpers';
14+
import {getSeverityColor} from '../../utils/disks/helpers';
1515
import type {PreparedVDisk} from '../../utils/disks/types';
1616
import {useIsUserAllowedToMakeChanges} from '../../utils/hooks/useIsUserAllowedToMakeChanges';
1717
import {bytesToSpeed} from '../../utils/utils';
@@ -52,7 +52,6 @@ export function VDiskInfo<T extends PreparedVDisk>({
5252
Replicated,
5353
ReplicationProgress,
5454
ReplicationSecondsRemaining,
55-
Donors,
5655
VDiskState,
5756
VDiskSlotId,
5857
Kind,
@@ -137,8 +136,8 @@ export function VDiskInfo<T extends PreparedVDisk>({
137136
value: Replicated ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
138137
});
139138
}
140-
// Only show replication progress and time remaining when disk is not replicated
141-
if (Replicated === false) {
139+
// Only show replication progress and time remaining when disk is not replicated and state is OK
140+
if (Replicated === false && VDiskState === EVDiskState.OK) {
142141
if (valueIsDefined(ReplicationProgress)) {
143142
rightColumn.push({
144143
label: vDiskInfoKeyset('replication-progress'),
@@ -152,6 +151,8 @@ export function VDiskInfo<T extends PreparedVDisk>({
152151
]}
153152
colorizeProgress={true}
154153
inverseColorize={true}
154+
dangerThreshold={0}
155+
warningThreshold={0}
155156
/>
156157
),
157158
});
@@ -188,22 +189,6 @@ export function VDiskInfo<T extends PreparedVDisk>({
188189
value: HasUnreadableBlobs ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
189190
});
190191
}
191-
if (Donors && Donors.length > 0) {
192-
const donorsList = Donors.map((donor) => {
193-
const isFullData = isFullVDiskData(donor);
194-
const donorId = stringifyVdiskId(isFullData ? donor.VDiskId : donor);
195-
return donorId;
196-
})
197-
.filter(Boolean)
198-
.join(', ');
199-
200-
if (donorsList) {
201-
rightColumn.push({
202-
label: vDiskInfoKeyset('donors'),
203-
value: donorsList,
204-
});
205-
}
206-
}
207192

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

src/components/VDiskPopup/VDiskPopup.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {Flex, Label} from '@gravity-ui/uikit';
44

55
import {selectNodesMap} from '../../store/reducers/nodesList';
66
import {EFlag} from '../../types/api/enums';
7+
import {EVDiskState} from '../../types/api/vdisk';
78
import {valueIsDefined} from '../../utils';
89
import {cn} from '../../utils/cn';
910
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
@@ -128,10 +129,10 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
128129
vdiskData.push({label: 'FrontQueues', value: FrontQueues});
129130
}
130131

131-
if (Replicated === false) {
132+
if (Replicated === false && VDiskState === EVDiskState.OK) {
132133
vdiskData.push({label: 'Replicated', value: 'NO'});
133134

134-
// Only show replication progress and time remaining when disk is not replicated
135+
// Only show replication progress and time remaining when disk is not replicated and state is OK
135136
if (valueIsDefined(ReplicationProgress)) {
136137
const progressPercent = Math.round(ReplicationProgress * 100);
137138
vdiskData.push({

0 commit comments

Comments
 (0)