Skip to content

Commit 3740536

Browse files
Copilotadameat
andcommitted
Fix replication fields visibility and color handling
- Only show replication progress and time remaining when disk is not replicated (Replicated=false) - Add inverseColorize=true to make 100% progress show as green instead of red - Update both VDiskInfo and VDiskPopup components to respect replication status Co-authored-by: adameat <[email protected]>
1 parent 8c89486 commit 3740536

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

src/components/VDiskInfo/VDiskInfo.tsx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -137,30 +137,34 @@ export function VDiskInfo<T extends PreparedVDisk>({
137137
value: Replicated ? vDiskInfoKeyset('yes') : vDiskInfoKeyset('no'),
138138
});
139139
}
140-
if (valueIsDefined(ReplicationProgress)) {
141-
rightColumn.push({
142-
label: vDiskInfoKeyset('replication-progress'),
143-
value: (
144-
<ProgressViewer
145-
value={ReplicationProgress}
146-
capacity={1}
147-
formatValues={(value, capacity) => [
148-
`${Math.round((value || 0) * 100)}%`,
149-
`${Math.round((capacity || 1) * 100)}%`,
150-
]}
151-
colorizeProgress={true}
152-
/>
153-
),
154-
});
155-
}
156-
if (valueIsDefined(ReplicationSecondsRemaining)) {
157-
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
158-
if (timeRemaining) {
140+
// Only show replication progress and time remaining when disk is not replicated
141+
if (Replicated === false) {
142+
if (valueIsDefined(ReplicationProgress)) {
159143
rightColumn.push({
160-
label: vDiskInfoKeyset('replication-time-remaining'),
161-
value: timeRemaining,
144+
label: vDiskInfoKeyset('replication-progress'),
145+
value: (
146+
<ProgressViewer
147+
value={ReplicationProgress}
148+
capacity={1}
149+
formatValues={(value, capacity) => [
150+
`${Math.round((value || 0) * 100)}%`,
151+
`${Math.round((capacity || 1) * 100)}%`,
152+
]}
153+
colorizeProgress={true}
154+
inverseColorize={true}
155+
/>
156+
),
162157
});
163158
}
159+
if (valueIsDefined(ReplicationSecondsRemaining)) {
160+
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
161+
if (timeRemaining) {
162+
rightColumn.push({
163+
label: vDiskInfoKeyset('replication-time-remaining'),
164+
value: timeRemaining,
165+
});
166+
}
167+
}
164168
}
165169
if (valueIsDefined(VDiskSlotId)) {
166170
rightColumn.push({label: vDiskInfoKeyset('slot-id'), value: VDiskSlotId});

src/components/VDiskPopup/VDiskPopup.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,25 @@ const prepareVDiskData = (data: PreparedVDisk, withDeveloperUILink?: boolean) =>
130130

131131
if (Replicated === false) {
132132
vdiskData.push({label: 'Replicated', value: 'NO'});
133-
}
134133

135-
if (valueIsDefined(ReplicationProgress)) {
136-
const progressPercent = Math.round(ReplicationProgress * 100);
137-
vdiskData.push({
138-
label: 'Replication Progress',
139-
value: `${progressPercent}%`,
140-
});
141-
}
142-
143-
if (valueIsDefined(ReplicationSecondsRemaining)) {
144-
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
145-
if (timeRemaining) {
134+
// Only show replication progress and time remaining when disk is not replicated
135+
if (valueIsDefined(ReplicationProgress)) {
136+
const progressPercent = Math.round(ReplicationProgress * 100);
146137
vdiskData.push({
147-
label: 'Time Remaining',
148-
value: timeRemaining,
138+
label: 'Replication Progress',
139+
value: `${progressPercent}%`,
149140
});
150141
}
142+
143+
if (valueIsDefined(ReplicationSecondsRemaining)) {
144+
const timeRemaining = formatUptimeInSeconds(ReplicationSecondsRemaining);
145+
if (timeRemaining) {
146+
vdiskData.push({
147+
label: 'Time Remaining',
148+
value: timeRemaining,
149+
});
150+
}
151+
}
151152
}
152153

153154
if (UnsyncedVDisks) {

0 commit comments

Comments
 (0)