fix(monitor): remove UNAVAILABLE status, keep only OPERATIONAL/DEGRADED

This commit is contained in:
erio
2026-04-23 23:54:37 +08:00
parent 0dcc0e0504
commit f7c8377abf
2 changed files with 6 additions and 15 deletions

View File

@@ -67,7 +67,7 @@ import AutoRefreshButton from '@/components/common/AutoRefreshButton.vue'
import { useChannelMonitorFormat } from '@/composables/useChannelMonitorFormat'
export type MonitorWindow = '7d' | '15d' | '30d'
export type OverallStatus = 'operational' | 'degraded' | 'unavailable'
export type OverallStatus = 'operational' | 'degraded'
const props = defineProps<{
overallStatus: OverallStatus
@@ -106,10 +106,8 @@ const overallChipClass = computed(() => {
case 'operational':
return 'bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300'
case 'degraded':
return 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300'
case 'unavailable':
default:
return 'bg-red-100 text-red-700 dark:bg-red-500/15 dark:text-red-300'
return 'bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-300'
}
})
@@ -118,10 +116,8 @@ const overallDotClass = computed(() => {
case 'operational':
return 'bg-emerald-500 animate-pulse'
case 'degraded':
return 'bg-amber-500 animate-pulse'
case 'unavailable':
default:
return 'bg-red-500 animate-pulse'
return 'bg-amber-500 animate-pulse'
}
})

View File

@@ -75,16 +75,11 @@ const countdown = autoRefresh.countdown
// ── Computed ──
const overallStatus = computed<OverallStatus>(() => {
const total = items.value.length
if (total === 0) return 'operational'
let failCount = 0
let degradedCount = 0
if (items.value.length === 0) return 'operational'
for (const it of items.value) {
if (it.primary_status === 'failed' || it.primary_status === 'error') failCount++
else if (it.primary_status !== STATUS_OPERATIONAL) degradedCount++
if (it.primary_status === 'failed' || it.primary_status === 'error') return 'degraded'
if (it.primary_status !== STATUS_OPERATIONAL) return 'degraded'
}
if (failCount > total / 2) return 'unavailable'
if (failCount > 0 || degradedCount > 0) return 'degraded'
return 'operational'
})