project/luci.git
4 years agoluci-base: move old cbi icons to luci-compat
Jo-Philipp Wich [Thu, 7 May 2020 17:15:02 +0000 (19:15 +0200)]
luci-base: move old cbi icons to luci-compat

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 102124115d4c2e204bf4cf1ffafe1d8b304fd0df)

4 years agoluci-base: replace filebrowser icons with SVG variants
Jo-Philipp Wich [Thu, 7 May 2020 17:38:50 +0000 (19:38 +0200)]
luci-base: replace filebrowser icons with SVG variants

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b34b7fc504ba4ba27dfe7c2c446c3085a923f952)

4 years agoluci-app-nlbwmon: use legacy `L.dom` attribute
Jo-Philipp Wich [Sat, 4 Apr 2020 10:00:20 +0000 (12:00 +0200)]
luci-app-nlbwmon: use legacy `L.dom` attribute

Until it is converted to a proper view, we need to use the legacy alias.

Fixes: #3835
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit af6fd6dfab2ac576033c714cc69520e17f1fa48c)

4 years agoluci-app-nlbw: simplify table CSS
Jo-Philipp Wich [Wed, 25 Mar 2020 11:48:11 +0000 (12:48 +0100)]
luci-app-nlbw: simplify table CSS

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 6efaea2ffb46f9909038b85cf12e7acf4467ae2e)

4 years agoluci-app-nlbwmon: fix typos
Balázs Úr [Fri, 27 Dec 2019 14:31:13 +0000 (15:31 +0100)]
luci-app-nlbwmon: fix typos

Signed-off-by: Balázs Úr <balazs@urbalazs.hu>
(cherry picked from commit 44cef2ab4493d8fb2d0bbdc0831a2e23cd2acf2c)

4 years agoluci-mod-status: convert menu nodes to JSON
Jo-Philipp Wich [Tue, 10 Dec 2019 07:49:24 +0000 (08:49 +0100)]
luci-mod-status: convert menu nodes to JSON

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit c698cd5ab9ad9021ac7b92a45d7ba401cb3617d0)

4 years agoluci-theme-material: fix Makefile file mod
Florian Eckert [Mon, 4 May 2020 10:43:17 +0000 (12:43 +0200)]
luci-theme-material: fix Makefile file mod

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 0024609a0057ffc6adad4fa33bfeb7202b8dd454)

4 years agoluci-theme-material: remove useless logging output
Florian Eckert [Thu, 16 Apr 2020 18:55:30 +0000 (20:55 +0200)]
luci-theme-material: remove useless logging output

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
(cherry picked from commit 1b875a610f0cb835f9472b55d726dc339f9af633)

4 years agoluci-theme-bootstrap: rework menu rendering
Jo-Philipp Wich [Wed, 15 Apr 2020 20:46:25 +0000 (22:46 +0200)]
luci-theme-bootstrap: rework menu rendering

Utilize the LuCI.ui.menu class to load, traverse and cache the menu tree
in the local session store.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
[only render menu when logged in for 19.07]
(backported from commit 1ac8df2614336b34109375e62f201cf6bac46734)

4 years agoluci-theme-openwrt: rework menu rendering
Jo-Philipp Wich [Wed, 15 Apr 2020 20:43:05 +0000 (22:43 +0200)]
luci-theme-openwrt: rework menu rendering

Utilize the LuCI.ui.menu class to load, traverse and cache the menu tree
in the local session store.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
[only render menu when logged in for 19.07]
(backported from commit 48269ade6163c34f348632bf225e2c6649b0a9c1)

4 years agoluci-base: implement JSON endpoint to fetch menu information
Jo-Philipp Wich [Wed, 15 Apr 2020 20:25:48 +0000 (22:25 +0200)]
luci-base: implement JSON endpoint to fetch menu information

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
[require authentication for 19.07]
(backported from commit e56e442d6af125522214a9bc9ab957ac39c5c0c8)

4 years agoluci-base: expose currently dispatched node info to client side JS
Jo-Philipp Wich [Wed, 15 Apr 2020 20:13:33 +0000 (22:13 +0200)]
luci-base: expose currently dispatched node info to client side JS

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 94a0c571810da25043ca3599561bd9b369c0c65e)

4 years agoluci-base: convert menu nodes to JSON
Jo-Philipp Wich [Fri, 6 Dec 2019 20:51:32 +0000 (21:51 +0100)]
luci-base: convert menu nodes to JSON

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 16853bcd2e4224c281731adbfa490d704784ec20)

4 years agoluci-base: ui.js: hide unsatisfied firstchild menu nodes
Jo-Philipp Wich [Sat, 18 Apr 2020 21:05:01 +0000 (23:05 +0200)]
luci-base: ui.js: hide unsatisfied firstchild menu nodes

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 7882f3ebdde0364314a45aa6dd8fbc4e766e8ea8)

