luci/modules/luci-base
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
..
htdocs luci-base: consolidate network.js data acquisition 2019-11-01 12:03:33 +01:00
luasrc luci-base: dispatcher.lua: support declarative node dependencies 2019-11-01 12:03:33 +01:00
po translation: weblate update 2019-10-30 16:49:47 -10:00
root luci-mod-network: interfaces.js: issue iface restart via file/exec rpc call 2019-11-01 12:03:33 +01:00
src build: add build option to minify *.js files 2018-11-22 12:49:14 +01:00
Makefile luci-base: depend on rpcd-mod-luci 2019-11-01 12:03:33 +01:00