fix(alerts): читать согласованный снимок и реальные цели проб
This commit is contained in:
1 parent
dc5594ca7c
commit
c5c1c2812d
12 files changed
+114
-88
No files matched your search
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import type {AlertsResponse} from "@mmapp/contracts/alerts"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import {can} from "@/lib/auth"
|
||||
import {useAlertsTelegramPreview} from "@/hooks/use-alerts-telegram-preview"
|
||||
@@ -94,6 +95,7 @@ interface HistoryEntry {
|
||||
message: string
|
||||
time: string
|
||||
sent: boolean
|
||||
source?:"db"|"live"
|
||||
}
|
||||
|
||||
interface TelegramConfig {
|
||||
@@ -131,14 +133,7 @@ interface AlertsApiGroup {
|
||||
cooldownOverride: AlertCooldown | null
|
||||
}
|
||||
|
||||
interface AlertsApiHistoryEntry {
|
||||
id: string
|
||||
ruleName: string
|
||||
severity: AlertSeverity
|
||||
message: string
|
||||
sent: boolean
|
||||
firedAt: string
|
||||
}
|
||||
type AlertsApiHistoryEntry=AlertsResponse["history"][number]
|
||||
|
||||
interface AlertsServerRow {
|
||||
name: string
|
||||
@@ -259,7 +254,7 @@ function mapApiHistory(rows: AlertsApiHistoryEntry[]): HistoryEntry[] {
|
||||
severity: e.severity,
|
||||
message: e.message,
|
||||
time: formatRelativeRu(e.firedAt),
|
||||
sent: e.sent,
|
||||
sent: e.sent, source:e.source,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -819,7 +814,7 @@ function AlertRuleRow({ rule, onToggle, onDelete, onEdit, interactionsDisabled }
|
||||
|
||||
function HistoryCard({ entries }: { entries: HistoryEntry[] }) {
|
||||
return (
|
||||
<OpsPanel title="Журнал срабатываний" contentClassName="px-4 pb-4">
|
||||
<OpsPanel title="Журнал оповещений" description="Уведомления из БД и текущие проблемы мониторинга." contentClassName="px-4 pb-4">
|
||||
{entries.length === 0 ? (
|
||||
<p className="text-xs text-muted-foreground py-2">Нет срабатываний</p>
|
||||
) : (
|
||||
@@ -835,11 +830,11 @@ function HistoryCard({ entries }: { entries: HistoryEntry[] }) {
|
||||
<p className="text-[10px] text-muted-foreground whitespace-nowrap">{e.time}</p>
|
||||
<span className={cn(
|
||||
"text-[9px] font-medium px-1 py-0.5 rounded mt-0.5 inline-block",
|
||||
e.sent
|
||||
e.source==="live"||!e.source?"bg-muted text-muted-foreground":e.sent
|
||||
? "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400"
|
||||
: "bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-400",
|
||||
)}>
|
||||
{e.sent ? "✓ отправлено" : "✗ ошибка"}
|
||||
{e.source==="live"?"Мониторинг":!e.source?"Демо":e.sent?"API принял":"Не подтверждено"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user