Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 14 additions & 0 deletions src/utils/disks/__test__/calculateVDiskSeverity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ describe('VDisk state', () => {
expect(severity).not.toEqual(DISK_COLOR_STATE_TO_NUMERIC_SEVERITY.Blue);
});

test('Should not display VDisk as replicating if DiskSpace or FrontQueues are blue', () => {
const severity1 = calculateVDiskSeverity({
VDiskState: EVDiskState.OK,
FrontQueues: EFlag.Blue,
});
const severity2 = calculateVDiskSeverity({
VDiskState: EVDiskState.OK,
DiskSpace: EFlag.Blue,
});

expect(severity1).not.toEqual(DISK_COLOR_STATE_TO_NUMERIC_SEVERITY.Blue);
expect(severity2).not.toEqual(DISK_COLOR_STATE_TO_NUMERIC_SEVERITY.Blue);
});

test('Should display replicating VDisks in a not-OK state with a regular color', () => {
const severity1 = calculateVDiskSeverity({
VDiskState: EVDiskState.Initial, // severity 3, yellow
Expand Down
7 changes: 6 additions & 1 deletion src/utils/disks/calculateVDiskSeverity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {EFlag} from '../../types/api/enums';
import {EFlag} from '../../types/api/enums';
import type {EVDiskState} from '../../types/api/vdisk';

import {
Expand Down Expand Up @@ -52,5 +52,10 @@ function getColorSeverity(color?: EFlag) {
return NOT_AVAILABLE_SEVERITY;
}

// Blue is reserved for not replicated VDisks
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getColorSeverity is used to convert DiskSpace and FrontQueues flags to severity

if (color === EFlag.Blue) {
return DISK_COLOR_STATE_TO_NUMERIC_SEVERITY.Green;
}

return DISK_COLOR_STATE_TO_NUMERIC_SEVERITY[color] ?? NOT_AVAILABLE_SEVERITY;
}
Loading