From 44cb42a004b8334d784814c5f616c8d8ceda6b22 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Fri, 13 Sep 2024 19:44:52 +0800
Subject: [PATCH 4/5] luci-mod-status: firewall: disable legacy firewall rule
 warning

Signed-off-by: sbwml <admin@cooluc.com>
---
 .../resources/view/status/nftables.js         | 14 --------------
 .../share/luci/menu.d/luci-mod-status.json    | 19 ++++++++++++++++---
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
index be62d91..1718494 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
@@ -672,26 +672,12 @@ return view.extend({
 		return node;
 	},
 
-	checkLegacyRules: function(ipt4save, ipt6save) {
-		if (ipt4save.match(/\n-A /) || ipt6save.match(/\n-A /)) {
-			ui.addNotification(_('Legacy rules detected'), [
-				E('p', _('There are legacy iptables rules present on the system. Mixing iptables and nftables rules is discouraged and may lead to incomplete traffic filtering.')),
-				E('button', {
-					'class': 'btn cbi-button',
-					'click': function() { location.href = 'nftables/iptables' }
-				}, _('Open iptables rules overview…'))
-			], 'warning');
-		}
-	},
-
 	render: function(data) {
 		var view = E('div'),
 		    nft = data[0],
 		    ipt = data[1],
 		    ipt6 = data[2];
 
-		this.checkLegacyRules(ipt, ipt6);
-
 		if (!Array.isArray(nft.nftables))
 			return E('em', _('No nftables ruleset loaded.'));
 
diff --git a/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
index 190eef0..e9cf485 100644
--- a/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
+++ b/modules/luci-mod-status/root/usr/share/luci/menu.d/luci-mod-status.json
@@ -39,20 +39,33 @@
 		}
 	},
 
-	"admin/status/nftables": {
+	"admin/status/firewall": {
 		"title": "Firewall",
 		"order": 3,
+		"action": {
+			"type": "alias",
+			"path": "admin/status/firewall/nftables"
+		},
+		"depends": {
+			"acl": [ "luci-mod-status-firewall" ]
+		}
+	},
+
+	"admin/status/firewall/nftables": {
+		"title": "NFtables Firewall",
+		"order": 1,
 		"action": {
 			"type": "view",
 			"path": "status/nftables"
 		},
 		"depends": {
-			"acl": [ "luci-mod-status-firewall" ],
 			"fs": { "/usr/sbin/nft": "executable" }
 		}
 	},
 
-	"admin/status/nftables/iptables": {
+	"admin/status/firewall/iptables": {
+		"title": "IPtables Firewall",
+		"order": 2,
 		"action": {
 			"type": "view",
 			"path": "status/iptables"
-- 
2.42.0