4 years agoluci-base: ui.js: add LuCI.ui.menu.flushCache() function
Jo-Philipp Wich [Thu, 16 Apr 2020 13:13:26 +0000 (15:13 +0200)]
luci-base: ui.js: add LuCI.ui.menu.flushCache() function

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90a51ab3b9afca0144a93eb967fcd72a230732f0)

4 years agoluci-base: ui.js: add LuCI.ui.menu helper class
Jo-Philipp Wich [Wed, 15 Apr 2020 20:30:00 +0000 (22:30 +0200)]
luci-base: ui.js: add LuCI.ui.menu helper class

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 930f28b606d8a7b3cb511e57bd8028b1979ce5da)

4 years agoluci-base: ui.js: use standard indicator framework to display uci changes
Jo-Philipp Wich [Mon, 13 Apr 2020 10:31:54 +0000 (12:31 +0200)]
luci-base: ui.js: use standard indicator framework to display uci changes

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b6e93d54a0f9c6be310e07a66ac08532ba6400b0)

4 years agoluci-base: luci.js: use standard indicator framework for poll status
Jo-Philipp Wich [Mon, 13 Apr 2020 10:41:26 +0000 (12:41 +0200)]
luci-base: luci.js: use standard indicator framework for poll status

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 68b2ce84ece62e3aec98b9be31e61ec5f6cdba2d)

4 years agoluci-theme-*: set mediaurlbase if it is the first time to be installed
Chen Minqiang [Fri, 3 Apr 2020 10:10:04 +0000 (18:10 +0800)]
luci-theme-*: set mediaurlbase if it is the first time to be installed

If we build multi-themes into firmware, each of them set itself
to be the default theme, what theme should it be?

To make it clear, we only set mediaurlbase if the theme is the
first time to be installed/built-in.

This resolve the issue that theme always change to somewhat default
after upgrading the firmware even with a config-keep-upgrade

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
(backported from commit fc150636b9393e31aa7d5a8d8320b111476ba2f1)

4 years agoluci-theme-bootstrap: fix dynlist overflows
Jo-Philipp Wich [Fri, 3 Apr 2020 11:47:00 +0000 (13:47 +0200)]
luci-theme-bootstrap: fix dynlist overflows

Fixes: #3795
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 015712bba0fe4b036b4d12235a7b664d5b4cf3fe)

4 years agoluci-theme-openwrt: work around cssmin bug breaking the minified CSS.
Jo-Philipp Wich [Tue, 31 Mar 2020 13:25:27 +0000 (15:25 +0200)]
luci-theme-openwrt: work around cssmin bug breaking the minified CSS.

The cssmin utility incorrectly breaks up calc() expressions when
minifying rules. Avoid the problem by trimming uneeded spaces.

Fixes: #3801
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 63057a08dcc2ee80f68ccd411239a51646eba295)

4 years agothemes: generalize indicator markup and styling
Jo-Philipp Wich [Mon, 30 Mar 2020 15:05:05 +0000 (17:05 +0200)]
themes: generalize indicator markup and styling

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit ccb7e4a4a7aac34734dbda7e9ca7f5b53cbc51ff)

4 years agoluci-theme-bootstrap: dynamically adjust body margin
Jo-Philipp Wich [Fri, 27 Mar 2020 16:57:48 +0000 (17:57 +0100)]
luci-theme-bootstrap: dynamically adjust body margin

Fixes: #3722
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c99684dff73b4d0ca6f73cd3cde667f685aa5b4b)

4 years agoluci-theme-bootstrap: fixup assoclist styling
Jo-Philipp Wich [Tue, 24 Mar 2020 21:13:41 +0000 (22:13 +0100)]
luci-theme-bootstrap: fixup assoclist styling

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 3b40c582baefcb302fb23ed633ed85ab1ac72a9e)
(cherry picked from commit ca17ec9b4f0571144ebdf124abe5edd9ecf7481b)

4 years agoluci-theme-material: render menu on client side
Jo-Philipp Wich [Sun, 1 Dec 2019 20:13:14 +0000 (21:13 +0100)]
luci-theme-material: render menu on client side

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 92eecedc8a52b0ba814daddb5167449a2ebb7f26)

4 years agoluci-theme-openwrt: render menu on client side
Jo-Philipp Wich [Sun, 1 Dec 2019 19:18:21 +0000 (20:18 +0100)]
luci-theme-openwrt: render menu on client side

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ebc99a6ab30d1b563b1e073df93006504cdc80ae)

