From 54c3ba32f9a2327ca4fdb9c419fb842108b17894 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Mon, 19 Dec 2022 03:58:01 +0000 Subject: luci-app-pbr: update to 1.0.1-1 * add more error/warning messages * better error/ubus error handling Signed-off-by: Stan Grishin --- .../luci-static/resources/view/pbr/overview.js | 42 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr') diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js index 32bc6cb2de..e2d9d7b9b2 100644 --- a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js +++ b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js @@ -25,10 +25,33 @@ return view.extend({ L.resolveDefault(pbr.getInterfaces(), {}), L.resolveDefault(pbr.getPlatformSupport(), {}), ]).then(function (data) { - var arrInterfaces = data[0][pkg.Name].interfaces; - var replyPlatform = data[1][pkg.Name]; + var arrInterfaces; + var replyPlatform; var status, m, s, o; + if (data[0] && data[0][pkg.Name] && data[0][pkg.Name].interfaces) { + arrInterfaces = data[0][pkg.Name].interfaces; + } + else { + arrInterfaces = ["wan"]; + } + + if (data[1] && data[1][pkg.Name]) { + replyPlatform = data[1][pkg.Name]; + } + else { + replyPlatform = { + ipset_installed: null, + nft_installed: null, + adguardhome_installed: null, + dnsmasq_installed: null, + unbound_installed: null, + adguardhome_ipset_support: null, + dnsmasq_ipset_support: null, + dnsmasq_nftset_support: null, + }; + } + status = new pbr.status(); m = new form.Map(pkg.Name, _("Policy Based Routing - Configuration")); @@ -56,13 +79,22 @@ return view.extend({ o.default = "1"; var text = ""; - if (!(replyPlatform.adguardhome_ipset_support)) { + if (replyPlatform.adguardhome_ipset_support === null) { + text += _("The %s support is unknown.").format("adguardhome.ipset") + "
" + } + else if (!(replyPlatform.adguardhome_ipset_support)) { text += _("The %s is not supported on this system.").format("adguardhome.ipset") + "
" } - if (!(replyPlatform.dnsmasq_ipset_support)) { + if (replyPlatform.dnsmasq_ipset_support === null) { + text += _("The %s support is unknown.").format("dnsmasq.ipset") + "
" + } + else if (!(replyPlatform.dnsmasq_ipset_support)) { text += _("The %s is not supported on this system.").format("dnsmasq.ipset") + "
" } - if (!(replyPlatform.dnsmasq_nftset_support)) { + if (replyPlatform.dnsmasq_nftset_support === null) { + text += _("The %s support is unknown.").format("dnsmasq.nftset") + "
" + } + else if (!(replyPlatform.dnsmasq_nftset_support)) { text += _("The %s is not supported on this system.").format("dnsmasq.nftset") + "
" } text += _("Please check the %sREADME%s before changing this option.").format( -- cgit v1.2.3