Rework LuCI build system
[project/luci.git] / applications / luci-app-watchcat / luasrc / model / cbi / watchcat / watchcat.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2012 Christian Gagneraud <chris@techworks.ie>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 m = Map("system", 
16         translate("Watchcat"), 
17         translate("Watchcat allows configuring a periodic reboot when the " ..
18                   "Internet connection has been lost for a certain period of time."
19                  ))
20
21 s = m:section(TypedSection, "watchcat")
22 s.anonymous = true
23 s.addremove = true
24
25 mode = s:option(ListValue, "mode",
26                 translate("Operating mode"))
27 mode.default = "allways"
28 mode:value("ping", "Reboot on internet connection lost")
29 mode:value("allways", "Periodic reboot")
30
31 forcedelay = s:option(Value, "forcedelay",
32                       translate("Forced reboot delay"),
33                       translate("When rebooting the system, the watchcat will trigger a soft reboot. " ..
34                                 "Entering a non zero value here will trigger a delayed hard reboot " ..
35                                 "if the soft reboot fails. Enter a number of seconds to enable, " ..
36                                 "use 0 to disable"))
37 forcedelay.datatype = "uinteger"
38 forcedelay.default = "0"
39
40 period = s:option(Value, "period", 
41                   translate("Period"),
42                   translate("In periodic mode, it defines the reboot period. " ..
43                             "In internet mode, it defines the longest period of " .. 
44                             "time without internet access before a reboot is engaged." ..
45                             "Default unit is seconds, you can use the " ..
46                             "suffix 'm' for minutes, 'h' for hours or 'd' " ..
47                             "for days"))
48
49 pinghost = s:option(Value, "pinghosts", 
50                     translate("Ping host"),
51                     translate("Host address to ping"))
52 pinghost.datatype = "host"
53 pinghost.default = "8.8.8.8"
54 pinghost:depends({mode="ping"})
55
56 pingperiod = s:option(Value, "pingperiod", 
57                       translate("Ping period"),
58                       translate("How often to check internet connection. " ..
59                                 "Default unit is seconds, you can you use the " ..
60                                 "suffix 'm' for minutes, 'h' for hours or 'd' " ..
61                                 "for days"))
62 pingperiod:depends({mode="ping"})
63
64 return m