Commit graph

466 commits

Author SHA1 Message Date
DeYu Liu
0e4b4c5b42 luci-base: Fix time display error
Signed-off-by: DeYu Liu <vito_sam@outlook.com>
2021-07-06 13:57:54 +08:00
Jo-Philipp Wich
00e41c3c49 luci-base: validation: disallow mutlicast MACs by default
Extend the MAC address validator to disallow multicast MAC addresses and
add a new optional validator option to require multicast MACs instead of
unicast ones.

Fixes: #5166
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-07-03 20:12:33 +02:00
Florian Eckert
1a2b7fef6c luci-base: do not add validation for named section if readonly is set
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-07-01 15:54:51 +02:00
Helge Mader
87215e3d1b luci-base: prevent empty field for adding new named section in JavaScript
Suggested-by: Helge Mader <ma@dev.tdt.de>
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-07-01 13:10:15 +02:00
Florian Eckert
80262bb9a7 luci-base: change css class btn to cbi-button
The css class btn is only a valid input element on lua rendered pages.
Use instead cbi-button for javascript rendered pages.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-07-01 13:10:15 +02:00
Florian Eckert
97e673b72c luci-base: use button tag instead of input tag on named section add
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-07-01 13:09:37 +02:00
Jo-Philipp Wich
1bcb12570c luci-base: network.js: add link status information accessors
Fixes: #5121
Fixes: 8c71b1d01e ("luci-mod-network: add port status to bridge vlan filter matrix")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-12 18:42:37 +02:00
Jo-Philipp Wich
e3bf521edb luci-base: ui.js: determine dropdown position relative to overflow parent
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 21:55:43 +02:00
David Bauer
516c58e133
Merge pull request #5070 from blocktrron/pr-luci-wifi6
luci-mod-network: add 802.11ax HE support
2021-06-05 19:04:11 +02:00
David Bauer
4b17f8baa3 luci-base: add 11ax HW / HT modes
Add the known values returned for 802.11ax HW as well as HT modes to the
respective method descriptions.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-05 16:24:19 +02:00
David Bauer
f35e877dc6 luci-mod-network: add 802.11ax HE support
This commit adds the ability to configure HE-modes for radios
(HE20 / HE40 / HE80 / HE160) as well as HE rate information in the
assiciation view.

Tested-on: Ubiquiti UniFi 6 Lite / LR

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-06-05 16:24:19 +02:00
Jo-Philipp Wich
e35041e0a8 luci-base: network.js: sorting fixes
Ensure that sort callbacks consistently return [-N .. 0 .. +N] values
instead of just true/false.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-03 09:51:09 +02:00
Niels Widger
c7b7b42cd3 treewide: Update JS using luci-rpc getHostHints
Update frontend JS code which uses luci-rpc getHostHints to support the new
response format which removes the `ipv4` and `ipv6` host hint string fields
and replaces them with `ipaddrs` and `ip6addrs` weighted string list fields.

