Commit graph

1048 commits

Author SHA1 Message Date
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
Jo-Philipp Wich
f5919a990f luci-base: remove accidentally committed code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:48:35 +02:00
Jo-Philipp Wich
b2aada6c82 luci-base: add conntrack_helpers ubus procedure
Also move firewall specific ACLs into separate group.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:35:58 +02:00
Jo-Philipp Wich
ac96b8be43 luci-base: widgets.js: implement CBIDeviceSelect netdev picker
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:31:25 +02:00
Jo-Philipp Wich
3c332c6075 luci-base: widgets.js: handle devices or subnets in CBIZoneForwards
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:30:33 +02:00
Jo-Philipp Wich
b63576bbe7 luci-base: firewall.js: add zone.getDevices() and zone.getSubnets() getters
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 16:29:42 +02:00
Jo-Philipp Wich
e6ff0f39bb luci-base: widgets.js: CBIZoneSelect: improve initial rendering
Ref: https://github.com/openwrt/luci/issues/2889
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 08:58:59 +02:00
Jo-Philipp Wich
d1841af2f0 luci-base: widgets.js: CBIZoneSelect: fix availability of "device" choice
Ref: https://github.com/openwrt/luci/issues/2889
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-22 08:40:38 +02:00
Jo-Philipp Wich
0be4ad51a0 luci-app-firewall: fix cbi form for rules
- Set src/dest defaults only in initial section create state, otherwise it
   is impossible to specify output rules
 - Get rid of dest_remote/dest_local widget switching and implement change
   logic directly in tools.widgets.CBIZoneSelect
 - Remove leftover debug code

Ref: https://github.com/openwrt/luci/issues/2889
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-21 22:35:24 +02:00
Yurii
6a1db0171f
luci-base: correct spelling mistake in Ukrainian translation
Signed-off-by: Yurii <yuripet@gmail.com>
2019-07-21 13:27:19 +03:00
Yurii
2cf70faf8d
luci-base: Update Ukrainian translation
Update Ukrainian translation according the latest translation resync.

Signed-off-by: Yurii <yuripet@gmail.com>
2019-07-20 23:51:31 +03:00
Anton Kikin
780af6b9e6 luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-20 15:32:10 +03:00
Franco Castillo
b3461cd4dd luci-base: Update Spanish translation
Update Spanish translation.

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-07-19 17:25:25 -03:00
Jo-Philipp Wich
8aad613f1a luci-base: update german translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19 18:18:25 +02:00
Jo-Philipp Wich
9070fbc146 luci-base: resync base translations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19 18:07:04 +02:00
Jo-Philipp Wich
5510bdae39 luci-base: render default values for all server side cbi map widgets
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19 17:28:36 +02:00
Jo-Philipp Wich
dc0211803e luci-base: ui.js: fix multi vs. multiple keyword confusion
The "luci.form" and "luci.tools.widgets" classes use the "multiple"
keyword while ui.js uses "multi" internally, leading to single-value
dropdowns widget values getting stored as uci lists.

Fix the issue by using "multiple" everywhere.

Fixes: #2871
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-19 10:39:54 +02:00
Yurii
3635a32c56
luci-base: update Ukrainian translation
Updates, fixes and additions.

Signed-off-by: Yurii <yuripet@gmail.com>
2019-07-16 21:16:53 +03:00
Anton Kikin
82e20d437c luci-base: fix Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-15 15:50:45 +03:00
Florian Eckert
97c8ed26b5
Merge pull request #2859 from castillofrancodamian/base
luci-base: Update Spanish translation
2019-07-14 13:51:44 +02:00
Franco Castillo
8a73115ca3 luci-base: Update Spanish translation
Update Spanish translation.

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-07-13 22:55:39 -03:00
Anton Kikin
be28d9c9bf luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-07-13 23:03:09 +03:00
INAGAKI Hiroshi
7b1aabc29c luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-07-13 19:23:18 +08:00
INAGAKI Hiroshi
19c4b71af4 i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-07-13 19:23:18 +08:00
INAGAKI Hiroshi
48b61ca2c4 luci-base: fix translatable text in ui.js
Removed unnecessary symbols ("%>") at the end of the text.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-07-13 19:23:18 +08:00
Jo-Philipp Wich
7c9d845d9b luci-base: luci.js: add Promise.finally polyfill
Fixes: #2854
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-12 10:42:41 +02:00
Yurii
91194f42c4 luci-base: update Ukrainian translation
Updates, fixes and additions.

Signed-off-by: Yurii <yuripet@gmail.com>
2019-07-12 09:22:08 +02:00
Jo-Philipp Wich
3dcb061dcc luci-base: ui.js: fix UISelect.setValue()
Fixes: #2852
Fixes: ce04d7f ("luci-base: fix label-to-input association in js cbi maps")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-12 09:17:14 +02:00
Jo-Philipp Wich
4b941bce40 luci-base: luci.js: only use overrideMimeType when supported
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-11 15:06:13 +02:00
Jo-Philipp Wich
a7bfaf9b0b luci-base: validation.js: fix nested function declarations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-11 15:04:54 +02:00
Jo-Philipp Wich
43043a46a3 luci-base: ui.js: fix UISelect.getValue()
Fixes: #2852
Fixes: ce04d7f04 ("luci-base: fix label-to-input association in js cbi maps")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-11 14:40:51 +02:00
Jo-Philipp Wich
69e5488c13 luci-base: luci.js: fix undefined "this" when /ubus/ is unavailable
Fixes: #2850
Fixes: 66dfe64ca ("luci-base: luci.js: cache determined RPC base url in session storage")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-10 13:30:52 +02:00
Jo-Philipp Wich
66dfe64ca1 luci-base: luci.js: cache determined RPC base url in session storage
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-10 07:15:02 +02:00
Jo-Philipp Wich
ffdafd4800 luci-base: properly handle getWifiNetidBySid() return value
The getWifiNetidBySid() helper returns an array containing the network id
and the corresponding radio name, not just the id.

