Overhaul of the highlight system

This commit is contained in:
iv_vuytsik
2026-01-21 03:16:52 +03:00
parent ce7e39debf
commit 87a1a628d3
13 changed files with 481 additions and 259 deletions

View File

@@ -1,6 +1,7 @@
import { NextResponse } from 'next/server'
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import * as statusColors from '@/lib/statusColors'
export async function GET() {
try {
@@ -50,15 +51,15 @@ export async function GET() {
}
const statusToColor: Record<string, string> = {
critical: '#b3261e',
warning: '#fd7c22',
normal: '#00ff00',
critical: statusColors.STATUS_COLOR_CRITICAL,
warning: statusColors.STATUS_COLOR_WARNING,
normal: statusColors.STATUS_COLOR_NORMAL,
}
const transformedDetectors: Record<string, any> = {}
const detectorsObj = detectorsPayload?.detectors ?? {}
for (const [key, sensor] of Object.entries<any>(detectorsObj)) {
const color = statusToColor[sensor.status] ?? '#00ff00'
const color = statusToColor[sensor.status] ?? statusColors.STATUS_COLOR_NORMAL
const objectId = titleToIdMap[sensor.object] || sensor.object
transformedDetectors[key] = {
...sensor,
@@ -100,4 +101,4 @@ export async function GET() {
{ status: 500 }
)
}
}
}