luci/modules/luci-base/luasrc
Jo-Philipp Wich 790005cdfa luci-base: dispatcher.lua: support declarative node dependencies
Introduce two new properties for page nodes to allow for declaratively
specifiying system dependencies which is useful to e.g. make certain
views depend on specific uci values or the presence of certain files.

The recognized properties are:

 - `uci_depends` - a nested table in one of the following forms:

     1) `{ config = { section = { option = "exact_value" } }`
     2) `{ config = { section = { option = true } }`
     3) `{ config = { section = "exact_type" } }`
     4) `{ config = { section = true } }`
     5) `{ config = true }`

   Depending on the declaration, the uci option or section type must either
   match the given "exact_value" or "exact_type" values or be a non-nil value
   in case boolean "true" is specified.

 - `file_depends` - a flat lists of file paths that must be accessible

   If a path listed in `file_depends` points to a directory, that directory
   must be not empty, otherwise it suffices if the path exists.

Examples:

 - Only display the node if an /etc/config/wireless file exists with
   a "config wifi-device radio0" section.

    node = page(...)
    node.uci_depends = { wireless = { radio0 = "wifi-device" } }

 - Only display the node when swconfig is installed.

    node = page(...)
    node.file_depends = { "/sbin/swconfig" }

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
..
cbi system-wide: fix escaping of magic chars 2019-06-29 19:26:07 +02:00
controller/admin luci-base: remove unused Lua code 2019-11-01 12:03:33 +01:00
model protocols: drop server side cbi implementations of protocol handlers 2019-09-10 15:28:16 +02:00
sgi Update my email addresses in the license headers 2015-01-16 23:49:44 +01:00
sys timezone data: update to 2019c 2019-09-28 21:51:35 +03:00
tools luci-base: remove unused Lua code 2019-11-01 12:03:33 +01:00
view luci-base: remove unused Lua code 2019-11-01 12:03:33 +01:00
cacheloader.lua Update my email addresses in the license headers 2015-01-16 23:49:44 +01:00
cbi.lua luci-base: switch from server side to client side widget markup 2019-07-07 15:36:24 +02:00
ccache.lua Update my email addresses in the license headers 2015-01-16 23:49:44 +01:00
config.lua Globally reduce copyright headers 2015-01-16 23:38:38 +01:00
debug.lua Rework LuCI build system 2015-01-08 16:26:20 +01:00
dispatcher.lua luci-base: dispatcher.lua: support declarative node dependencies 2019-11-01 12:03:33 +01:00
dispatcher.luadoc luci-base: dispatcher: remove tree modifier support 2018-11-27 14:46:55 +01:00
http.lua treewide: Fix typos in comments 2018-10-10 15:00:07 +08:00
http.luadoc treewide: Fix typos in comments 2018-10-10 15:00:07 +08:00
i18n.lua luci-base: remove unused i18n functions 2018-11-05 11:01:45 +01:00
i18n.luadoc luci-base: remove unused i18n functions 2018-11-05 11:01:45 +01:00
ltn12.lua Move inline documentation into separate files. 2015-01-29 16:26:46 +01:00
store.lua Update my email addresses in the license headers 2015-01-16 23:49:44 +01:00
sys.lua luci-mod-system: reimplement flashops as client side view 2019-09-24 14:21:08 +02:00
sys.luadoc luci-base: add luci.sys.process.exec() 2018-11-14 20:46:04 +01:00
template.lua treewide: Fix typos in UI strings 2018-10-12 22:18:51 +08:00
util.lua system-wide: fix escaping of magic chars 2019-06-29 19:26:07 +02:00
util.luadoc treewide: Fix typos in comments 2018-10-10 15:00:07 +08:00
version.lua Globally reduce copyright headers 2015-01-16 23:38:38 +01:00