mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 16:43:18 +08:00
UME current alarms UI: ne_id, host_name, ne_type; drop object_name/user_label columns
API /v1/ume/alarms adds host_name and ne_type from inventory join; keyword matches host_name. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c06beecfe6
commit
ca12d66419
3 changed files with 17 additions and 6 deletions
|
|
@ -676,6 +676,7 @@ def ume_list_alarms(
|
|||
| UmeInventoryNE.ne_name.contains(kw)
|
||||
| UmeInventoryNE.user_label.contains(kw)
|
||||
| UmeInventoryNE.ip_address.contains(kw)
|
||||
| UmeInventoryNE.host_name.contains(kw)
|
||||
)
|
||||
total = int(stmt.count())
|
||||
rows = stmt.order_by(UmeAlarmCurrent.last_seen_at.desc()).offset((page - 1) * page_size).limit(page_size).all()
|
||||
|
|
@ -685,6 +686,8 @@ def ume_list_alarms(
|
|||
"ne_id": str(alarm.ne_id or ""),
|
||||
"ne_name": str((ne.ne_name if ne else "") or ""),
|
||||
"user_label": str((ne.user_label if ne else "") or ""),
|
||||
"host_name": str((ne.host_name if ne else "") or ""),
|
||||
"ne_type": str((ne.ne_type if ne else "") or ""),
|
||||
"object_name": str(alarm.object_name or ""),
|
||||
"event_type": str(alarm.event_type or ""),
|
||||
"native_probable_cause": str(alarm.native_probable_cause or ""),
|
||||
|
|
|
|||
|
|
@ -405,7 +405,11 @@ export function UmePage() {
|
|||
<section className="panel">
|
||||
<h2>当前告警</h2>
|
||||
<div className="filter-inline">
|
||||
<input value={curKeyword} placeholder="keyword" onChange={(e) => setCurKeyword(e.target.value)} />
|
||||
<input
|
||||
value={curKeyword}
|
||||
placeholder="keyword(告警键/原因/ne_name/host_name/ip 等)"
|
||||
onChange={(e) => setCurKeyword(e.target.value)}
|
||||
/>
|
||||
<input value={curNeId} placeholder="ne_id" onChange={(e) => setCurNeId(e.target.value)} />
|
||||
<select value={curSeverity} onChange={(e) => setCurSeverity(e.target.value)}>
|
||||
<option value="">全部级别</option>
|
||||
|
|
@ -426,8 +430,9 @@ export function UmePage() {
|
|||
<tr>
|
||||
<th>time_created</th>
|
||||
<th>severity</th>
|
||||
<th>user_label</th>
|
||||
<th>object_name</th>
|
||||
<th>ne_id</th>
|
||||
<th>host_name</th>
|
||||
<th>ne_type</th>
|
||||
<th>cause</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -441,14 +446,15 @@ export function UmePage() {
|
|||
className="link-btn"
|
||||
onClick={() => {
|
||||
setCurNeId(x.ne_id || "");
|
||||
setCurKeyword(x.user_label || x.ne_name || x.ne_id || "");
|
||||
setCurKeyword(x.ne_name || x.host_name || x.native_probable_cause || "");
|
||||
setCurPage(1);
|
||||
}}
|
||||
>
|
||||
{x.user_label || x.ne_name || x.ne_id}
|
||||
{x.ne_id}
|
||||
</button>
|
||||
</td>
|
||||
<td>{x.object_name}</td>
|
||||
<td>{x.host_name ?? ""}</td>
|
||||
<td>{x.ne_type ?? ""}</td>
|
||||
<td>{x.native_probable_cause}</td>
|
||||
</tr>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ export type UmeAlarmItem = {
|
|||
ne_id: string;
|
||||
ne_name: string;
|
||||
user_label: string;
|
||||
host_name?: string;
|
||||
ne_type?: string;
|
||||
object_name: string;
|
||||
event_type: string;
|
||||
native_probable_cause: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue