'use strict'; 'require view'; 'require form'; 'require tools.widgets as widgets'; return view.extend({ render: function () { var m, s, o; m = new form.Map('watchcat', _('Watchcat'), _("Here you can set up several checks and actions to take in the event that a host becomes unreachable. \ Click the Add button at the bottom to set up more than one action.")); s = m.section(form.TypedSection, 'watchcat', _('Watchcat'), _('These rules will govern how this device reacts to network events.')); s.anonymous = true; s.addremove = true; s.tab('general', _('General Settings')); o = s.taboption('general', form.ListValue, 'mode', _('Mode'), _("Ping Reboot: Reboot this device if a ping to a specified host fails for a specified duration of time.
\ Periodic Reboot: Reboot this device after a specified interval of time.
\ Restart Interface: Restart a network interface if a ping to a specified host fails for a specified duration of time.
\ Run Script: Run a script if a ping to a specified host fails for a specified duration of time.
")); o.value('ping_reboot', _('Ping Reboot')); o.value('periodic_reboot', _('Periodic Reboot')); o.value('restart_iface', _('Restart Interface')); o.value('run_script', _('Run Script')); o = s.taboption('general', form.Value, 'script', _('Script to run'), _(`Script to run when the host has not responded for the specified duration of time. The script is passed the interface name as $1`)); o.datatype = 'file'; o.default = "/etc/watchcat.user.sh"; o.depends({ mode: "run_script" }); o = s.taboption('general', form.Value, 'period', _('Period'), _("In Periodic Reboot mode, it defines how often to reboot.
\ In Ping Reboot mode, it defines the longest period of \ time without a reply from the Host To Check before a reboot is engaged.
\ In Network Restart or Run Script mode, it defines the longest period of \ time without a reply from the Host to Check before the interface is restarted or the script is run. \

The default unit is seconds, without a suffix, but you can use the \ suffix m for minutes, h for hours or d \ for days.

Examples: