Commit graph

890 commits

Author SHA1 Message Date
Jo-Philipp Wich
d19e97bcb0 luci-base: widgets.js: support alias interfaces in CBIDeviceSelect
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 23:02:25 +02:00
Jo-Philipp Wich
7179d2e6dd luci-base: ui.js: add createHandlerFn() helper
The createHandlerFn() helper function is useful to construct onclick
or similar event handling functions. It will add a "spinning" CSS
class on the event target element and disable the element, wrap the
given function with Promise.resolv() and re-enable the target element
once the promise is settled.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
0d0882aea0 luci-base: network.js: overhaul code
- Rework internal state management
 - Implement new utility functions such as getL3Device() or getModemType()
 - Fix bugs in various functions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
ed8f1c4c1c luci-app-firewall: honour global default policies in per-zone settings
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
7610f1d9cf luci-base: firewall.js: fix addZone()
When checking for an existing zone with the same name internally,
addZone() must use the nonblocking lookupZone() instead of the
promise returning public getZone() call.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
167ad7bb12 luci-base: rpc: drop offload_support call
It is superseded by the more generic getFeatures method.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
a4621c9520 luci-base: luci.js: introduce hasSystemFeature() api
The new function allows querying the presence of certain system features
such as dnsmasq or firewall availability or the compile time features
of hostapd and wpa_supplicant.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
3b335f2764 luci-base: form.js: support passing a callback to Map.save()
The given callback function will be executed after the map is parsed,
but before the uci is saved. This is useful to add further uci changes
before the map is re-rendered.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
082fd9ff10 luci-base: form.js: implement support for tabbed maps
When .tabbed is set to true on a map, all enclosed sections will be
put into separate tabs.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
b391387ce7 luci-base: form.js: improve ui tab interaction
- Delay initialization of tab groups
 - Tag section nodes with IDs to store per-section tab state

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
c2eba00a10 luci-base: ui.js: rework tab state handling
Properly preserve the selection state of nested tabs.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
fb18c278a4 luci-base: form.js: CBISectionValue: properly forward dependency checks
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
43a8c12f04 luci-base: ui.js: UISelect: fix check for empty choices
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
5628329434 luci-base: form.js: allow overriding empty section placeholder rendering
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
a90bf384b2 luci-base: form.js: harmonize title property handling
Some title properties were expected to be functions, some strings.