4 years agoluci-theme-bootstrap: render menu on client side
Jo-Philipp Wich [Sun, 1 Dec 2019 19:11:37 +0000 (20:11 +0100)]
luci-theme-bootstrap: render menu on client side

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5db4463acec5a672c4e4fcb7c91fb93af8e43387)

4 years agoluci-theme-bootstrap: minor page action alignment fix
Jo-Philipp Wich [Tue, 12 Nov 2019 07:48:36 +0000 (08:48 +0100)]
luci-theme-bootstrap: minor page action alignment fix

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit df38e4505ceae1634dc48c2793040f31856c758a)

4 years agoluci-mod-network: dhcp.js: allow lease hostname to be empty
Jo-Philipp Wich [Sat, 11 Apr 2020 16:34:54 +0000 (18:34 +0200)]
luci-mod-network: dhcp.js: allow lease hostname to be empty

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 57f27cf7f803cf1f788f6b3edb103c138aaa92f9)

4 years agoluci-mod-network: dhcp.js: fix validation logic
Jo-Philipp Wich [Sat, 11 Apr 2020 16:19:59 +0000 (18:19 +0200)]
luci-mod-network: dhcp.js: fix validation logic

The `server` option allows plain IPs besides the `/domain/addr` format.

Fixes: #3870
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 137db1c4d1bac4000f9c17150ac286b73787ce20)

4 years agoluci-base, luci-mod-network: adjust ZoneSelect / NetworkSelect descriptions
Jo-Philipp Wich [Tue, 7 Apr 2020 16:19:19 +0000 (18:19 +0200)]
luci-base, luci-mod-network: adjust ZoneSelect / NetworkSelect descriptions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 45a30c925ba39f101861a09d56f6364bedf55250)

4 years agoluci-mod-network: dhcp.js: properly validate hostname values
Jo-Philipp Wich [Mon, 23 Mar 2020 21:20:50 +0000 (22:20 +0100)]
luci-mod-network: dhcp.js: properly validate hostname values

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 98a9d07d8998fae912ff43ee4d45ed8ad09aa04c)

4 years agoluci-mod-network: diagnostics.css: use .btn CSS class for buttons
Jo-Philipp Wich [Mon, 23 Mar 2020 20:48:13 +0000 (21:48 +0100)]
luci-mod-network: diagnostics.css: use .btn CSS class for buttons

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 41b2fe9f6bfa793329e722b2420d75339cbb0cda)

4 years agoluci-mod-network: dnsmasq: correct sense & usage of dnsseccheckunsigned
Kevin Darbyshire-Bryant [Fri, 22 Nov 2019 15:25:59 +0000 (15:25 +0000)]
luci-mod-network: dnsmasq: correct sense & usage of dnsseccheckunsigned

dnsmasq v2.80 made 'dnssec-check-unsigned' the default, reflect this in
the gui.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
(cherry picked from commit c58ae7d3f41a3454a116560fd555aac0ead18ff2)

4 years agoluci-mod-system: don't make SSH tabs depend on dropbear uci
Jo-Philipp Wich [Sun, 26 Apr 2020 16:38:16 +0000 (18:38 +0200)]
luci-mod-system: don't make SSH tabs depend on dropbear uci

This prevents a situation where the tabs will be disabled by the dispatcher
once the last config section has been removed. This would allow a user to
disable SSH via the UI but not to reenable it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit baa3bd4aac64984dfbecf8e524cfb31ed485a916)

4 years agoluci-mod-system: password.js: make event handler attachment more robust
Jo-Philipp Wich [Tue, 28 Apr 2020 21:33:24 +0000 (23:33 +0200)]
luci-mod-system: password.js: make event handler attachment more robust

Do not expect a specific markup structure but use querySelector() to locate
the input element.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 34c06b4704383428c87e0a3c3c96ff7facfa5c46)

4 years agoluci-mod-system: convert menu controller to declarative JSON
Jo-Philipp Wich [Mon, 13 Apr 2020 16:42:32 +0000 (18:42 +0200)]
luci-mod-system: convert menu controller to declarative JSON

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ca295b04e72bb869925ba4183800166130f1b228)

4 years agoluci-mod-system: system.js: rework local time widget markup
Jo-Philipp Wich [Mon, 23 Mar 2020 20:58:25 +0000 (21:58 +0100)]
luci-mod-system: system.js: rework local time widget markup

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 3afe606743c44414f11f713b1557d4c0fb9faf80)

4 years agoluci-mod-system: use proper CSS class for map description
Jo-Philipp Wich [Mon, 23 Mar 2020 20:56:55 +0000 (21:56 +0100)]
luci-mod-system: use proper CSS class for map description

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 90990df3b6865e276c065733e724012938174853)

