Commit graph

282 commits

Author SHA1 Message Date
Richard Yu
fa15370f0e
luci-base: form.js: fix GridSection not using user-input name when add
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
2019-11-04 00:19:33 +08:00
Jo-Philipp Wich
33346dadf4 luci-base, luci-mod-system: move file upload handling to ui.js
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
6e633b3ed2 luci-base: consolidate network.js data acquisition
The new luci-rpc/getNetworkDevices procedure offers netdev enumeration
with included IPv4 and IPv6 address information as well as 64bit traffic
counters, so we can remove the calls to network.device/status and
luci/getIfaddrs now as we're able to obtain all info from a single source.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
cc1cbdaf32 luci-base: migrate luci/getNetworkDevices to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
a96e7a664f luci-base: migrate luci/getWirelessDevices to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
37b6092aef luci-base, luci-mod-network, luci-app-firewall: migrate luci/getHostHints
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
d21ebcfbbc luci-base: migrate luci/getBoardJSON to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
199428a9c3 luci-base: network.js: implement Protocol.getGateway6Addr()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-22 22:38:29 +02:00
Jo-Philipp Wich
2b7ca79118 luci-base: ui.js: prevent race condition in tab initialization
Fixes: #3150
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-22 15:51:51 +02:00
Jo-Philipp Wich
77a89299f4 luci.base: fs.js: expose mode param in fs.write()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-21 08:42:41 +02:00
Jo-Philipp Wich
d5ffab23b6 luci-base: network.js: simplify rpc error handling
Use L.resolveDefault() catch unexpected RPC replies and rename declared
rpc functions in a consistent manner.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-18 11:49:13 +02:00
Jo-Philipp Wich
51b519e55e luci-base: network.js: prefer netifd traffic stats over getifaddrs() ones
Overwrite the traffic statistics reported by getifaddrs() with the ones
reported by the network.device/status procedure if available as the
getifaddr() stats are limited to 32bit counters.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-17 09:21:04 +02:00
Jo-Philipp Wich
120ece921d luci-base: static.js: make IPv6 assignment hint optional
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-15 09:14:56 +02:00
Richard Yu
02a0291d14
luci-base: widgets.js: add user and group select
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
2019-10-11 01:05:08 +08:00
Jo-Philipp Wich
e7ca163d7c luci-base: form.js: fix anonymous section table titles
When no section title is defined, the table renderer is supposed to use
the uci section id as fallback when the table section is not declared
to be anonymous.

Fixes: #3147
Fixes: a90bf384b ("luci-base: form.js: harmonize title property handling")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 19:49:58 +02:00
Jo-Philipp Wich
5cfad8d65b luci-base: form.js: treat inactive options as optional
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 19:44:22 +02:00
Jo-Philipp Wich
f3ef2ca2eb luci-base: ui.js: add pingDevice() and awaitReconnect() functions
Import these functions from the flash.js for use with other views that
might trigger a device reboot.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:39 +02:00
Jo-Philipp Wich
df8078d542 luci-base: ui.js: use common fs.js class for filebrowser operations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:39 +02:00
Jo-Philipp Wich
8776e423d9 luci-base: introduce common fs.js helper class
Introduce a new fs.js helper class to gather filesystem related RPC
operations in a single file.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:35 +02:00
Jo-Philipp Wich
1154e755f1 luci-base: luci.js: add resolveDefault() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:48:33 +02:00
Jo-Philipp Wich
b2809cebd8 luci-base: luci.js, rpc.js, uci.js, network.js: add JSDoc annotations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-02 08:59:41 +02:00
Jo-Philipp Wich
948ca3712f luci-base: network.js: implement getMeshID() getter
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-30 12:39:33 +02:00
Jo-Philipp Wich
809f16d4ce luci-base: network.js: fix deleteNetwork() implementation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-24 08:02:57 +02:00
Jo-Philipp Wich
186ddfa044 luci-base: form.js: do not inherit map tabbing to nested sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-24 08:01:04 +02:00
Jo-Philipp Wich
0068c3bd49 luci-base: form.js: allow overriding remove action in Table/GridSections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-24 07:59:04 +02:00
Jo-Philipp Wich
158515d5bd luci-base: form.js: do not add title attributes for untitled options
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-22 22:26:36 +02:00
Jo-Philipp Wich
6dba41cadc luci-base: tie cached system features to user session
Store the cached system feature flags keyed by the current session id,
this ensures that the features are refreshed on login.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 10:55:54 +02:00
Jo-Philipp Wich
119c6319cb luci-base: network.js: don't batch wireless scan requests
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 10:23:37 +02:00
Jo-Philipp Wich
21d1266c53 luci-base: rpc.js: increase default timeout to 20s, allow batch prevention
Support a new option "nobatch: true" in rpc.declare() which prevents the
underlying RPC call from being batched with other calls.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 10:23:37 +02:00
Jo-Philipp Wich
afeacdc7df luci-base: luci.js: improve XHR issue diagnostics
Differentiate between request timeouts and other error reasons.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-21 10:23:37 +02:00
Jo-Philipp Wich
d10575dfee luci-base: form.js: only update option default if cfgvalue is null
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-20 09:58:31 +02:00
Jo-Philipp Wich
25e0b966c7 luci-base: form.js: add support for dynamic default values
Many uci options have different implicit defaults, depending on the
values of other related options. A prominent example is the wireless
ieee80211w option which defaults to 2, 1 or 0 depending on whether
the encryption is set to wpa3-sae, wpa2/wpa2 mixed or any other mode
respectively.

