From ba43a9954c5fce2ead5313abd281d6cdc3817f4b Mon Sep 17 00:00:00 2001 From: jingrow Date: Sat, 9 Aug 2025 21:48:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E7=AB=AF=E9=98=B2?= =?UTF-8?q?=E7=81=AB=E5=A2=99=E5=88=97=E8=A1=A8=E9=A1=B5=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/JsiteServerFirewallRules.vue | 17 ++++++++++------- jcloud/api/aliyun_server_light.py | 9 +++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dashboard/src2/components/JsiteServerFirewallRules.vue b/dashboard/src2/components/JsiteServerFirewallRules.vue index acd19d0..f0f79a0 100644 --- a/dashboard/src2/components/JsiteServerFirewallRules.vue +++ b/dashboard/src2/components/JsiteServerFirewallRules.vue @@ -69,9 +69,6 @@ @change="toggleSelectAll" /> - - 规则ID - 协议 @@ -101,9 +98,6 @@ :disabled="rule.isNew" /> - - {{ rule.rule_id || '-' }} -
@@ -143,7 +137,16 @@
-
+ +
+ +
+
{{ rule.source_cidr_ip || '0.0.0.0/0' }}
diff --git a/jcloud/api/aliyun_server_light.py b/jcloud/api/aliyun_server_light.py index 457d620..8e884a1 100644 --- a/jcloud/api/aliyun_server_light.py +++ b/jcloud/api/aliyun_server_light.py @@ -1845,7 +1845,7 @@ def get_jingrow_firewall_rules(**data): """获取防火墙规则(从本地数据库获取,支持分页)""" try: instance_id = data.get('instance_id') - limit = data.get('limit', 20) + limit = data.get('limit', 10) pageno = data.get('pageno', 1) if not instance_id: @@ -1867,7 +1867,8 @@ def get_jingrow_firewall_rules(**data): firewall_rules = jingrow.get_all( "Firewall Rules", {"parent": server_record.name}, - ["name", "rule_id", "rule_protocol", "port", "source_cidr_ip", "remark"] + ["name", "rule_id", "rule_protocol", "port", "source_cidr_ip", "remark", "idx"], + order_by="idx desc" ) # 转换为API格式的数据结构 @@ -1882,8 +1883,8 @@ def get_jingrow_firewall_rules(**data): } all_items.append(item) - # 对所有记录按协议排序 - sorted_items = sorted(all_items, key=lambda x: x.get('rule_protocol', '')) + # 数据已经按idx降序排列(最新添加的在前面),无需再次排序 + sorted_items = all_items # 计算分页 total = len(sorted_items)