4 years agoluci-mod-system: use generic .cbi-section-actions style for row actions
Jo-Philipp Wich [Mon, 23 Mar 2020 20:53:53 +0000 (21:53 +0100)]
luci-mod-system: use generic .cbi-section-actions style for row actions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9706388c42b7490cfdbdad8cc32012870211524d)

4 years agoluci-mod-status: index.js: skip includes which failed loading
Jo-Philipp Wich [Sat, 18 Apr 2020 17:57:00 +0000 (19:57 +0200)]
luci-mod-status: index.js: skip includes which failed loading

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a0db2abea3ceae24f376af31ffb7ca5e76d19da6)

4 years agoluci-mod-status: tag DHCP lease tables with dedicated CSS classes
Jo-Philipp Wich [Mon, 23 Mar 2020 21:02:30 +0000 (22:02 +0100)]
luci-mod-status: tag DHCP lease tables with dedicated CSS classes

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit be62595c5b44e2f4bc366bb3a2d2ee07d69a77dd)

4 years agoluci-mod-status: adjust assoclist markup for easier styling
Jo-Philipp Wich [Mon, 23 Mar 2020 21:01:06 +0000 (22:01 +0100)]
luci-mod-status: adjust assoclist markup for easier styling

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e26b6c8c1408586ccbf59aac7368420c7a055097)

4 years agoluci-mod-status: use generic .cbi-section-actions style for row actions
Jo-Philipp Wich [Mon, 23 Mar 2020 20:55:50 +0000 (21:55 +0100)]
luci-mod-status: use generic .cbi-section-actions style for row actions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4fa409c7c47830010d4b96b2201b2cf530d360da)

4 years agoluci-base: Show used memory instead of Free
Howard Su [Fri, 28 Feb 2020 14:06:52 +0000 (22:06 +0800)]
luci-base: Show used memory instead of Free

This makes sure solid/blue bar shows the used memory.

Signed-off-by: Howard Su <howard0su@gmail.com>
(cherry picked from commit d09f3b64b2871e0ba642f9112b0c334ec9832f23)

4 years agoluci-base: form.js: allow secondary configs to fail loading
Jo-Philipp Wich [Tue, 28 Apr 2020 07:46:22 +0000 (09:46 +0200)]
luci-base: form.js: allow secondary configs to fail loading

Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 17ffc84a2903c2354543cd0fb575a82e36e076fd)

4 years agoluci-base: uhttpd.lua: expose all CGI variables
Jo-Philipp Wich [Fri, 10 Apr 2020 19:03:19 +0000 (21:03 +0200)]
luci-base: uhttpd.lua: expose all CGI variables

Fixes: #3873
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 465891ff0239b8fdafb737d01e3f05205a14319b)

4 years agoluci-base: add missing .btn CSS classes to sysauth template
Jo-Philipp Wich [Thu, 26 Mar 2020 21:15:56 +0000 (22:15 +0100)]
luci-base: add missing .btn CSS classes to sysauth template

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9edb9336d3f1c8c2ac208eff798db23150badec4)

4 years agoluci-base: accept alternative logread location
Dirk Brenken [Fri, 20 Mar 2020 15:11:31 +0000 (16:11 +0100)]
luci-base: accept alternative logread location

* minimal change to accept the usual logread location
  plus the alternative location (/usr/sbin/logread)
  used by syslog-ng (see openwrt/packages/issues/11535 for reference)

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 085f3f7809daae9a239214d6324557eb6295dc1e)

4 years agoluci-base: fix error 404 on missing relay protocol
Ansuel Smith [Thu, 12 Mar 2020 15:46:53 +0000 (16:46 +0100)]
luci-base: fix error 404 on missing relay protocol

Currently relay.js is included in any case even if
the router doesn't have the needed package to use it.
Fix this by checking if the system has this feature.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit 3d70d3e5d786383b8754200cf065713b191bdead)

4 years agoluci-base: add relayd to getFeature list
Ansuel Smith [Thu, 12 Mar 2020 15:40:25 +0000 (16:40 +0100)]
luci-base: add relayd to getFeature list

Add /sbin/block to the generic Feature list to make
it easily accessible by getProtocolHandlers

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(cherry picked from commit d8e1aef1505496a04631550363ce83bb0147c0a9)

4 years agoluci-base: Import latest version of jsmin
Howard Su [Sat, 29 Feb 2020 15:30:15 +0000 (23:30 +0800)]
luci-base: Import latest version of jsmin

Signed-off-by: Howard Su <howard0su@gmail.com>
(cherry picked from commit 9935a5c735b271f59e3c6c95248c64e4b089d7f0)

4 years agoluci-base: po2lmo: refactor code
Jo-Philipp Wich [Sat, 1 Feb 2020 13:29:23 +0000 (14:29 +0100)]
luci-base: po2lmo: refactor code