Add the ability to specify a dictionary of default values and their
corresponding dependencies in order to be able to express such
configurations.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-19 15:40:57 +02:00
Jo-Philipp Wich
4dfa657f77 luci-base: ui.js: mark user-changed widgets
Set a `data-changed=true` attribute on the widget element when the user
did any change to the default value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-19 15:39:46 +02:00
Jo-Philipp Wich
53ac685092 luci-base: form.js: fix default click action of button options
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18 15:08:19 +02:00
Jo-Philipp Wich
934fa275b2 luci-base: ensure that button labels are properly html escaped
Fixes: #3067
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18 13:51:16 +02:00
Jo-Philipp Wich
fd9182b21a luci-base: network.js: filter invalid mac addresses
Only consider valid ethernet mac addresses when building the device state
from raw getifaddrs() information.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18 07:46:33 +02:00
Jo-Philipp Wich
10880b565f luci-base: network.js: get low level device details from getifaddr() info
Fixes: #3078
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18 07:19:18 +02:00
Jo-Philipp Wich
9ecfe33edd luci-base: luci.js: render view buttons depending on available functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-17 07:03:27 +02:00
Jo-Philipp Wich
96fbca76c8 luci-base: form.js: implement JSONMap
Implement a new map type JSONMap which uses a JSON data structure instead
of uci as configuration data backend.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-16 07:55:45 +02:00
Jo-Philipp Wich
2e206861ae luci-base: luci.js: append version when dynamically loading classes
This allows for some naive cache busting when the LuCI version changes,
to avoid loading outdated classes from cache.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-14 17:44:32 +02:00
Jo-Philipp Wich
208bf47a33 luci-base: cbi.js: update dependencies after widgets have been rendered
Fixes: #3066
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-14 17:20:41 +02:00
Jo-Philipp Wich
7c9d1a259c luci-base: network.js: register "none" protocol
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-14 17:04:02 +02:00
Jo-Philipp Wich
2dd17fad6c luci-base: network.js: implement Hosts.getMACHints()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-13 14:18:43 +02:00
Jo-Philipp Wich
3734f88c35 luci-base: fix ip6hint option dependencies and validation
Ref: https://forum.openwrt.org/t/odhcpd-make-lease-file-persistent/44118/8
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-13 12:57:08 +02:00
Jo-Philipp Wich
473bd2741b luci-base: rpc.js: fix list requests, handle aborted http requests
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 14:02:06 +02:00
Jo-Philipp Wich
9be42e29e7 luci-base: form.js: handle non-string values in stripTags()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-12 11:09:57 +02:00
Jo-Philipp Wich
34e73fd983 luci-base: widgets.js: fix display quirk in tools.widgets.DeviceSelect
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 12:44:34 +02:00
Jo-Philipp Wich
c96de72043 luci-base: validation.js: implement length() datatype validator
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 12:28:58 +02:00
Jo-Philipp Wich
a0d1294566 luci-base: luci.js: register rpc interceptor to catch expired sessions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 12:21:24 +02:00
Jo-Philipp Wich
c3ddcbb542 luci-base: luci.js: rework error handling
- Capture stack trace in L.raise() if passed type is not an Error instance
 - Use L.ui.addNotification in L.error() to render the error message
 - Prevent duplicate error reporting in the ui

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 12:21:05 +02:00