summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-pbr/htdocs/luci-static
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2022-12-19 03:58:01 +0000
committerStan Grishin <stangri@melmac.ca>2022-12-19 03:58:32 +0000
commit54c3ba32f9a2327ca4fdb9c419fb842108b17894 (patch)
tree22306790b79421296a203d184d398215f161d03c /applications/luci-app-pbr/htdocs/luci-static
parenta27d2dbc32785c3389ea77a26714e7f6c67c9185 (diff)
luci-app-pbr: update to 1.0.1-1
* add more error/warning messages * better error/ubus error handling Signed-off-by: Stan Grishin <stangri@melmac.ca>
Diffstat (limited to 'applications/luci-app-pbr/htdocs/luci-static')
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js48
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js42
2 files changed, 77 insertions, 13 deletions
diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
index 3eb04d0dff..fbe8696c28 100644
--- a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
+++ b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js
@@ -111,8 +111,25 @@ var status = baseclass.extend({
]).then(function (data) {
// var replyStatus = data[0];
// var replyGateways = data[1];
- var reply = data[0][pkg.Name];
+ var reply;
var text;
+
+ if (data[0] && data[0][pkg.Name]) {
+ reply = data[0][pkg.Name];
+ }
+ else {
+ reply = {
+ enabled: null,
+ running: null,
+ running_iptables: null,
+ running_nft: null,
+ version: null,
+ gateways: null,
+ errors: [],
+ warnings: [],
+ };
+ }
+
var header = E('h2', {}, _("Policy Based Routing - Status"));
var statusTitle = E('label', { class: 'cbi-value-title' }, _("Service Status"));
if (reply.version) {
@@ -159,13 +176,19 @@ var status = baseclass.extend({
var textLabelsTable = {
warningResolverNotSupported: _("Resolver set (%s) is not supported on this system.").format(uci.get(pkg.Name, 'config', 'resolver_set')),
warningAGHVersionTooLow: _("Installed AdGuardHome (%s) doesn't support 'ipset_file' option."),
- warningPolicyProcess: _("%s")
+ warningPolicyProcessCMD: _("%s"),
+ warningTorUnsetParams: _("Please unset 'src_addr', 'src_port' and 'dest_port' for policy '%s'"),
+ warningTorUnsetProto: _("Please unset 'proto' or set 'proto' to 'all' for policy '%s'"),
+ warningTorUnsetChainIpt: _("Please unset 'chain' or set 'chain' to 'PREROUTING' for policy '%s'"),
+ warningTorUnsetChainNft: _("Please unset 'chain' or set 'chain' to 'prerouting' for policy '%s'"),
};
var warningsTitle = E('label', { class: 'cbi-value-title' }, _("Service Warnings"));
var text = "";
(reply.warnings).forEach(element => {
if (element.id && textLabelsTable[element.id]) {
- text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ if (element.id !== 'warningPolicyProcessCMD') {
+ text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ }
}
else {
text += _("Unknown Warning!") + "<br />";
@@ -180,8 +203,8 @@ var status = baseclass.extend({
if (reply.errors && reply.errors.length) {
var textLabelsTable = {
errorConfigValidation: _("Config (%s) validation failure!").format('/etc/config/' + pkg.Name),
- errorNoIpFull: _("%s binary cannot be found!").formate('ip-full'),
- errorNoIptables: _("%s binary cannot be found!").formate('iptables'),
+ errorNoIpFull: _("%s binary cannot be found!").format('ip-full'),
+ errorNoIptables: _("%s binary cannot be found!").format('iptables'),
errorNoIpset: _("Resolver set support (%s) requires ipset, but ipset binary cannot be found!").format(uci.get(pkg.Name, 'config', 'resolver_set')),
errorNoNft: _("Resolver set support (%s) requires nftables, but nft binary cannot be found!").format(uci.get(pkg.Name, 'config', 'resolver_set')),
errorResolverNotSupported: _("Resolver set (%s) is not supported on this system!").format(uci.get(pkg.Name, 'config', 'resolver_set')),
@@ -193,20 +216,29 @@ var status = baseclass.extend({
errorPolicyNoSrcDest: _("Policy '%s' has no source/destination parameters!"),
errorPolicyNoInterface: _("Policy '%s' has no assigned interface!"),
errorPolicyUnknownInterface: _("Policy '%s' has an unknown interface!"),
- errorPolicyProcess: _("Policy processing error (%s)!"),
+ errorPolicyProcessCMD: _("%s"),
errorFailedSetup: _("Failed to set up '%s'!"),
errorFailedReload: _("Failed to reload '%s'!"),
errorUserFileNotFound: _("Custom user file '%s' not found or empty!"),
ererrorUserFileSyntax: _("Syntax error in custom user file '%s'!"),
errorUserFileRunning: _("Error running custom user file '%s'!"),
errorUserFileNoCurl: _("Use of 'curl' is detected in custom user file '%s', but 'curl' isn't installed!"),
- errorNoGateways: _("Failed to set up any gateway!")
+ errorNoGateways: _("Failed to set up any gateway!"),
+ errorResolver: _("Resolver %s"),
+ errorPolicyProcessNoIpv6: _("Skipping IPv6 policy '%s' as IPv6 support is disabled"),
+ errorPolicyProcessUnknownFwmark: _("Unknown packet mark for interface '%s'"),
+ errorPolicyProcessMismatchFamily: _("Mismatched IP family between in policy %s"),
+ errorPolicyProcessUnknownProtocol: _("Unknown protocol in policy %s"),
+ errorPolicyProcessInsertionFailed: _("Insertion failed for both IPv4 and IPv6 for policy %s"),
+ errorPolicyProcessInsertionFailedIpv4: _("Insertion failed for IPv4 for policy %s"),
};
var errorsTitle = E('label', { class: 'cbi-value-title' }, _("Service Errors"));
var text = "";
(reply.errors).forEach(element => {
if (element.id && textLabelsTable[element.id]) {
- text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ if (element.id !== 'errorPolicyProcessCMD') {
+ text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ }
}
else {
text += _("Unknown Error!") + "<br />";
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("<i>adguardhome.ipset</i>") + "<br />"
+ }
+ else if (!(replyPlatform.adguardhome_ipset_support)) {
text += _("The %s is not supported on this system.").format("<i>adguardhome.ipset</i>") + "<br />"
}
- if (!(replyPlatform.dnsmasq_ipset_support)) {
+ if (replyPlatform.dnsmasq_ipset_support === null) {
+ text += _("The %s support is unknown.").format("<i>dnsmasq.ipset</i>") + "<br />"
+ }
+ else if (!(replyPlatform.dnsmasq_ipset_support)) {
text += _("The %s is not supported on this system.").format("<i>dnsmasq.ipset</i>") + "<br />"
}
- if (!(replyPlatform.dnsmasq_nftset_support)) {
+ if (replyPlatform.dnsmasq_nftset_support === null) {
+ text += _("The %s support is unknown.").format("<i>dnsmasq.nftset</i>") + "<br />"
+ }
+ else if (!(replyPlatform.dnsmasq_nftset_support)) {
text += _("The %s is not supported on this system.").format("<i>dnsmasq.nftset</i>") + "<br />"
}
text += _("Please check the %sREADME%s before changing this option.").format(