Refactor the po2lmo conversion code to be more robust and to properly
handle input files without location comments.

Ref: https://github.com/openwrt/luci/commit/9c1bac4168d151c2a3a5a1f957adbd68b6ae0746#commitcomment-37036663
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2a1245a4970c2655fda10c51a6be4973f3e2ce84)

4 years agoluci-base: add support for plural translations and contexts in Lua api
Jo-Philipp Wich [Thu, 23 Jan 2020 20:53:26 +0000 (21:53 +0100)]
luci-base: add support for plural translations and contexts in Lua api

 - Introduce a new luci.template.parser.ntranslate() function which
   takes a count, a singular and a plural translation string as well
   as an optional context argument and returns the appropriate,
   language specific plural translation.

 - Introduce an optional translation context argument in the existing
   luci.template.parser.translate() function

 - Support translation contexts in LuCI template directives.
   Translation messages are split on the first unescaped pipe
   character and the reamining string after the pipe is treated
   as context.

Examples:

 - `string.format(p.ntranslate(n, "1 apple", "%d apples"), n)` will
   return an appropriate plural translation for the given amount.

 - `translate("Load", "The system load")` will return an appropiate
   translation for `Load`, using `The system load` as disambiguation
   context (a `msgctxt` directive in *.po files).

 - Likewise `<%:Load|The system load%>` will translate the word
   `Load` while using the remainder of the string as context.

 - To use pipes in translations strings literally, they must be
   escaped: `<%:Use the "\|" character%>` will translate the literal
   string `Use the "|" character`.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9939fc5a26d07da4756497bb6a7dc51dcf379e98)

4 years agoluci-base: handle more po format features in po2lmo
Jo-Philipp Wich [Wed, 22 Jan 2020 17:44:15 +0000 (18:44 +0100)]
luci-base: handle more po format features in po2lmo

 - Extract and store the plural calculation function in .lmo files
 - Handle plural translation messages
 - Handle translation contexts

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9c1bac4168d151c2a3a5a1f957adbd68b6ae0746)

4 years agoluci-base: correct rpcd bad access mode
David Lam [Thu, 16 Jan 2020 22:49:42 +0000 (14:49 -0800)]
luci-base: correct rpcd bad access mode

Corrects the bad access mode from a previous commit that did not allow rpcd luci to execute.

Signed-off-by: David Lam <david@thedavid.net>
(cherry picked from commit cbb1c3cf932e4f5d6d56b63ba2e87bd761bfcc54)

4 years agoluci-base: move tools.webadmin to luci-compat
Jo-Philipp Wich [Mon, 30 Dec 2019 09:37:48 +0000 (10:37 +0100)]
luci-base: move tools.webadmin to luci-compat

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 09b2d8a8ac6ca14cfa91168e3f3d1a102e6b62fb)

4 years agoluci-base: drop unused tools.webadmin.proto class
Jo-Philipp Wich [Mon, 30 Dec 2019 09:37:25 +0000 (10:37 +0100)]
luci-base: drop unused tools.webadmin.proto class

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 6591b48f8ec938b4f76dd52cba3293338329cd36)

4 years agoluci-base: firewall.js: fix Zone.addRule()
Jo-Philipp Wich [Mon, 4 May 2020 19:29:01 +0000 (21:29 +0200)]
luci-base: firewall.js: fix Zone.addRule()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 28cf5cd576a7d502bcbfc55c1418dd116f2210e0)

4 years agoluci-base: firewall.js: gracefully handle missing uci configuration
Jo-Philipp Wich [Tue, 28 Apr 2020 07:44:11 +0000 (09:44 +0200)]
luci-base: firewall.js: gracefully handle missing uci configuration

Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a8d85ed71a14c85bbfca0532bb721f5f89a39845)

4 years agoluci-base: uci.js: fix section deletion logic
Jo-Philipp Wich [Sun, 26 Apr 2020 16:41:19 +0000 (18:41 +0200)]
luci-base: uci.js: fix section deletion logic

 - Process deletions before additions or changes, allowing user code to
   remove and recreate a section with the same name.

 - Only record section deletions when the section to be removed actually
   existed in the original config or when it was staged for creation
   earlier. This avoids stray ubus not found exception when saving.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 49c6a810e9a705217f4543099d8188f0f3158f6c)

4 years agoluci-base: network.js: don't fail loading network config on missing wireless
Jo-Philipp Wich [Wed, 15 Apr 2020 07:27:10 +0000 (09:27 +0200)]
luci-base: network.js: don't fail loading network config on missing wireless

Fixes: #3914
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0e22d4d87e9965a2ff74707d309a1bbb3c8334a2)

