From 6a07562b114647a3c1414e70e643d811caa87633 Mon Sep 17 00:00:00 2001 From: mufazalov Date: Fri, 4 Apr 2025 16:54:12 +0300 Subject: [PATCH 1/2] fix: use blue color only for not replicated vdisks --- src/utils/disks/calculateVDiskSeverity.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/disks/calculateVDiskSeverity.ts b/src/utils/disks/calculateVDiskSeverity.ts index 033a8b47fa..cdfa5cd33c 100644 --- a/src/utils/disks/calculateVDiskSeverity.ts +++ b/src/utils/disks/calculateVDiskSeverity.ts @@ -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 { @@ -52,5 +52,10 @@ function getColorSeverity(color?: EFlag) { return NOT_AVAILABLE_SEVERITY; } + // Blue is reserved for not replicated VDisks + if (color === EFlag.Blue) { + return DISK_COLOR_STATE_TO_NUMERIC_SEVERITY.Green; + } + return DISK_COLOR_STATE_TO_NUMERIC_SEVERITY[color] ?? NOT_AVAILABLE_SEVERITY; } From 7c7c3b2e613e330cdbf60dd7e55670a29943bc10 Mon Sep 17 00:00:00 2001 From: mufazalov Date: Mon, 7 Apr 2025 13:39:55 +0300 Subject: [PATCH 2/2] add tests --- .../disks/__test__/calculateVDiskSeverity.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/utils/disks/__test__/calculateVDiskSeverity.test.ts b/src/utils/disks/__test__/calculateVDiskSeverity.test.ts index aae7ddb18b..33a887d1d8 100644 --- a/src/utils/disks/__test__/calculateVDiskSeverity.test.ts +++ b/src/utils/disks/__test__/calculateVDiskSeverity.test.ts @@ -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