diff options
author | Pascal Coudurier <coudu@wanadoo.fr> | 2022-01-05 18:03:49 +0100 |
---|---|---|
committer | Pascal Coudurier <coudu@wanadoo.fr> | 2022-01-05 18:03:49 +0100 |
commit | b75d7b0e5da1c33624ed56b840e260ebcddda63e (patch) | |
tree | 3aa293bc89f2c504131dafbaf475488d65fe3e1a /applications/luci-app-nut/luasrc | |
parent | dc0ed9ca93c842d48613003e6f47b66c373e7148 (diff) |
luci-app-nut: nut-monitor fixes
Fix typo in lowbattnotify option
Remove duplicate lowbattnotify option
Fix notify validation preventing IGNORE to be set even alone
Add missing nocommnotify and noparentnotify options
Signed-off-by: Pascal Coudurier <coudu@wanadoo.fr>
Diffstat (limited to 'applications/luci-app-nut/luasrc')
-rw-r--r-- | applications/luci-app-nut/luasrc/model/cbi/nut_monitor.lua | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/applications/luci-app-nut/luasrc/model/cbi/nut_monitor.lua b/applications/luci-app-nut/luasrc/model/cbi/nut_monitor.lua index 2496259bad..b1bb1b850f 100644 --- a/applications/luci-app-nut/luasrc/model/cbi/nut_monitor.lua +++ b/applications/luci-app-nut/luasrc/model/cbi/nut_monitor.lua @@ -78,9 +78,9 @@ o.optional = true validatenotify = function(self, value) val = StaticList.validate(self, value) if val then - for k, v in pairs(val) do - if (v == 'IGNORE') then - return nil, "Ignore must the only option selected, when selected" + for i, v in ipairs(val) do + if (i > 1) and (v == 'IGNORE') then + return nil, "If selected, Ignore must be the only option." end end end @@ -112,7 +112,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "nowbattnotify", translate("Notify when low battery")) +o = s:option(StaticList, "lowbattnotify", translate("Notify when low battery")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -120,7 +120,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "nowbattnotify", translate("Notify when low battery")) +o = s:option(StaticList, "fsdnotify", translate("Notify when force shutdown")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -128,7 +128,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "fsdnotify", translate("Notify when force shutdown")) +o = s:option(StaticList, "comoknotify", translate("Notify when communications restored")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -136,7 +136,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "comoknotify", translate("Notify when communications restored")) +o = s:option(StaticList, "combadnotify", translate("Notify when communications lost")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -144,7 +144,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "combadnotify", translate("Notify when communications lost")) +o = s:option(StaticList, "shutdownotify", translate("Notify when shutting down")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -152,7 +152,7 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "shutdownotify", translate("Notify when shutting down")) +o = s:option(StaticList, "replbattnotify", translate("Notify when battery needs replacing")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) @@ -160,7 +160,15 @@ o:value("SYSLOG", translate("Write to syslog")) o:value("IGNORE", translate("Ignore")) o.validate = validatenotify -o = s:option(StaticList, "replbattnotify", translate("Notify when battery needs replacing")) +o = s:option(StaticList, "nocommnotify", translate("Notify when no communications")) +o.optional = true +o.widget = "select" +o:value("EXEC", translate("Execute notify command")) +o:value("SYSLOG", translate("Write to syslog")) +o:value("IGNORE", translate("Ignore")) +o.validate = validatenotify + +o = s:option(StaticList, "noparentnotify", translate("Notify when no parent process")) o.optional = true o.widget = "select" o:value("EXEC", translate("Execute notify command")) |