Merge pull request #578 from cshore/pull-request-validator-rework
[project/luci.git] / applications / luci-app-watchcat / luasrc / model / cbi / watchcat / watchcat.lua
1 -- Copyright 2012 Christian Gagneraud <chris@techworks.ie>
2 -- Licensed to the public under the Apache License 2.0.
3
4 m = Map("system", 
5         translate("Watchcat"), 
6         translate("Watchcat allows configuring a periodic reboot when the " ..
7                   "Internet connection has been lost for a certain period of time."
8                  ))
9
10 s = m:section(TypedSection, "watchcat")
11 s.anonymous = true
12 s.addremove = true
13
14 mode = s:option(ListValue, "mode",
15                 translate("Operating mode"))
16 mode.default = "allways"
17 mode:value("ping", "Reboot on internet connection lost")
18 mode:value("allways", "Periodic reboot")
19
20 forcedelay = s:option(Value, "forcedelay",
21                       translate("Forced reboot delay"),
22                       translate("When rebooting the system, the watchcat will trigger a soft reboot. " ..
23                                 "Entering a non zero value here will trigger a delayed hard reboot " ..
24                                 "if the soft reboot fails. Enter a number of seconds to enable, " ..
25                                 "use 0 to disable"))
26 forcedelay.datatype = "uinteger"
27 forcedelay.default = "0"
28
29 period = s:option(Value, "period", 
30                   translate("Period"),
31                   translate("In periodic mode, it defines the reboot period. " ..
32                             "In internet mode, it defines the longest period of " .. 
33                             "time without internet access before a reboot is engaged." ..
34                             "Default unit is seconds, you can use the " ..
35                             "suffix 'm' for minutes, 'h' for hours or 'd' " ..
36                             "for days"))
37
38 pinghost = s:option(Value, "pinghosts", 
39                     translate("Ping host"),
40                     translate("Host address to ping"))
41 pinghost.datatype = "host(1)"
42 pinghost.default = "8.8.8.8"
43 pinghost:depends({mode="ping"})
44
45 pingperiod = s:option(Value, "pingperiod", 
46                       translate("Ping period"),
47                       translate("How often to check internet connection. " ..
48                                 "Default unit is seconds, you can you use the " ..
49                                 "suffix 'm' for minutes, 'h' for hours or 'd' " ..
50                                 "for days"))
51 pingperiod:depends({mode="ping"})
52
53 return m