Fixes: #2846.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-09 17:50:21 +02:00
Jo-Philipp Wich
ce04d7f040 luci-base: fix label-to-input association in js cbi maps
Fixes: #2845
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-09 14:09:22 +02:00
Jo-Philipp Wich
006f7c7932 luci-base: use native ubus HTTP gateway if available
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08 17:39:24 +02:00
Jo-Philipp Wich
acbc031a6d luci-base,luci-mod-system: split ubus localtime into get and set call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08 17:07:11 +02:00
Jo-Philipp Wich
abee9138de luci-base: add rpcd ACL rules
Add required ACL rules to allow access to the native ubus HTTP
interface directly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08 16:25:30 +02:00
Jo-Philipp Wich
8055ed4c46 Revert "luci-base: luasrcdiet: switch to scm clone and fix tarball name"
This reverts commit faa5f0eacd.

Fixes: #2834
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 22:03:28 +02:00
Jo-Philipp Wich
f4c87f4dc4 luci-base: mvalue.htm: fix reading back multi value options
Fixes: 2a229e50c ("luci-base: fix cbi mvalue templates")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 21:27:00 +02:00
Jo-Philipp Wich
2a229e50cf luci-base: fix cbi mvalue templates
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 21:13:02 +02:00
Jo-Philipp Wich
91afb6fae2 luci-base: network.js: dynamically calculate IPv4 netmasks
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 20:12:42 +02:00
Jo-Philipp Wich
f970c485cf treewide: switch to shared isObject(), toArray() and sortedKeys() helpers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 20:11:35 +02:00
Jo-Philipp Wich
37ca6fe6d6 luci-base: luci.js: add isObject(), toArray() and sortedKeys() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 20:10:13 +02:00
Jo-Philipp Wich
bce291e6c9 luci-base: form.js: reload map data when saving modal forms
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 19:12:59 +02:00
Jo-Philipp Wich
f8e6caf552 luci-base: widgets.js: add textvalude representation for network select
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 19:12:59 +02:00
Jo-Philipp Wich
1fad6c0eed
Merge pull request #2806 from dibdot/magic
system-wide: fix escaping of magic chars
2019-07-07 15:39:56 +02:00
Jo-Philipp Wich
e13822e709 luci-base: uci.js: track packages affected by reorder operations
This is required to properly reload the configurations after applying uci
changes that solely consist of uci section ordering operations.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
00a3da1fb3 luci-base: fix regular expression in network.Protocol.getDevices()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
a13dba8071 luci-base: add tools.widgets JS library
Add a tools.widgets library which bundles a number of useful, higher
level CBI widgets like firewall zone list or network interface dropdowns

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
1bd9ee91af luci-base: validation.js: rework translation labels
Rework validation error translations for compount operators such
as list() or neg() to not rely that much on specific native language
grammar.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
0560858380 luci-base: uci.js: add extended section syntax support, improve loading
Add support for extended section syntax notation in @type[#] format and
refactor the package loading function to not load configurations twice
when a package load operation is already pending and another load request
is made for the same package.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
dc2b38cb6f luci-base: {ui,form}.js: allow passing additional CSS classes to modals
Add the ability to pass additional CSS classes to modal dialogs and
make use of this facility in form.js to annotate CBI map modals.

This can be used later by themes to apply additional CSS rules.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
1605f29b6f luci-base: luci.js: don't abort finished xhr objects
Calling abort() on a finished xhr object will clear properties such
as status which can confuse code relying on legacy LuCI request
helper functions.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
0bcb9f9f1d luci-base: cbi.js: fix number rounding in string.format()
Ensure that patterns like %d, %x, %o or %b properly truncate their
operands to whole integers.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:26 +02:00
Jo-Philipp Wich
0539e7f6b9 luci-base: form.js: support placeholders for DynamicList widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
1482554de6 luci-base: form.js: fix rendering flag values in modals
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
ff775a69f7 luci-base: form.js: trigger validation before saving cbi map
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
bf3bf6a8a9 luci-base: form.js: prevent section creation on modal cbi save failure
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
4a0f8b5541 luci-base: ui.js: fix rendering of rich dropdown placeholders
Placeholders may be HTML elements instead of plain strings, so do
not use innerHTML to assign them but rely on L.dom.content() instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
2f79aa1c35 luci-base: implement further ubus calls
Implement new ubus rpcd backend calls for later use in the frontend:

 - netdevs: dump information about Linux network devices present
 - boardjson: dump /etc/board.json if present
 - offload_support: query whether netfilter offloading is supported

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
c5b6f42943 luci-base: fix handling of large ubus HTTP requests
Properly handle ubus POST requests exceeding the default chunk size
and fix a possible nil dereference when rejecting incoming requests
due to bad JSON message framing.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
79be2d57cd luci-base: add client-side implementation of luci.model.firewall
Introduce firewall.js, a client side reimplementation of the
luci.model.firewall class.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
eecf859b29 luci-base: add client-side implementation of luci.model.network
Introduce network.js, a client side reimplementation of the
luci.model.network class.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
928adb6484 luci-base: add client-side prng library
Introduce a new tools.prng JS library which implements the musl libc
srand() and rand() calls to produce identical pseudo random number
sequences in the browser which is needed for the string to color
conversion later on.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
5950b87dac luci-base: luci.js: make require() failures catcheable
Refactor L.require() to use L.raise() instead of L.error() to signal
class loading failures. This allows callers to handle class loading
errors in a graceful manner.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
6edc057451 luci-base: split off CBI validations into separate class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
8a6b89c671 luci-base: luci.js: rework L.error()
Factor out an L.raise() function out of L.error() which constructs and
throws an exception object.

Rework the remaining L.error() function to internally use L.raise() to
construct exceptionts to render.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
f302eabd72 luci-base: form.js: default to unlimited dropdown size
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
c2f8bc90ff luci-base: ui.js: improve dropdown behaviour
- Do not artificially cutoff dropdown items, use all available space
 - Close open dropdown when clicking into the preview area

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
bfae09e574 luci-base: implement lease status ubus call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
a31dc6f3c1 luci-base: rpc.js: drop batch api
Now that LuCI.Request is transparently coalescing requests, there
is no need for the rather cumbersome batch()/flush() api in rpc.js.

Also refactor the code to get rid of the rpcRequestRegistry indirection
and remove superfluous promises which simplifies the code a lot.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:25 +02:00
Jo-Philipp Wich
b21a2813b4 luci-base: luci.js: auto-coalesce ubus requests
Extend LuCI.Request to automatically coalesce subsequent requests
to ubus resources into single batch requests.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
90288b2e2c luci-base: rpc.js: make base URL configurable
Implement setters and getters for the base URL prefix used and also
implement a session ID getter while we're at it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
eee323cb66 luci-base: luci.js: introduce generic LuCI.Poll
Introduce a new LuCI.Poll class which is able to repeat any
promise based function and not strictly tied to HTTP request
semantics.

Also rework LuCI.Request.Poll and XHR.Poll as well as
LuCI.start(), LuCI.stop(), LuCI.halt() etc. to redirect to
the new api.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
8a8e8e0aac luci-base: luci.js: enable strict mode
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
74ccea6fa2 luci-base: luci.js: handle postprocessed sources
- Fix discovering base url if cache buster is appended to luci.js href
 - Fix extracting require tokens in minified sources

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
c7a9900c87 luci-base: add sys.init.reload() and sys.init.restart() actions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
6665a1d78c luci-base: add rpcd backend plugin
Add an rpcd executable plugin containing procedures required by client
side views.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
3bc73a7d05 luci-base: luci.js: catch base class loading errors
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
b839ee87f2 luci-base: introduce form.js
Add a new client side form.js library which is a more or less direct
reimplementation of the Lua side cbi.lua in JavaScript.

Due to its client side nature, it supports a number of features which
would be hard to realize on the server side, such as drag&drop sorting,
modal sub-map dialogs, reload-free editing etc.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
9c7eb1decd luci-base: switch from server side to client side widget markup
Do not render standard widgets like checkboxes, select boxes,
text input fields etc. on the server side anymore but utilize
the ui.js primitives instead.

This avoids logic duplication between server side cbi templates
and JS widgets in the future.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:24 +02:00
Jo-Philipp Wich
808b9f36eb luci-base: cbi.js, ui.js: add custom validation callbacks, new ui widgets
Implement further widget primitives like text inputs or checkboxes and
support custom validation callback functions when instantiating CBI
validators.

Also add support initializing ui.js widgets from the "data-ui-widget"
HTML attribute.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:36:23 +02:00
Jo-Philipp Wich
2beb9fa16f luci-base: add client based view actions
Introduce a new view() target for CBI dispatch nodes, as long with the
required template and plumbing work in luci.js to allow requiring view
classes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
5b7924c808 luci-base: luci.js: tweak error handling
If the ui class is loaded, use its modalDialog facility to display runtime
errors, alternatively render them into the maincontent area.

Also prevent duplication of stack trace information and throw a low level
error on session expiration to allow higher layers to properly handle it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
fda4ba598c luci-base: replace uci change pages with client side modal dialog
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
1dd910148e luci-base: add uci.js and rpc.js classes
Add a new rpc.js class which provides low level facilities to exchanges
messages with the ubus rpc endpoint.

Also introduce a new uci.js class which provides client side uci
manipulation routines.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
c89bbd50fd luci-base: add ubus-http gateway
Add an admin/ubus route mimicking the native uhttpd-mod-ubus protocol.

The main difference to the native protocol is that this gateway requires
no additional per-object/procedure ACL setup on the router side and that
it is located under the same prefix as LuCI itself, allowing the reuse
of the session login cookie.

This route is meant to be a transitional mechanism until client side
RPC calls are eventually migrated to uhttpd-mod-ubus completely.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
558f8c3b2a luci-base: move dropdown, combox and dynlist widget code to L.ui
Move the widget code to the ui class and replace it with compatibility
shims in cbi.js

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
e4c29c6db4 luci-base: luci.js: add L.dom.data()
Add a new data() function which allows to attach arbitrary JS data
to DOM elements.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
4a9f784a2a luci-base: cbi.js: support field validation for formless inputs
JS CBI fields have no parent form element anymore.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
6b8701c7bf luci-base: cbi.js: untangle dropdown and dynlists from dependency update
In order to prepare the move of the dynlist and dropdown widgets into
the LuCI ui class, remove the direct calls to cbi_d_update() and replace
them with custom events instead.

Extend cbi_init() to handle these custom events and to invoke
cbi_d_update() when receiving them.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
1b931e0262 luci-base: luci.js: add L.bind() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
ef187d5238 luci-base: luci.js: consolidate error handling
Add a new function L.error() which creates and throws a custom
error object with stack information and given type.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
26e54bb01f luci-base: luci.js: convert LuCI.dom to Class instance
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
344c4c5119 luci-base: luci.js: split ui helper functions into external ui.js
Use the new class loader infrastructure to move gui specific
functionality out of the luci.js core and dispatch a new event
'luci-loaded' which is fired once all external classes have
been fetched.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
ec6d4094b9 luci-base: luci.js: add dynamic class loader
Introduce L.require() to fetch additional JavaScript classes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
992638947d luci-base: luci.js: convert LuCI to Class instance
Also hijack cbi_init() and call it after the LuCI DOM setup.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
843031f819 luci-base: luci.js: add HTTP request functions
Add a fetch() inspired HTTP request utility class to luci.js and
replace the old xhr.js class with a stub using the new request api.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
fee8c1fc9c luci-base: luci.js: add class construction helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
9be6bb0577 luci-base: add ES6 Promise polyfill for IE < Edge
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Jo-Philipp Wich
53e20c4925 luci-base: luci.js: add Object.assign polyfill
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07 15:25:49 +02:00
Yousong Zhou
3a24c2dbaa luci-base: hide autocomplete-preventing password input with bigger offset
Fixes openwrt/luci#2624

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-07-06 22:48:10 +08:00
Yousong Zhou
609f5290c8 luci-base: nowrap for password input and reveal button
Fixes openwrt/luci#2624

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-07-06 22:48:10 +08:00
Hannu Nyman
2f769ee087 timezone data: update to 2019b
Update timezone data to 2019b

http://mm.icann.org/pipermail/tz-announce/2018-December/000055.html
http://mm.icann.org/pipermail/tz/2019-July/028249.html

2019a:
* Palestine "springs forward" on 2019-03-30 instead of 2019-03-23.
* Brazil no longer observes DST.

2019b:
* Palestine's 2019 spring-forward transition was on 03-29, not 03-30.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-07-05 17:56:04 +03:00
Martin Schiller
cc360b94f8 luci-base: fix typo in german translation
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2019-07-02 09:13:15 +02:00
Martin Schiller
001dc0664e luci-base: add german translations for led trigger
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2019-07-01 08:51:17 +02:00
Martin Schiller
19289107dd luci-mod-system: fix flash activity trigger name
The former name "Flashmemory write access" is wrong. The triggers also
indicate read/erase access to the flash memories.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2019-07-01 07:02:42 +02:00
Dirk Brenken
f73da9ca82
system-wide: fix escaping of magic chars
* fix escaping of magic lua chars (#2800)
* fix redundant second gsub line in shellstartsqescape function
* fix return value of shellstartsqescape function

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-06-29 19:26:07 +02:00
Hannu Nyman
1c80eb1962 luci-base: show niced processes on Status/Processes page
Modify the process status filter to allow also the processes
with a nice value to be visible on the Status/Processes page.

Filter out the top process itself.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-06-28 18:56:53 +03:00
Martin Schiller
a8f79f12d6 luci-mod-system: fix some led trigger name translations
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2019-06-28 15:44:26 +02:00
Franco Castillo
d3bb50dcd8 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-06-22 17:41:17 -03:00
Perry Thompson
1818499243 luci-base: update Traditional Chinese translation
Signed-off-by: Perry Thompson <contact@ryper.org>
2019-06-12 20:55:47 +08:00
a962702
b93d66d806 luci-base: update Traditional Chinese translation
update Traditional Chinese translations.

Signed-off-by: Andy Yun <a962702@yahoo.com>
2019-06-11 20:43:33 +08:00
Andy
7e27e3f930 luci-base: update Traditional Chinese translation
update Traditional Chinese translation.
Signed-off-by: Andy Yun <a962702@yahoo.com>
2019-06-11 20:43:33 +08:00
Hannu Nyman
0a5579a631 i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-06-09 19:24:00 +03:00
Anton Kikin
886e0b3eff luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-06-05 21:43:17 +03:00
Dirk Brenken
64fb538568
luci-base: fix duid_to_mac reference in status.lua
* fix for openwrt/packages#9148

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-06-04 16:54:24 +02:00
Ansuel Smith
bb34a31e81
luci-base: handle dhcp lease from odhcpd
Currently only the dnsmasq lease file is read for hostname hint. If someone use only odhcpd as dhcp daemon the hostname resolution on wifi_assoc list is broken.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2019-06-03 12:51:33 +02:00
Ansuel Smith
525d62ff33
luci-base: adds duid_to_mac to sys.lua
Move duid_to_mac function from status.lua to sys.lua.
Implement translation from DUID-LL without header to MAC

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2019-06-03 12:48:48 +02:00
Florian Eckert
d1d5471137
Merge pull request #2174 from rosysong/lease-status
luci-base: drop ipv6 lease status when IPV6 is not support
2019-05-25 21:43:50 +02:00
Lars Kruse
ed6a660261 luci-base: Update German translation
The following changes are included:
* properly handle "Präfix" as neuter
* add missing hyphens to many appearances of "Präfix"
* fix spelling
* add few missing translations

Signed-off-by: Lars Kruse <devel@sumpfralle.de>
2019-05-18 00:26:44 +02:00
Hannu Nyman
a7d35ede73
Merge pull request #2716 from castillofrancodamian/base
luci-base: Update Spanish translation
2019-05-17 16:56:26 +03:00
Zheng Qian
3435c5272d luci-base: zh_CN: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2019-05-17 09:21:46 +08:00
Franco Castillo
7681967fcb luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-05-16 20:14:14 -03:00
Franco Castillo
1df3fe306d luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-05-15 00:25:07 -03:00
INAGAKI Hiroshi
fef11c2ac1 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-05-13 18:58:37 +09:00
INAGAKI Hiroshi
b21a425a2c i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-05-13 18:18:52 +09:00
Jo-Philipp Wich
444f06b1b0
Merge pull request #2687 from HenryGiraldo/master
luci-mod-admin-full: add dependency for channel auto
2019-05-09 13:26:10 +02:00
Jo-Philipp Wich
0ac85a440a luci-base: remove interface from zone upon deletion
Fixes: #2690
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-05-06 08:22:39 +02:00
Enrique Giraldo
4518c06290 luci-mod-admin-full: add dependency for channel auto
Do not show 'auto' channel option if hostapd is
not compiled with CONFIG_ACS

Signed-off-by: Enrique Giraldo <hgiraldos@gmail.com>
2019-05-02 08:47:06 +02:00
Jo-Philipp Wich
e76caf18bf luci-base: luci.model.network: simplify is_auto()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-04-30 09:06:10 +02:00
Florian Eckert
bea3879009 luci-base: add is_auto function
Add missing is_auto getter function.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-04-25 10:15:52 +02:00
Jo-Philipp Wich
3c7b3fa171
Merge pull request #2681 from dibdot/shadowsocks-fix
luci-app-shadowsocks-libev: fix cidr datatype
2019-04-23 17:29:52 +02:00
Dirk Brenken
8fffadecc5
luci-app-shadowsocks-libev: fix cidr datatype
* add a new 'cidr' alias datatype to fix #2671

Signed-off-by: Dirk Brenken <dev@brenken.org>
2019-04-23 16:57:05 +02:00
Franco Castillo
b09ebf4dd5 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-04-20 20:04:03 -03:00
Jo-Philipp Wich
a4f5b40025
Merge pull request #2642 from TDT-AG/pr/20190329-luci-base
luci-base: add cbi tsection error msg option
2019-04-08 09:20:14 +02:00
Jo-Philipp Wich
faa5f0eacd luci-base: luasrcdiet: switch to scm clone and fix tarball name
Switch the LuaSrcDiet download to direct cached SCM clones and
fix the tarball name while we're at it.

Supersedes: #2522
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-04-08 09:04:35 +02:00
Jo-Philipp Wich
fb453f552e luci-base: increase max size of network dropdowns
Fixes: #2646
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-04-02 08:17:36 +02:00
Florian Eckert
b347bd1462 luci-base: add cbi tsection error msg option
In some situation it is usefull to inform the use that this section
could not get delete, because this config is referenced or is in use.

Example pseudo code:

function s.remove(self, sid)
	<check if secation could get deleted>
	if output == nil then
		self.error_msg = translatef("Unable to remove this section")
		return nil
	end
end

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2019-03-29 09:27:04 +01:00
Franco Castillo
18a51e2aa5 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-03-27 14:08:37 -03:00
Franco Castillo
b02c70c4e1 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-03-05 20:29:50 -03:00
Franco Castillo
375b213685 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-03-01 16:41:26 -03:00
Franco Castillo
76e382cd8f luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-02-28 14:24:45 -03:00
Franco Castillo
70afc60d41 luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-02-26 19:13:59 -03:00
Franco Castillo
4528aee9bc luci-base: Update Spanish translation
Update Spanish translation

Signed-off-by: Franco Castillo <castillofrancodamian@gmail.com>
2019-02-21 16:09:56 -03:00
Jo-Philipp Wich
eda8f02dac treewide: avoid double-escaping CBI section labels
Since the section labels are already HTML-escaped implicitely by the
striptags() function, we must not escape them again in attr() or
ifattr().

Fixes: #2524
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-02-12 08:32:02 +01:00
Jo-Philipp Wich
4141243762 luci-base: dispatcher: support raw values in attr() and ifattr()
Extend the attr() and ifattr() template functions to take an optional
further parameter indicating that the passed value should not be escaped.

This is needed for cases where the input already is escaped through
other means, e.g. when the value was previously filtered through the
striptags() template helper.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-02-12 08:31:08 +01:00
Zheng Qian
b7fabbd337 luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2019-02-11 19:44:52 +08:00
Yurii
36097124e3
luci-base: update Ukrainian translation
Signed-off-by: Yurii yuripet@gmail.com
2019-02-07 19:11:06 +02:00
INAGAKI Hiroshi
e00fec9f31 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-02-04 22:34:47 +09:00
INAGAKI Hiroshi
ccb762997f i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2019-02-04 21:44:52 +09:00
Yurii
147a8888c8
luci-base: update Ukrainian translation
Signed-off-by: Yurii yuripet@gmail.com
2019-01-26 17:11:36 +02:00
Zheng Qian
a0a78baf85 luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2019-01-25 11:13:57 +08:00
Hannu Nyman
865d0cf9c7 i18n: sync translations
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-01-24 18:43:21 +02:00
Hannu Nyman
d99831e9d0 treewide: cleanup LEDE references
Remove old LEDE references.
Also remove one obviously wrong translation from pt-br

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-01-24 18:39:15 +02:00
Anton Kikin
663d772da9 luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2019-01-15 06:46:16 +03:00
Jo-Philipp Wich
e3fa766b58
Merge pull request #2425 from cshoredaniel/pr-fix-ipaddrport-js
luci-base: Fix addr:port validate always fails
2019-01-11 07:19:27 +01:00
Zheng Qian
16c63026e8 luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2019-01-10 16:12:33 +08:00
Krystian Kozak
06804ade60 luci-base: update Polish translation
Polish translation has been updated.

Signed-off-by: Krystian Kozak <krystian.kozak20@gmail.com>
2019-01-05 19:33:30 +01:00
Daniel F. Dickinson
f5a871bfe8 luci-base: Fix addr:port validate always fails
In cbi.js there is an error which causes ipaddrport validation to always fail.
JS match() return the entire match as ret[0] and individual matches (for multiple ()) as the
subsequent list members.  So we fix it by just fixing the index in the calls that want the
individual parts.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-01-05 00:43:37 -05:00
Hannu Nyman
c7776c8959 timezone data: update to 2018i
Update timezone data to 2018i

http://mm.icann.org/pipermail/tz-announce/2018-December/000053.html
http://mm.icann.org/pipermail/tz-announce/2018-December/000054.html

2018h:
* Qyzylorda, Kazakhstan moved from +06 to +05 on 2018-12-21.
* New zone Asia/Qostanay because Qostanay, Kazakhstan didn't move.
* Metlakatla, Alaska observes PST this winter only.
* Guess Morocco will continue to adjust clocks around Ramadan.
* Add predictions for Iran from 2038 through 2090.

2018i:
* São Tomé and Príncipe switches from +01 to +00 on 2019-01-01.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2019-01-02 21:32:47 +02:00
Yurii
393d414492
luci-base: update Ukrainian translation
Signed-off-by: Yurii yuripet@gmail.com
2018-12-29 23:22:54 +02:00
Jo-Philipp Wich
ed914df3f5 luci-base: rework filebrowser initialization
Do not call cbi_init() from the browser field template but lazily initialize
the field, like it is being done for all other widgets as well.

Fixes: #2398
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-29 14:19:59 +01:00
INAGAKI Hiroshi
e7e8475062 luci-base: fix Japanese translation
Fixed Japanese translation.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-12-26 19:49:18 +09:00
Gyrotron
38c03bcbc9 luci-base: fix zh-tw translation
Fixes #1092

Signed-off-by: Simmar Kalsi simmarkalsi@gmail.com
[reword commit message subject]
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2018-12-26 01:32:03 +00:00
Florian Eckert
3b9ba0210e luci-base: use default poll interval
Replace all XHR poll time number with -1 so they will use the default
poll interval time value from "/etc/config/luci". If this is not set then
5 seconds as default is used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-20 10:20:23 +01:00
Florian Eckert
6475221d54 modules: use configurable poll interval
Make poll interval configurable. Use option from

----
config core 'main'
    option pollinterval '5'
---

This will only be used if the interval option is less or equal zero.
If the poll interval is not configured then a default value of 5 seconds
is used.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-12-20 10:19:07 +01:00
INAGAKI Hiroshi
7c9f7bc3eb luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-12-20 03:01:24 +09:00
INAGAKI Hiroshi
37b0211e62 i18n: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-12-20 02:21:14 +09:00
Zheng Qian
76f81c262c luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-12-14 10:14:01 +08:00
Jo-Philipp Wich
efb4d7c40a luci-base: fix table compare upon writing ipaddr changes
Fixes: b33192a03 ("luci-base: support cidr list notation for option ipaddr and ip6addr")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 12:14:37 +01:00
Jo-Philipp Wich
11b271d4a9 luci-base: properly option ipaddr in single cidr string notation as well
When an interface configuration specifies both "option ipaddr 1.2.3.4/24"
and "option netmask", then netifd will ignore the netmask in favor to the
prefix encoded in the cidr string.

Support this variant as well by treating a sole cidr string value as
singöe-item cidr list.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:57:16 +01:00
Jo-Philipp Wich
67c34c5f5f luci-base: fix typo in german translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:44:17 +01:00
Jo-Philipp Wich
c50849ddd2 luci-base: update german translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:41:24 +01:00
Jo-Philipp Wich
6c76300505 luci-base: resync translation templates
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:36:35 +01:00
Jo-Philipp Wich
b33192a033 luci-base: support cidr list notation for option ipaddr and ip6addr
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:35:38 +01:00
Jo-Philipp Wich
979a478001 luci-base: cbi.js: update deps on dynlist changes, honor placeholder
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-13 11:35:38 +01:00
Anton Kikin
43c7cb344c luci-base: fix UCI changelog markup mistake
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2018-12-12 02:05:59 +03:00
Jo-Philipp Wich
62990e2338 luci-base: fix syntax error in map.htm
Fixes #2366.
Fixes: 76e9c0305 ("luci-base: rework ui tabbing code")

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-11 06:54:09 +01:00
Jo-Philipp Wich
76e9c0305e luci-base: rework ui tabbing code
- Instantiate tab menus on the client side
 - Simplify server side markup generation
 - Show error indicators in cbi tabs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-10 13:41:34 +01:00
Jo-Philipp Wich
a7dcfbe06b luci-base: luci.js: emit custom events for tooltip open/close actions
The new `tooltip-open` and `tooltip-close` events allow other code to hook
into the tooltip div rendering, e.g. to populate it with custom markup.

Also ignore tooltip events originating from descendant elements while
we're at it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-10 13:41:34 +01:00
Jo-Philipp Wich
be506665df luci-base: fix ReferenceError
The showTooltip() and hideTooltip() functions have been moved to luci.js

Reported-by: brv phoenix <feixuekaka1@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-02 15:01:58 +01:00
Jo-Philipp Wich
2509b5984d luci-base: dispatcher: use consistent ordering
Use the same ordering logic for building the dispatch tree and for
querying the children of a given node.

Fixes #2338.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-27 15:25:05 +01:00
Jo-Philipp Wich
2e36e09303 luci-base: dispatcher: remove tree modifier support
This feature was never used, is hardly documented and appears to be
designed to fiddle with the internal dispatch tree state.

Given that, simply drop the related code to simplify the dispatcher
class somewhat.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-27 14:46:55 +01:00
Jo-Philipp Wich
1eea921df0 luci-base: modal accessibility fix, wrap XHR.stop()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-23 15:44:18 +01:00
Jo-Philipp Wich
db2bfb24ad
Merge pull request #2325 from YuriPet/master
luci-base & luci-app-opkg: update Ukrainian translation
2018-11-22 18:51:12 +01:00
Jo-Philipp Wich
241b90c7f6 luci-base: do not trigger form action when revealing password
Ref: https://github.com/openwrt/luci/issues/2327
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 14:47:56 +01:00
Yurii
5bc4902811
luci-base: update Ukrainian translation
Signed-off-by: Yurii yuripet@gmail.com
2018-11-22 14:07:45 +02:00
Jo-Philipp Wich
7c16decdb4 luci-base: move DOM manipulation functions to luci.js
Introduce a new luci.dom class which groups the DOM manipulation helpers
such as E(), findParent(), matchesElem() etc.

Provide wrappers for the old functions to ease the transition to the new
functions.

Also add a new widget helper function L.itemlist() which consolidates
the item enumeration formatting code found on various pages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 12:58:34 +01:00
Jo-Philipp Wich
05860e31f2 luci-base: cbi.js: remove functions moved to luci.js
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 12:49:14 +01:00
Jo-Philipp Wich
706c6836e4 luci-base: introduce common JavaScript api
Introduce a new script file luci.js which is included by default and
intended to be the common location of functions currently scattered
in cbi.js and xhr.js.

The luci.js file provides a LuCI() class which - among other things -
implements helpers to construct URL paths and making HTTP requests.

A singleton instance of the class is instantiated as window.L upon
load and preset with the necessary environment information.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 12:49:14 +01:00
Jo-Philipp Wich
17690f2d73 build: add build option to minify *.js files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22 12:49:14 +01:00
INAGAKI Hiroshi
38f19b4d34 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-11-22 16:30:52 +09:00
Anton Kikin
73f89ed327 luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2018-11-21 17:12:25 +03:00
Zheng Qian
1902816444 i18n: luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-11-21 09:50:07 +08:00
Jo-Philipp Wich
a17c5808f0 luci-base: resync translations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-20 11:46:17 +01:00
Jo-Philipp Wich
50ee130cd8 luci-base: fix apply/rollback strings
Commit 94d8c9a7a accidentally overwrite the rewording of strings made in
an earlier commit.

Fixes: 94d8c9a7a ("luci-base: simplify apply widget code")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-20 11:43:20 +01:00
Jo-Philipp Wich
51de74d520 luci-base: further hash calculation signedness bugfixes
- cbi.js: make sure to treat single bytes as signed char when
   handling end cases

 - template_lmo.c: make sure to treat single bytes as signed
   char when handling end cases, avoids hash miscalculations
   on ARM

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-19 13:31:43 +01:00
Jo-Philipp Wich
c55436e36f luci-base: cbi.js: fix sfh() signedness bug for strings with 3 trailing bytes
Replace a sign-propagating right shift by a zero-filling right shift to avoid
calculating a wrong hash code in the three-trailing-bytes case.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-19 11:58:17 +01:00
Jo-Philipp Wich
2babc47ae2 luci-base: cbi.js: fix sfh() hash calculation over multibyte sequences
The C side implementation of the hash operates on bytes while the JS variant
operated on UTF-16 codepoints, leading to miscalculations on input strings
containing multibyte sequences.

Recode the given string to an internal UTF-8 byte representation and
calculate the hash over that.

Fixes client side mapping of translation strings containing non-ASCII
characters.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-19 11:50:25 +01:00
Hannu Nyman
93fdac8560
Merge pull request #2298 from YuriPet/master
luci-base: update Ukrainian translation
2018-11-16 23:00:02 +02:00
Jo-Philipp Wich
a1fff6a9ee luci-base: xhr.js: rework class, handle expired session
Drop very old IE compat code, restructure class, align code style with
other files and properly handle JSON mimetypes with charset trailer.

Also detect session related 403 errors and show a modal prompting
to re-login.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-16 21:11:34 +01:00
Jo-Philipp Wich
425a02734e luci-base: dispatcher: add login indication on 403 errors
Send a custom LuCI X-Header to indicate that a login is required to access
the requested resource. This is mainly intended for xhr.js to be able to
intercept such responses and popup an authentication dialog.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-16 21:11:34 +01:00
Yurii
827c83f7ae
luci-base: update Ukrainian translation
Signed-off-by: Yurii yuripet@gmail.com
2018-11-16 21:59:41 +02:00
Anton Kikin
c098c2345c luci-base: update Russian translation
Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2018-11-16 19:50:46 +03:00
INAGAKI Hiroshi
2d1c0301f8 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-11-16 23:09:24 +09:00
Angus Ding
fdb7f3ed13 luci-base: rename "Design" to "Theme" in translation files
Signed-off-by: Angus Ding <angus.ding@gmail.com>
[squash commits, reword commit message, rebase, msgmerge]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-15 19:33:09 +01:00
Jo-Philipp Wich
76bf2ac6ce treewide: resync translation files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-15 19:32:53 +01:00
Wang805447391
09ac96ede9 luci-base: support disconnecting (deauthenticating) wireless clients
Add a button to each row in the wireless assoclist table to allow
disconnecting clients using the ubus del_client method if the underlying
radio interface supports it.

Ref: https://github.com/openwrt/luci/pull/2271
Submitted-by: Wang805447391 <805447391@qq.com>
[move deauth function to luci-base next to the existing assoclist function,
 require post security, fix parameter check condition, hide button if not
 supported by the radio, disable button after call, squash commits, fix
 whitespace, reword subject, add commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-15 08:28:45 +01:00
Jo-Philipp Wich
6bc04b6afb luci-base: fix some long standing german mistranslations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 21:03:40 +01:00
Jo-Philipp Wich
7e26fa89e9 luci-base: datatypes: add "unique" dummy validator
Add a dummy validator for the server side so that we can start using unique
in client side JS code.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:58:49 +01:00
Jo-Philipp Wich
ceb342dc8d
Merge pull request #2259 from pmelange/luci-app-olsr-new-json-lib
update luci-app-olsr to the new jsoninfo library
2018-11-14 20:50:03 +01:00
Jo-Philipp Wich
e442bfe0ae
Merge pull request #2282 from TDT-AG/pr/20181114-luci-base
luci-base: allow optional default value for file browser
2018-11-14 20:48:15 +01:00
Jo-Philipp Wich
4bbe32548c luci-lib-ipkg: move out of luci-base
Move the old luci.model.ipkg utility class into a separate package and
let the components using it depend on the new library package.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
94d8c9a7aa luci-base: simplify apply widget code
- Drop embedded CSS in favor to new global rules
 - Drop extraneous include of cbi.js
 - Use showModal() facilities
 - Fix a cosmetic bug in countdown timeout handling

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
333b7e57d3 luci-base: cbi.js: add modal dialog functions
Add two new functions showModal() and hideModal() which will fade in and
close an open modal respectively.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
6469b65354 luci-base: add luci.sys.process.exec()
The new process.exec() function simplifies spawning external processes
and capturing their stdio.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
4791180eb3 luci-base, themes: dropdown behaviour improvements
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
e35fb36ea5 luci-base: cbi.js: remove dead code in cbi_validate_field()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
56249c867e luci-base: cbi.js: enable validation for dropdown fields
Directly attach validation handlers to cbi dropdowns as well, this allows
validating dropdown choices made by the user, similar to how plain select
boxes are handled by the cbi JavaScript.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
207fc0121e luci-base: cbi.js: set .value property of cbi dropdown elements
In order to make cbi dropdowns usable for validation and other code
expecting native form elements, set the .value DOM property on the
dropdown parent element whenever the selection is changed.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
bbb800556d luci-base: cbi.js: properly handle cbi tooltips on nested elements
Rework the tooltip event delegation logic to prevent hiding the tooltop
when the cursor is moved to a children of the tooltip container element.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
b468e1416d luci-base: cbi.js: avoid using .form property directly
In order to prepare support for calling cbi validation on non-native form
widgets, remove direct usages of the node.form property and lookup the
containing form using findParent() instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
a453f2b9d0 luci-base: cbi.js: fix passing multiple dropdown values in change event
Due to a misspelled property name, only the first value was passed in
the event details.

Fixes: c2b570998 ("luci-base: cbi.js: rework dropdown implementation")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
10838c3660 luci-base: rework dynamic list template
Commit 7c7821833 ("luci-base, themes: rework dynlist and dropdown widgets")
changed the way we initialize dynamic lists on client side, avoiding the
need for pre-rendering the items on the server side.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
e33a367158 luci-base: add ARIA label to reveal/hide password button
Fixes #2070.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
974f5bc413 luci-base: update german translation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Florian Eckert
1a52df6bdb luci-base: allow optional default value for file browser
With this change we could set optional value for the file browser.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2018-11-14 10:10:56 +01:00
Zheng Qian
e57b4bbf8b i18n: luci-base: update Simplified Chinese translation
Signed-off-by: Zheng Qian <sotux82@gmail.com>
2018-11-14 10:25:28 +08:00
INAGAKI Hiroshi
db6e5bc8d4 luci-base: update Japanese translation
Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-11-11 15:47:49 +09:00
INAGAKI Hiroshi
183faf70a0 luci-base: sync translations
Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-11-11 15:35:47 +09:00
INAGAKI Hiroshi
c3225c7012 luci-base: fix translation issues
Fixed several issues for translation.

- add translation markup to "Expecting "
- add missing ")" into "valid time (HH:MM:SS"

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2018-11-11 15:24:18 +09:00
pmelange
4fc3ab4737 luci-base: network.lua add ipv6-prefix-assignment support to get_status_by_address
Signed-off-by: pmelange <isprotejesvalkata@gmail.com>
2018-11-07 18:41:58 +01:00
Hannu Nyman
40de466475 i18n: sync translations, add location annotatations
Thanks to a recent commit, the translation files will now
have info about locations where the string is used. That
can help is deciding the correct translation, as all contexts
are more easily found.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2018-11-07 18:10:59 +02:00
Jo-Philipp Wich
58fc702805 luci-base: validate DHCP clientid as hexstring
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:19:52 +01:00
Jo-Philipp Wich
9dda4c651c luci-base: cbi.js: add client-side hexstring datatype validator
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:13:39 +01:00
Jo-Philipp Wich
f4c39dd6ff luci-base: cbi.js: add heuristics to attribute handling in E()
If a given attribute value is a function, register it as event listener,
if it is an object, filter it through JSON.stringify(), else set it
as-is.

This helps to reduce some boiler-plate code when building DOM structures.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:11:46 +01:00
Jo-Philipp Wich
7c78218339 luci-base, themes: rework dynlist and dropdown widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:05:12 +01:00
Jo-Philipp Wich
c2b5709988 luci-base: cbi.js: rework dropdown implementation
- Refactor event handler closures into class methods and bind them instead
 - Fix quirk in dropdown placement calculation
 - Different dropdown placement strategy on touch devices
 - Broadcast custom "cbi-dropdown-change" event when value is changed
 - Implement setValues() method to alter dropdown selection
 - Prevent creating empty custom values

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:01:45 +01:00
Jo-Philipp Wich
6b8fc99fd5 luci-base: cbi.js: utilize node.closest() if available
Use node.closest() in findParent() when available since it should be faster
than manaually traversing the ancestor chain.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:01:45 +01:00
Jo-Philipp Wich
911d540cbb luci-base: cbi.js: drop cbi_bind()
Just use node.addEventListener() directly since all reasonably recent
browsers support it nowadays.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:01:45 +01:00
Jo-Philipp Wich
7337872aa1 luci-base: cbi.js: rework client side input validation
- Refactor and fix datatype validation functions
 - Turn the type compilation and validation into a proper class
 - Display tooltip with error hint on invalid inputs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-05 11:01:45 +01:00