summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2022-12-12 03:00:37 +0000
committerStan Grishin <stangri@melmac.ca>2022-12-12 03:00:37 +0000
commitf8cbfa11c6583f298f505b103c73781f6349eba8 (patch)
tree8bdb988a4fd7914fb4536673b84b803c2dcb0994
parent858252c7df9c2fd7237f14a94594cf29ddca5b18 (diff)
luci-app-pbr: Detect missing iptables & error-proofing WebUI
Signed-off-by: Stan Grishin <stangri@melmac.ca>
-rw-r--r--applications/luci-app-pbr/Makefile2
-rw-r--r--applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js19
-rw-r--r--applications/luci-app-pbr/po/templates/pbr.pot84
3 files changed, 64 insertions, 41 deletions
diff --git a/applications/luci-app-pbr/Makefile b/applications/luci-app-pbr/Makefile
index d18bdf78aa..ad7096e602 100644
--- a/applications/luci-app-pbr/Makefile
+++ b/applications/luci-app-pbr/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
-PKG_VERSION:=1.0.0-1
+PKG_VERSION:=1.0.0-2
LUCI_TITLE:=Policy Based Routing Service Web UI
LUCI_DESCRIPTION:=Provides Web UI for Policy Based Routing Service.
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 8cd36bca7c..3eb04d0dff 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
@@ -164,7 +164,12 @@ var status = baseclass.extend({
var warningsTitle = E('label', { class: 'cbi-value-title' }, _("Service Warnings"));
var text = "";
(reply.warnings).forEach(element => {
- text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ if (element.id && textLabelsTable[element.id]) {
+ text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ }
+ else {
+ text += _("Unknown Warning!") + "<br />";
+ }
});
var warningsText = E('div', {}, text);
var warningsField = E('div', { class: 'cbi-value-field' }, warningsText);
@@ -175,7 +180,8 @@ var status = baseclass.extend({
if (reply.errors && reply.errors.length) {
var textLabelsTable = {
errorConfigValidation: _("Config (%s) validation failure!").format('/etc/config/' + pkg.Name),
- errorNoIpFull: _("ip-full binary cannot be found!"),
+ errorNoIpFull: _("%s binary cannot be found!").formate('ip-full'),
+ errorNoIptables: _("%s binary cannot be found!").formate('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')),
@@ -187,7 +193,7 @@ 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: _("%s"),
+ errorPolicyProcess: _("Policy processing error (%s)!"),
errorFailedSetup: _("Failed to set up '%s'!"),
errorFailedReload: _("Failed to reload '%s'!"),
errorUserFileNotFound: _("Custom user file '%s' not found or empty!"),
@@ -199,7 +205,12 @@ var status = baseclass.extend({
var errorsTitle = E('label', { class: 'cbi-value-title' }, _("Service Errors"));
var text = "";
(reply.errors).forEach(element => {
- text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ if (element.id && textLabelsTable[element.id]) {
+ text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />";
+ }
+ else {
+ text += _("Unknown Error!") + "<br />";
+ }
});
var errorsText = E('div', {}, text);
var errorsField = E('div', { class: 'cbi-value-field' }, errorsText);
diff --git a/applications/luci-app-pbr/po/templates/pbr.pot b/applications/luci-app-pbr/po/templates/pbr.pot
index 69666517e3..c2e3c22845 100644
--- a/applications/luci-app-pbr/po/templates/pbr.pot
+++ b/applications/luci-app-pbr/po/templates/pbr.pot
@@ -2,10 +2,14 @@ msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:162
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:190
msgid "%s"
msgstr ""
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:183
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:184
+msgid "%s binary cannot be found!"
+msgstr ""
+
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:38
msgid ""
"%sWARNING:%s Please make sure to check the %sREADME%s before changing "
@@ -62,7 +66,7 @@ msgstr ""
msgid "Condensed output"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:177
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:182
msgid "Config (%s) validation failure!"
msgstr ""
@@ -74,7 +78,7 @@ msgstr ""
msgid "Custom User File Includes"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:193
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:199
msgid "Custom user file '%s' not found or empty!"
msgstr ""
@@ -90,7 +94,7 @@ msgstr ""
msgid "Default ICMP Interface"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:265
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:276
msgid "Disable"
msgstr ""
@@ -100,7 +104,7 @@ msgstr ""
msgid "Disabled"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:261
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:272
msgid "Disabling %s service"
msgstr ""
@@ -122,7 +126,7 @@ msgstr ""
msgid "Do not enforce policies when their gateway is down"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:254
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:265
msgid "Enable"
msgstr ""
@@ -133,11 +137,11 @@ msgstr ""
msgid "Enabled"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:250
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:261
msgid "Enabling %s service"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:195
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:201
msgid "Error running custom user file '%s'!"
msgstr ""
@@ -147,15 +151,15 @@ msgid ""
"QoS. Change with caution together with"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:192
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:198
msgid "Failed to reload '%s'!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:191
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:197
msgid "Failed to set up '%s'!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:197
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:203
msgid "Failed to set up any gateway!"
msgstr ""
@@ -231,15 +235,15 @@ msgstr ""
msgid "Policies"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:189
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:195
msgid "Policy '%s' has an unknown interface!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:188
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:194
msgid "Policy '%s' has no assigned interface!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:187
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:193
msgid "Policy '%s' has no source/destination parameters!"
msgstr ""
@@ -255,6 +259,10 @@ msgstr ""
msgid "Policy Routing"
msgstr ""
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:196
+msgid "Policy processing error (%s)!"
+msgstr ""
+
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:185
msgid "Protocol"
msgstr ""
@@ -267,7 +275,7 @@ msgstr ""
msgid "Remote ports"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:181
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:187
msgid "Resolver set (%s) is not supported on this system!"
msgstr ""
@@ -275,21 +283,21 @@ msgstr ""
msgid "Resolver set (%s) is not supported on this system."
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:179
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:185
msgid ""
"Resolver set support (%s) requires ipset, but ipset binary cannot be found!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:180
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:186
msgid ""
"Resolver set support (%s) requires nftables, but nft binary cannot be found!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:232
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:243
msgid "Restart"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:228
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:239
msgid "Restarting %s service"
msgstr ""
@@ -323,11 +331,11 @@ msgstr ""
msgid "Select Add for -A/add and Insert for -I/Insert."
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:289
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:300
msgid "Service Control"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:199
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:205
msgid "Service Errors"
msgstr ""
@@ -354,11 +362,11 @@ msgid ""
"%sREADME%s for details."
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:221
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:232
msgid "Start"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:217
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:228
msgid "Starting %s service"
msgstr ""
@@ -372,7 +380,7 @@ msgstr ""
msgid "Starting (WAN) Table ID number for tables created by the service."
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:243
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:254
msgid "Stop"
msgstr ""
@@ -384,7 +392,7 @@ msgstr ""
msgid "Stopped (version: %s)"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:239
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:250
msgid "Stopping %s service"
msgstr ""
@@ -408,7 +416,7 @@ msgstr ""
msgid "Suppress/No output"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:194
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:200
msgid "Syntax error in custom user file '%s'!"
msgstr ""
@@ -422,27 +430,35 @@ msgstr ""
msgid "The %s is not supported on this system."
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:183
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:189
msgid "The %s service failed to discover WAN gateway!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:182
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:188
msgid "The %s service is currently disabled!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:184
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:190
msgid "The ipset name '%s' is longer than allowed 31 characters!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:185
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:191
msgid "The nft set name '%s' is longer than allowed 31 characters!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:186
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:192
msgid "Unexpected exit or service termination: '%s'!"
msgstr ""
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:196
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:212
+msgid "Unknown Error!"
+msgstr ""
+
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:171
+msgid "Unknown Warning!"
+msgstr ""
+
+#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:202
msgid ""
"Use of 'curl' is detected in custom user file '%s', but 'curl' isn't "
"installed!"
@@ -473,7 +489,3 @@ msgstr ""
#: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:193
msgid "all"
msgstr ""
-
-#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:178
-msgid "ip-full binary cannot be found!"
-msgstr ""