4 years agoluci-base: tools/widgets.js: honour map readonly property too
Jo-Philipp Wich [Tue, 14 Apr 2020 15:12:47 +0000 (17:12 +0200)]
luci-base: tools/widgets.js: honour map readonly property too

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit c89fd0a7f324bb6c0ebd803f542bb63d49e41984)

4 years agoluci-base: tools/widgets.js: honour readonly property
Jo-Philipp Wich [Mon, 13 Apr 2020 14:55:49 +0000 (16:55 +0200)]
luci-base: tools/widgets.js: honour readonly property

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0f8e5b2536d1226b98ff14c78663bd21736e08a3)

4 years agoluci-base: uci.js: do not issue malformed uci/delete requests
Jo-Philipp Wich [Tue, 14 Apr 2020 15:02:42 +0000 (17:02 +0200)]
luci-base: uci.js: do not issue malformed uci/delete requests

Fixes: #3912
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7)
(cherry picked from commit 6ae1cd8fdbd438574270fa9586f40e223fec40e6)

4 years agoluci-base: uci.js: fix variable clash
Jo-Philipp Wich [Mon, 13 Apr 2020 10:22:13 +0000 (12:22 +0200)]
luci-base: uci.js: fix variable clash

Don't overwrite the `r` variable which is supposed to refer to the reordered
uci sections with temporary data for collecting uci add parameters.

Fixes stray uci/get permission errors caused by an attempt to load
nonsensical uci package names.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 55cb5a753b94e2eee049546a2af374bb6129d4c4)

4 years agoluci-base: network.js: gracefully handle missing wireless config
Jo-Philipp Wich [Sat, 11 Apr 2020 19:24:21 +0000 (21:24 +0200)]
luci-base: network.js: gracefully handle missing wireless config

Ref: https://github.com/openwrt/luci/issues/3895
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 65d673f4671215f2907baebc8d6860f64ba13307)

4 years agoluci-base: rpc.js: add ability to reject nonzero ubus statuses
Jo-Philipp Wich [Fri, 10 Apr 2020 20:50:41 +0000 (22:50 +0200)]
luci-base: rpc.js: add ability to reject nonzero ubus statuses

Add a new declare option `reject` which makes the generated RPC call
function reject with an error in case the remote ubus call returned
a non-zero status.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit bd713f870a974d46b214d07d85ac4a895d85a122)

4 years agoluci-base: cbi.js: handle translation contexts in _()
Jo-Philipp Wich [Fri, 14 Feb 2020 07:42:04 +0000 (08:42 +0100)]
luci-base: cbi.js: handle translation contexts in _()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5258080ce32b973e80111abd41fec82bf9b5e31e)

4 years agoluci-base: cbi.js: support plural translations and disambiguation contexts
Jo-Philipp Wich [Wed, 22 Jan 2020 20:56:28 +0000 (21:56 +0100)]
luci-base: cbi.js: support plural translations and disambiguation contexts

 - Implement `N_(count, "String singular", "String plural" [, "Context"])`
   plural translation function.

 - Extend `_()` to optionally accept a second disambiguation context
   argument.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 894752610d80a2fa1cdb6a845526728eeb0bc984)

4 years agoluci-base: form.js: forward section ID in CBISectionValue methods
Jo-Philipp Wich [Mon, 4 May 2020 19:34:12 +0000 (21:34 +0200)]
luci-base: form.js: forward section ID in CBISectionValue methods

This is useful for custom subclasses that want to perform conditional
rendering of contents, depending on the parent section ID.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f0a0d28fdd22b7904ea9a4efb53a7b791dc6dead)

4 years agoluci-base: form.js: toggle inactive CSS class on unsatisfied field cells
Jo-Philipp Wich [Tue, 28 Apr 2020 07:51:54 +0000 (09:51 +0200)]
luci-base: form.js: toggle inactive CSS class on unsatisfied field cells

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 428e3bd6dc0afcc1ff1c2a62506d66bebc59976f)

4 years agoluci-base: form.js: ListValue: support widget and orientation properties
Jo-Philipp Wich [Tue, 28 Apr 2020 07:50:28 +0000 (09:50 +0200)]
luci-base: form.js: ListValue: support widget and orientation properties

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit daa318c1b2cde1be9df370b1794d660902feab6b)

4 years agoluci-base: form.js: allow to disable descriptions row in TableSection
Anton Kikin [Sun, 19 Apr 2020 02:54:15 +0000 (05:54 +0300)]
luci-base: form.js: allow to disable descriptions row in TableSection

Add 'nodescriptions' property to the TableSection class that allows
to disable displaying table header row with descriptions.

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
(cherry picked from commit 7585e5c95adc69a6e86ae19dda5dfb60557cefdb)