Refactor the code to support both string or function values for all
title properties.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
a36e1e976b luci-base: form.js: inherit uci config overrides from parent sections
When the parent section of an option object specifes an alternative
uci configuration name, enclosed option elements should honour it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
46861a527e luci-base: form.js: fix rendering of button widgets
Also introduce an `onclick` property to allow registering custom button
action handler.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
3789148fc9 luci-base: form.js: add further caption properties
Introduce properties `addbtntitle`, `removebtntitle` and `modaltitle` to
allow overriding the captions of section add buttons, remove buttons and
modal dialog titles respectively.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
f7a3546989 luci-base: network.js: add getL2Device(), getMTU() helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
d528a96947 luci-base: network.js: support dynamically loaded protocol classes
Port the existing server side protocol support framework to the client
side network.js.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
00ec399fa1 luci-base: network.js: expose prefixToMask() and maskToPrefix()
Expose the prefixToMask() and maskToPrefix() helper functions for use by
other modules, e.g. the datatype validator.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
e64b0c3c0d luci-base: network.js: return mac addresses in upper case
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
227fae8a37 luci-base: network.js: extend ifnameOf() and expose as getIfnameOf()
Extend the ifnameOf() helper function to cover all object types used by
network.js and expose it as public getIfnameOf() api function for use by
other modules.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
3e5ef065df luci-base: network.js: add ability to flush the internal cache
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00
Jo-Philipp Wich
d1e9841e86 luci-base: ui.js: do not forcibly sort synamic list items
Ref: https://forum.openwrt.org/t/cannot-save-certain-fields/42738/2
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:46:19 +02:00
Florian Eckert
15e9526089
Merge pull request #2969 from TDT-AG/pr/20190806-luci-base
luci-base: add new VPN toplevel menu entry
2019-08-09 14:46:29 +02:00
Florian Eckert
d3e060ae6c luci-base: add vpn menu section
There is always more vpn services. To make the LuCI menu look cleaner, a
new top level menu "VPN" will be added with this commit. All luci-app-*
that have something to do with VPN should move to this new menu entry.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-08-06 16:20:17 +02:00
INAGAKI Hiroshi
6b8532c8e8 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-08-06 02:52:54 +09:00
Jo-Philipp Wich
eb9051c307 luci-base: form.js: add modal dialog hook
Add a new `addModalOptions()` hook which allows to supply additional
cbi options the modal map before the dialog is rendered.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 16:48:50 +02:00
Jo-Philipp Wich
5e67b8b72b luci-base: form.js: update tab state on dependency checks
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 16:47:33 +02:00
Jo-Philipp Wich
89bcae20d0 luci-base: ui.js: tabs: fix empty pane checking, allow alternative query root
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 16:47:19 +02:00
Jo-Philipp Wich
27e4146461 luci-base: luci.js: add L.dom.isEmpty() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 16:47:19 +02:00
Jo-Philipp Wich
360e9769d6 luci-base: ui.js: mark widget optional if empty choice is present
Fixes: #2943
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 16:45:54 +02:00
Jo-Philipp Wich
1fe45a9344 luci-base: index.html: add extend cache-control directive
Fixes: #2942
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-01 15:43:35 +02:00
Hannu Nyman
15088a31b8
Merge pull request #2935 from YuriPet/patch-1
luci-base: update Ukrainian translation
2019-07-30 18:51:13 +03:00
Jo-Philipp Wich
8a947ea550 luci-base: ui.js: do not save invalid dynlist values
Fixes: 3880c3f22 ("luci-base: ui.js: save filled out but not added dynlist items on submit")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-30 13:33:46 +02:00
Jo-Philipp Wich
3880c3f22f luci-base: ui.js: save filled out but not added dynlist items on submit
Fixes: #2938
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-30 13:29:11 +02:00
Yurii
66cdd4363a
luci-base: update Ukrainian translation
Signed-off-by: Yurii <yuripet@gmail.com>
2019-07-30 02:26:21 +03:00
Florian Eckert
78b4ccb5b1
Merge pull request #2929 from tano-systems/pr/luci-base-i18n-ru
luci-base: update Russian translation
2019-07-29 09:53:16 +02:00
Franco Castillo
e699eb9759 luci-base: update Spanish translation
Update Spanish translation.

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-07-27 20:50:18 -03:00
Jo-Philipp Wich
2d3470b700 luci-base: don't treat .rmempty flag as optional for ListValue widgets
Restore the old CBI behaviour of not automatically rendering empty
selection choices in ListValue select dropdowns when .rmempty is
specified.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-27 22:33:36 +02:00
Anton Kikin
7bf0e71e60 luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-27 23:19:45 +03:00
Jo-Philipp Wich
b949c02624
Merge pull request #2923 from tano-systems/pr/multi-fix
luci-base: fix multiple parameter in cbi templates
2019-07-27 20:21:08 +02:00
INAGAKI Hiroshi
be275fd42a i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-07-27 02:30:20 +09:00
Anton Kikin
aeba90032f luci-base: fix multiple parameter in cbi templates
In the dc0211803e commit, the parameter "multi" in ui.js is
replaced with "multiple" everywhere. Thus, it must also be changed
in the cbi templates.

Fixes: dc0211803e
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-26 18:18:42 +03:00
Jo-Philipp Wich
b4129640b4 luci-base: keep polling confirmation endpoint on XHR failures
Fixes: #2912
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 12:25:46 +02:00
Jo-Philipp Wich
28aafc0dd4 luci-base: form.js: pass-through placeholder option of CBIListValue
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 10:22:05 +02:00
Jo-Philipp Wich
c67f052d91 luci-base: ui.js: HTML escape uci changelog values
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 10:22:05 +02:00
Jo-Philipp Wich
a6c538a776 luci-base: ui.js: HTML escape custom dropdown values
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 10:22:05 +02:00
Jo-Philipp Wich
86fcf91633 luci-base: ui.js: fix event binding for UISelect
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 10:22:05 +02:00