mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 02:00:46 +08:00
fix(netx): order current alarms by time_created desc
Sort UME current alarms by time_created descending (newest first) with last_seen_at and alarm_key as tie-breakers to keep offset/limit pagination stable. Apply the same default ordering in the MCP tool listing. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
16607db3cd
commit
47033f14ab
2 changed files with 20 additions and 2 deletions
|
|
@ -1069,7 +1069,16 @@ def ume_list_alarms(
|
|||
| 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()
|
||||
rows = (
|
||||
stmt.order_by(
|
||||
UmeAlarmCurrent.time_created.desc(),
|
||||
UmeAlarmCurrent.last_seen_at.desc(),
|
||||
UmeAlarmCurrent.alarm_key.desc(),
|
||||
)
|
||||
.offset((page - 1) * page_size)
|
||||
.limit(page_size)
|
||||
.all()
|
||||
)
|
||||
items = [
|
||||
{
|
||||
"alarm_key": str(alarm.alarm_key or ""),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue