luci-app-firewall: add tooltip on rules that have time restrictions enabled
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 13 Jan 2021 09:46:39 +0000 (10:46 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Wed, 13 Jan 2021 11:33:29 +0000 (12:33 +0100)
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
applications/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js

index bacbbd704402be3100859b798bb845b99547700a..7c09eeadf6e41a725a7f7dd240749dd30d59bdce 100644 (file)
@@ -236,7 +236,19 @@ return view.extend({
                o.modalonly = false;
                o.default = o.enabled;
                o.editable = true;
+               o.tooltip = function(section_id) {
+                       var weekdays = uci.get('firewall', section_id, 'weekdays');
+                       var monthdays = uci.get('firewall', section_id, 'monthdays');
+                       var start_time = uci.get('firewall', section_id, 'start_time');
+                       var stop_time = uci.get('firewall', section_id, 'stop_time');
+                       var start_date = uci.get('firewall', section_id, 'start_date');
+                       var stop_date = uci.get('firewall', section_id, 'stop_date');
 
+                       if (weekdays || monthdays || start_time || stop_time || start_date || stop_date )
+                               return _('Time restritions are enabled for this rule');
+
+                       return null;
+               };
 
                o = s.taboption('advanced', form.ListValue, 'direction', _('Match device'));
                o.modalonly = true;