4 years agoluci-base: form.js: fix TableSection descriptions row rendering
Anton Kikin [Sun, 19 Apr 2020 02:55:03 +0000 (05:55 +0300)]
luci-base: form.js: fix TableSection descriptions row rendering

In some cases, a table cell at actions column of a descriptions row
may not be rendered. For example, this happens for GridSection when
sorting is disabled:

    s = m.section(form.GridSection, 'section_type');
    s.sortable = false;

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
(cherry picked from commit da0e974db5865daf6d634ae5f7649f5b5fc2ef31)

4 years agoluci-base: form.js: implement readonly property for forms and options
Jo-Philipp Wich [Mon, 13 Apr 2020 14:53:10 +0000 (16:53 +0200)]
luci-base: form.js: implement readonly property for forms and options

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9279448148052950121d7ce205bdd6a1ee353b2e)

4 years agoluci-base: form.js: improve save error handling
Jo-Philipp Wich [Fri, 10 Apr 2020 18:38:58 +0000 (20:38 +0200)]
luci-base: form.js: improve save error handling

Fixes: #3552
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2dfcca23e4f3edaea2fa5a68a7626a3ab65d3d65)

4 years agoluci-base: form.js: add documentation
Jo-Philipp Wich [Tue, 7 Apr 2020 14:33:09 +0000 (16:33 +0200)]
luci-base: form.js: add documentation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 698c8ff843253c9785bec9dfdff3774db0eae661)

4 years agoform.js: use CSS .btn class for drag handles
Jo-Philipp Wich [Mon, 23 Mar 2020 20:47:35 +0000 (21:47 +0100)]
form.js: use CSS .btn class for drag handles

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5d8970d76c7b2dcb415e849553dc09fc58d611c5)

4 years agoluci-base: form.js: rendering fixes for grid sections
Jo-Philipp Wich [Wed, 12 Feb 2020 07:16:06 +0000 (08:16 +0100)]
luci-base: form.js: rendering fixes for grid sections

 - Ensure that last header cell is rendered for grid sections without
   sorting or addremove actions
 - Don't skip header cells for optional options

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 9bb78b5cd842f94cbcaf00cc5b19c1e3b9669d93)

4 years agoluci-base: ui.js: reset scroll position when opening modal overlay
Jo-Philipp Wich [Sat, 2 May 2020 21:52:36 +0000 (23:52 +0200)]
luci-base: ui.js: reset scroll position when opening modal overlay

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4df3a90b3d638e18b9607a5332033df7ceb0ec55)

4 years agoluci-base: ui.js: fix input value reading for select widgets
Jo-Philipp Wich [Sat, 2 May 2020 21:51:22 +0000 (23:51 +0200)]
luci-base: ui.js: fix input value reading for select widgets

Fixes: #3989
Fixes: 81effc111 ("luci-base: ui.js: assume select widget by default for ListValue widget")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e3ef463ccdd7d32eef1717203bd872272c57793d)

4 years agoluci-base: ui.js: assume select widget by default for ListValue widget
Jo-Philipp Wich [Tue, 28 Apr 2020 13:37:02 +0000 (15:37 +0200)]
luci-base: ui.js: assume select widget by default for ListValue widget

Fixes: #3973
Fixes: 2fb55e1ab ("luci-base: ui.js: fixes for radio widget type of select element")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 81effc111227bc65cb974829f17a45515fbe9807)

4 years agoluci-base: ui.js: fixes for radio widget type of select element
Jo-Philipp Wich [Tue, 28 Apr 2020 07:48:34 +0000 (09:48 +0200)]
luci-base: ui.js: fixes for radio widget type of select element

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 2fb55e1ab5a28c1000a8de6710b6f586f5b88329)

4 years agoluci-base: ui.js: fix textarea width
Jo-Philipp Wich [Sun, 19 Apr 2020 17:34:27 +0000 (19:34 +0200)]
luci-base: ui.js: fix textarea width

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit acae1378a80ca0f87ec3f29de585a6b6328a2c64)

4 years agoluci-base: ui.js: order indicators by ID value
Jo-Philipp Wich [Fri, 17 Apr 2020 07:30:20 +0000 (09:30 +0200)]
luci-base: ui.js: order indicators by ID value

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 01d8283ecea730191ce41302acb7ecd1aaf0631f)

4 years agoluci-base: ui.js: apply disabled attribute to toplevel dynlist node
Jo-Philipp Wich [Thu, 16 Apr 2020 11:19:35 +0000 (13:19 +0200)]
luci-base: ui.js: apply disabled attribute to toplevel dynlist node

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 46d31efc7351231def16be1024eff95c5b792f94)

