Overhaul of the highlight system
This commit is contained in:
@@ -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 }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user