Signed-off-by: Niels Widger <niels@qacafe.com>
[rework code to be forwards/backwards compatible, fix some Network.Hosts
 methods, fix IP choice ordering, change commit subject, rewrap commit
 message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-03 09:51:09 +02:00
Jo-Philipp Wich
1255c4832e
Merge pull request #4770 from nickberry17/update_DummyValue
luci-base: add new member 'hidden' to DummyValue
2021-06-02 08:23:45 +02:00
Jo-Philipp Wich
f3f74bd0fe luci-base: form.js: consider aliased options in AbstractValue.remove()
If different options point to the same underlying uci option, we must only
remove the uci value if none of the other alias options is active in order
to prevent inactive options (due to unsatisfied depends) removing the uci
value of active once on save.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-01 15:34:11 +02:00
Jo-Philipp Wich
dece9b063c luci-base: fix network data type validation
Fixes: #5085
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-05-31 11:39:15 +02:00
Rafał Miłecki
79947af064 treewide: drop MAC and MTU from interfaces (protocols)
Those are L2 options that are not part of interfaces (L3), should not be
set there and don't work. Setting MAC and MTU should be done at device
layer (config device) and is supported for basic types already.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-28 15:34:41 +02:00
Rafał Miłecki
74be304e54 treewide: use "device" option in UCI "interface" sections
netifd has been recently patched to use "device" option instead of
"ifname" as more clear & accurate.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-27 10:52:51 +02:00
Sven Roederer
ddf6357cda luci-base: change button-text from Dismiss to Close in UCI changes overview
Change the left button of the UCI Apply-changes overview to the more correct function close.
This also avoids confusion between Dismiss and Revert, which translate to the same in german.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-05-04 00:09:11 +02:00
Jo-Philipp Wich
5c792aefc7 luci-base: form.js: fix AbstractValue.textvalue() for uci list options
Serialize the uci list value into a space separated string before passing
it to String.format() for HTML escaping. Without that change, empty strings
were returned whenever the underlying uci get operation yieled an array.

Fixes: #4993
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-04-16 17:32:22 +02:00
Jo-Philipp Wich
ba4e214160 luci-base: uci.js: merge changes when retrieving entire sections
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 22:35:50 +02:00
Jo-Philipp Wich
95b5c6cd64 luci-base: ui.js: fix UICheckbox widget operation when tooltips are set
When a tooltip is rendered for a checkbox widget, an additional node is
placed after the checkbox label element, breaking DOM selectors in
bind(), isChecked(), setValue().

Apparently the functionality was never actually tested.

Fixes: #4938
Fixes: e951236e3 ("luci-base: add tooltip handling")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29 11:24:59 +02:00
Jo-Philipp Wich
d1bf56d7f1 luci-base: network.js: recognize DSA ports and bridge VLANs
Use the newly introduced devtype attribute for more robust network device
type detection. This also allows us to easily recognize DSA ports.

Furthermore, synthesize VLAN devices declared by uci bridge-vlan sections,
similar to how it is done for legacy swconfig switch_vlan ones.

Finally implement a new Network.Device.getParent() method to use the newly
available "parent" attribute to resolve the base device of DSA ports or
VLAN devices.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:40 +01:00
Jo-Philipp Wich
171ef77e89 treewide: remove rendundant proto handler options
The introduction of network device configuration support also implemented
all common, protocol-independent interface options directly in the
interface config view, so drop the redundant option definitions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-15 11:41:44 +01:00
Jo-Philipp Wich
cd06e708d8 luci-base: validation.js: optionally support negative prefixes
Support negative prefix length in the `cidr`, `cidr4`, `cidr6`, `ipmask`,
`ipmask4` and `ipmask6` data types when an optional truish flag is passed
to the datatype name.

Ref: #4812
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01 15:16:14 +01:00
Jo-Philipp Wich
0ee422b4c0 luci-base: network.js: sort interface statuses by metric, then name
Fixes: #4693
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01 10:42:10 +01:00
Jo-Philipp Wich
49ecaf6090 luci-base: firewall.js: manage zomne networks as list
Fixes: #4827
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01 08:54:58 +01:00
Jo-Philipp Wich
b8d2bcd432 luci-base: ui.js: resolve parent ul early in UIDropdown.toggleItem()
The parent node of the current li might be null after collapsing the
dropdown, so resolve the parent ul early to avoid passing null to
subsequent calls.

Fixes clearing custom input values in DynamicList dropdowns.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-02-19 10:41:00 +01:00
Jo-Philipp Wich
3c166c25de luci-base: luci.js: fix sortedKeys() ordering
Chrome does not properly sort arrays when the sort function returns boolean
results, in contrast to Firefox which does.

Fix the issue by returning a numerical result instead.

Fixes: #4792
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-02-10 00:07:32 +01:00
Nicholas Smith
936dde7422 luci-base: add new member 'hidden' to DummyValue
Signed-off-by: Nicholas Smith <nicholas@nbembedded.com>
2021-02-10 06:33:14 +10:00
Giovanni Giacobbi
d3280e6f5d treewide: minor fixes to typos, whitespace, and indentation
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-20 12:36:13 +02:00
Giovanni Giacobbi
763158600a
luci-base: luci.js: fix LuCI.request.poll.add() exception handling
The try/catch is meant for the `res.json()` call and should apply to that. As it was before, an exception inside the poll callback would cause the callback to be reinvoked without the JSON parameter, which is an odd behaviour. Moreover, it makes it hard to debug because it is completely hidden from the browser console. We now differentiate between exceptions thrown due to bad JSON in `responseText` from exceptions generated inside the callback itself, which are let through for browser console logging.

Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-19 22:46:25 +01:00
Florian Eckert
df2a135a08 luci-base: make tooltip icon string configurable
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-13 12:29:02 +01:00
Florian Eckert
e951236e36 luci-base: add tooltip handling
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-13 11:59:02 +01:00
Hannu Nyman
c49d33f6cb
Merge pull request #4598 from Ansuel/wifi_chan
luci-mod-status: add new channel analysis page
2021-01-07 19:02:57 +02:00
Jo-Philipp Wich
03c77dafe3 treewide: transition div tables to actual table markup
Modern browsers allow decomposing table markup equally well as nested div
constructs, therefor migrate our <div> table markup to actual <table> tags
but keep the old table/tr/th/td CSS classes for now to allow for a smooth
theme transition.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-27 21:36:40 +01:00
Ansuel Smith
84ba852993
luci-base: delay cbi-tab-active event on tab init
Delay the cbi-tab-active custom event so any eventListner attached to the tab doesn't miss the first event.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-24 02:36:50 +01:00
Ansuel Smith
44d02afab1
luci-base: generalize random color generation
Generation of pseudo random hex color from a string can be useful also for other task. Generalize it to make it available also for other purpose.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-18 00:48:16 +01:00
Jo-Philipp Wich
5c5b1340e5 luci-base: tools.widgets.NetworkSelect: properly validate multi select
Fixes: 2b99473f2 ("luci-base: tools.widget.NetworkSelect: disallow invalid network names")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-07 00:46:30 +01:00
Jo-Philipp Wich
2b99473f2c luci-base: tools.widget.NetworkSelect: disallow invalid network names
Fixes: #4523, #4573
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-07 00:41:56 +01:00
Jo-Philipp Wich
5a485f8c68
Merge pull request #4531 from oldium/add-widget-changed
luci-base: Fix using isActive in widget-change notification.
2020-10-30 21:29:38 +01:00
Oldřich Jedlička
ee9b3a4e94 luci-base: Fix using isActive in widget-change notification.
The `onchange` notification handler is called too early to be able to
evaluate other widget's `isActive()` status. Solve this by changing order
of event handling - first register/execute `map.checkDepends` and then
`onchange`.

Fixes: openwrt/luci#4516.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-30 21:18:45 +01:00
Oldřich Jedlička
ebaa50ecd8 luci-base: Replace legend element with h3.
The legend HTML element is allowed only as first element in fieldset, so
use h3 instead, which is rendered the same within themes.

Fixes #3149.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-24 19:18:50 +02:00
Oldřich Jedlička
12e50de9db luci-base: network.js: Show clients also from wifi VLANs.
Iterate through VLANs to get the clients connected on configured wifi
VLANs (as configured by `wifi-vlan` sections in `wireless` configuration).

This is a minimum support for VLANs on wireless network. The VLAN name is
nowhere displayed, but at least clients using VLANs are visible.

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-06 13:30:47 +02:00
Rafał Miłecki
b17ec0926d luci-base: don't append object.method to the RPC url
It was a cosmetic feature that doesn't work anymore with the latest
uhttpd ubus API. Adding RESTful API resulted in treating URL part
following the /ubus/ as the new API request.

Suggested-by: Rafał Miłecki <rafal@milecki.pl>
Fixes: #4465
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-23 16:54:18 +02:00
Anton Kikin
509bf29cc9 luci-base: make translatable default values for dhcp hostname
We must be able to translate these values.

Fixes: fd75c2b7c ("luci-base: add default value options dhcp hostname")
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-09-19 08:31:48 +03:00
Florian Eckert
fd75c2b7c5 luci-base: add default value options dhcp hostname
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-09-16 17:19:50 +02:00
Jo-Philipp Wich
bdcd094963 luci-base: dhcp.js: allow hostname to be "*"
Fixes: #4430
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-16 10:23:35 +02:00
Rafał Miłecki
bc6e4dfe29 luci-base: use actual JSON-RPC for verifying ubus RPC URL
Sending GET request to the main RPC base URL and expecting HTTP response
code 400 had two flaws:
1. It was not verifying actual JSON-RPC interface availability
2. It did not allow implementing support for new requests

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2020-09-15 10:34:39 +02:00
Jo-Philipp Wich
35e2735e2e luci-base: form.js: implement AbstractSection.getOption() helper
The `getOption()` function allows to easily obtain a reference to another
option object instance within the same section.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-06 17:56:34 +02:00