4 years agoluci-base: ui.js: use session data api to persist tab selection state
Jo-Philipp Wich [Wed, 15 Apr 2020 20:18:13 +0000 (22:18 +0200)]
luci-base: ui.js: use session data api to persist tab selection state

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 51186355ea168dfc6fb1363ace5c57b178f0331e)

4 years agoluci-base: ui.js: add disabled property to widgets
Jo-Philipp Wich [Mon, 13 Apr 2020 14:11:35 +0000 (16:11 +0200)]
luci-base: ui.js: add disabled property to widgets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 86c797041af0b52c17aa10db977f039b28a9444a)

4 years agoluci-base: ui.js: add generic indicator handling functions
Jo-Philipp Wich [Tue, 31 Mar 2020 19:29:28 +0000 (21:29 +0200)]
luci-base: ui.js: add generic indicator handling functions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 4250f99d7f061e47d24e18db26bf6dffc98cc72e)

4 years agoluci-base: ui.js: improve mobile dropdown scroll behaviour
Jo-Philipp Wich [Wed, 25 Mar 2020 11:34:46 +0000 (12:34 +0100)]
luci-base: ui.js: improve mobile dropdown scroll behaviour

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 0fb2f8f1d1d8748b56522cc81cf68d5aa04b9f50)

4 years agoluci-base: form.js / ui.js: tie form labels to widgets
Jo-Philipp Wich [Tue, 24 Mar 2020 20:57:21 +0000 (21:57 +0100)]
luci-base: form.js / ui.js: tie form labels to widgets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 22ba6fc40933bee02c3ea93bbda952bb44bf3af1)
(cherry picked from commit 82fb5a67d39d965595d2ad833dbf930e559c0202)

4 years agoluci-base: ui.js: various tweaks
Jo-Philipp Wich [Mon, 23 Mar 2020 20:36:59 +0000 (21:36 +0100)]
luci-base: ui.js: various tweaks

 - emit checkbox markup suitable for CSS styling
 - use .btn CSS class where appropriate
 - dispatch events when updating uci change indicator
 - use correct target node when handling events in createHandlerFn()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 993b4f79506c99357dc77eeaa74b0fd9149b1cf1)

4 years agoluci-base: luci.js: get rid of global `L` references in internal classes
Jo-Philipp Wich [Thu, 16 Apr 2020 11:17:57 +0000 (13:17 +0200)]
luci-base: luci.js: get rid of global `L` references in internal classes

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 616d2a61e40ff2c19f38804f08c5b9ccf156639f)

4 years agoluci-base: luci.js: share environment object among LuCI base classes
Jo-Philipp Wich [Thu, 16 Apr 2020 08:46:45 +0000 (10:46 +0200)]
luci-base: luci.js: share environment object among LuCI base classes

This allows us to get rid of global `L` references in luci.js itself.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit e385640505352efe8e470d5b723e8b467a0d6fb6)

4 years agoluci-base: ensure that ubus path uses trailing slash
Jo-Philipp Wich [Fri, 13 Mar 2020 22:57:19 +0000 (23:57 +0100)]
luci-base: ensure that ubus path uses trailing slash

Without the trailing slash, probing endpoint availability will fail.

Fixes: 529bde440 ("luci-base: make rpc webserver path configurable")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 38289bc97512e758e5a20f348dc13d5018f98188)

4 years agoluci-base: make rpc webserver path configurable
Ansuel Smith [Thu, 16 Jan 2020 14:16:09 +0000 (15:16 +0100)]
luci-base: make rpc webserver path configurable

Currently the ubus path that provide the webserver is hardcoded to be /ubus.
Change this to make it configurable from the luci config file.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
(backported from commit 529bde44081d0bc07a064e9dfb1f0b3f35e61061)

4 years agoluci-base: luci.js: add LuCI.session.getToken()
Jo-Philipp Wich [Sun, 26 Apr 2020 16:44:48 +0000 (18:44 +0200)]
luci-base: luci.js: add LuCI.session.getToken()

Since we're already have LuCI.session.getID() we should mirror the same
interface for retrieving the session token.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 551d839f90853b58f81d124c77442009d4df0cb4)

4 years agoluci-base: luci.js: add hasViewPermission() helper
Jo-Philipp Wich [Wed, 15 Apr 2020 20:14:44 +0000 (22:14 +0200)]
luci-base: luci.js: add hasViewPermission() helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b739fc17eabe9905889017127ac1de8f4e194819)

4 years agoluci-base: luci.js: fix JSdoc markup issues
Jo-Philipp Wich [Wed, 15 Apr 2020 20:03:20 +0000 (22:03 +0200)]
luci-base: luci.js: fix JSdoc markup issues

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 06af541c376ddab7303ea4294b17e8be91458d05)