project/luci.git
5 years agoluci-base: update Japanese translation
INAGAKI Hiroshi [Sat, 13 Jul 2019 09:31:02 +0000 (18:31 +0900)]
luci-base: update Japanese translation

Updated Japanese translations.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years agoi18n: sync translations
INAGAKI Hiroshi [Sat, 13 Jul 2019 06:50:53 +0000 (15:50 +0900)]
i18n: sync translations

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years agoluci-base: fix translatable text in ui.js
INAGAKI Hiroshi [Sat, 13 Jul 2019 06:41:23 +0000 (15:41 +0900)]
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>
5 years agoluci-base: luci.js: add Promise.finally polyfill
Jo-Philipp Wich [Fri, 12 Jul 2019 08:42:41 +0000 (10:42 +0200)]
luci-base: luci.js: add Promise.finally polyfill

Fixes: #2854
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-app-wol: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:20:51 +0000 (20:20 +0300)]
luci-app-wol: update Ukrainian translation

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-app-upnp: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:19:33 +0000 (20:19 +0300)]
luci-app-upnp: update Ukrainian translation

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-app-samba4: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:18:12 +0000 (20:18 +0300)]
luci-app-samba4: update Ukrainian translation

Updates, fixes and additions.

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-app-samba: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:16:41 +0000 (20:16 +0300)]
luci-app-samba: update Ukrainian translation

Updates, fixes and additions.

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-app-opkg: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:15:11 +0000 (20:15 +0300)]
luci-app-opkg: update Ukrainian translation

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-app-firewall: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:13:18 +0000 (20:13 +0300)]
luci-app-firewall: update Ukrainian translation

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-base: update Ukrainian translation
Yurii [Thu, 11 Jul 2019 17:10:27 +0000 (20:10 +0300)]
luci-base: update Ukrainian translation

Updates, fixes and additions.

Signed-off-by: Yurii <yuripet@gmail.com>
5 years agoluci-base: ui.js: fix UISelect.setValue()
Jo-Philipp Wich [Fri, 12 Jul 2019 07:17:14 +0000 (09:17 +0200)]
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>
5 years agoluci-base: luci.js: only use overrideMimeType when supported
Jo-Philipp Wich [Thu, 11 Jul 2019 13:06:13 +0000 (15:06 +0200)]
luci-base: luci.js: only use overrideMimeType when supported

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: validation.js: fix nested function declarations
Jo-Philipp Wich [Thu, 11 Jul 2019 13:04:54 +0000 (15:04 +0200)]
luci-base: validation.js: fix nested function declarations

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: ui.js: fix UISelect.getValue()
Jo-Philipp Wich [Thu, 11 Jul 2019 12:39:42 +0000 (14:39 +0200)]
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>
5 years agoluci-app-bmx7: transfer from routing
Paul Spooren [Fri, 5 Jul 2019 23:25:07 +0000 (01:25 +0200)]
luci-app-bmx7: transfer from routing

The Makefile is minified as the LuCi build system does most of the job.

Signed-off-by: Paul Spooren <mail@aparcar.org>
5 years agoluci-base: luci.js: fix undefined "this" when /ubus/ is unavailable
Jo-Philipp Wich [Wed, 10 Jul 2019 11:30:52 +0000 (13:30 +0200)]
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>
5 years agoluci-app-mwan3: rename ubus values
Florian Eckert [Fri, 28 Jun 2019 11:54:43 +0000 (13:54 +0200)]
luci-app-mwan3: rename ubus values

Update status view because of ubus value rename

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
5 years agoluci-mod-status: show all interface addresses on index page
Jo-Philipp Wich [Wed, 10 Jul 2019 05:13:00 +0000 (07:13 +0200)]
luci-mod-status: show all interface addresses on index page

Insteado f displaying only the primary/delegated address, display all
configured IP addresses in the upstream interface boxes, similar to
the interface overview page.

Fixes: #2757
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: cache determined RPC base url in session storage
Jo-Philipp Wich [Tue, 9 Jul 2019 05:31:40 +0000 (07:31 +0200)]
luci-base: luci.js: cache determined RPC base url in session storage

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: properly handle getWifiNetidBySid() return value
Jo-Philipp Wich [Tue, 9 Jul 2019 15:48:46 +0000 (17:48 +0200)]
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>
5 years agoMerge pull request #2839 from stangri/master-luci-app-advanced-reboot
Hannu Nyman [Tue, 9 Jul 2019 15:25:58 +0000 (18:25 +0300)]
Merge pull request #2839 from stangri/master-luci-app-advanced-reboot

luci-app-advanced-reboot: fix README url in Makefile

5 years agoluci-base: fix label-to-input association in js cbi maps
Jo-Philipp Wich [Tue, 9 Jul 2019 12:07:09 +0000 (14:07 +0200)]
luci-base: fix label-to-input association in js cbi maps

Fixes: #2845
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoMerge pull request #2844 from TDT-AG/pr/20190709-luci-app-statistics
Florian Eckert [Tue, 9 Jul 2019 11:59:24 +0000 (13:59 +0200)]
Merge pull request #2844 from TDT-AG/pr/20190709-luci-app-statistics

luci-app-statistics: fix collectd config generation

5 years agoluci-app-statistics: fix collectd config generation 2844/head
Florian Eckert [Tue, 9 Jul 2019 10:47:37 +0000 (12:47 +0200)]
luci-app-statistics: fix collectd config generation

Fix config generation for the following sections:

* curl
* exec
* network
* iptables

Ref: https://github.com/openwrt/packages/issues/9427
Fixes: c1380ab ("make luci-app-statistics more extensible")
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
5 years agoluci-app-advanced-reboot: fix README url in Makefile 2839/head
Stan Grishin [Mon, 8 Jul 2019 19:44:55 +0000 (12:44 -0700)]
luci-app-advanced-reboot: fix README url in Makefile

Signed-off-by: Stan Grishin <stangri@melmac.net>
5 years agobuild: add circleci
Paul Spooren [Sun, 7 Jul 2019 20:14:13 +0000 (22:14 +0200)]
build: add circleci

This automatically performs formal checks and also checks and compiles
the packages. The resulting packages are then stored as artifacts and
easily testable on running machines.

Signed-off-by: Paul Spooren <mail@aparcar.org>
5 years agoluci-base: use native ubus HTTP gateway if available
Jo-Philipp Wich [Mon, 8 Jul 2019 15:39:24 +0000 (17:39 +0200)]
luci-base: use native ubus HTTP gateway if available

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base,luci-mod-system: split ubus localtime into get and set call
Jo-Philipp Wich [Mon, 8 Jul 2019 15:07:11 +0000 (17:07 +0200)]
luci-base,luci-mod-system: split ubus localtime into get and set call

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: add rpcd ACL rules
Jo-Philipp Wich [Mon, 8 Jul 2019 14:25:30 +0000 (16:25 +0200)]
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>
5 years agoRevert "luci-base: luasrcdiet: switch to scm clone and fix tarball name"
Jo-Philipp Wich [Sun, 7 Jul 2019 20:03:21 +0000 (22:03 +0200)]
Revert "luci-base: luasrcdiet: switch to scm clone and fix tarball name"

This reverts commit faa5f0eacd2b2c90c33a75ee1e7fd3ec776601af.

Fixes: #2834
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: mvalue.htm: fix reading back multi value options
Jo-Philipp Wich [Sun, 7 Jul 2019 19:26:24 +0000 (21:26 +0200)]
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>
5 years agoluci-base: fix cbi mvalue templates
Jo-Philipp Wich [Sun, 7 Jul 2019 19:13:02 +0000 (21:13 +0200)]
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>
5 years agoluci-mod-network: switch hostname configuration to client side js
Jo-Philipp Wich [Sun, 7 Jul 2019 18:14:18 +0000 (20:14 +0200)]
luci-mod-network: switch hostname configuration to client side js

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: network.js: dynamically calculate IPv4 netmasks
Jo-Philipp Wich [Sun, 7 Jul 2019 18:12:42 +0000 (20:12 +0200)]
luci-base: network.js: dynamically calculate IPv4 netmasks

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agotreewide: switch to shared isObject(), toArray() and sortedKeys() helpers
Jo-Philipp Wich [Sun, 7 Jul 2019 18:11:35 +0000 (20:11 +0200)]
treewide: switch to shared isObject(), toArray() and sortedKeys() helpers

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: add isObject(), toArray() and sortedKeys() helper
Jo-Philipp Wich [Sun, 7 Jul 2019 18:10:13 +0000 (20:10 +0200)]
luci-base: luci.js: add isObject(), toArray() and sortedKeys() helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-mod-network: switch route configuration page to client side view
Jo-Philipp Wich [Sun, 7 Jul 2019 17:11:37 +0000 (19:11 +0200)]
luci-mod-network: switch route configuration page to client side view

Also implement extended route attributes via modal dialog.

Fixes: #2695
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: form.js: reload map data when saving modal forms
Jo-Philipp Wich [Sun, 7 Jul 2019 17:09:12 +0000 (19:09 +0200)]
luci-base: form.js: reload map data when saving modal forms

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: widgets.js: add textvalude representation for network select
Jo-Philipp Wich [Sun, 7 Jul 2019 17:08:03 +0000 (19:08 +0200)]
luci-base: widgets.js: add textvalude representation for network select

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoMerge pull request #2806 from dibdot/magic
Jo-Philipp Wich [Sun, 7 Jul 2019 13:39:56 +0000 (15:39 +0200)]
Merge pull request #2806 from dibdot/magic

system-wide: fix escaping of magic chars

5 years agoluci-base: uci.js: track packages affected by reorder operations
Jo-Philipp Wich [Sun, 7 Jul 2019 13:10:30 +0000 (15:10 +0200)]
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>
5 years agoluci-theme-bootstrap: add CBI order drag/drop styles
Jo-Philipp Wich [Fri, 5 Jul 2019 13:39:03 +0000 (15:39 +0200)]
luci-theme-bootstrap: add CBI order drag/drop styles

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-theme-bootstrap: add various CSS tweaks
Jo-Philipp Wich [Fri, 5 Jul 2019 12:11:18 +0000 (14:11 +0200)]
luci-theme-bootstrap: add various CSS tweaks

 - Apply the same style to <button> and <input type="button"> elements
 - Increase width of modal CBI dialogs

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: fix regular expression in network.Protocol.getDevices()
Jo-Philipp Wich [Fri, 5 Jul 2019 10:00:11 +0000 (12:00 +0200)]
luci-base: fix regular expression in network.Protocol.getDevices()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-app-firewall: switch to client side CBI views
Jo-Philipp Wich [Thu, 13 Jun 2019 13:23:26 +0000 (15:23 +0200)]
luci-app-firewall: switch to client side CBI views

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: add tools.widgets JS library
Jo-Philipp Wich [Thu, 13 Jun 2019 17:06:02 +0000 (19:06 +0200)]
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>
5 years agoluci-base: validation.js: rework translation labels
Jo-Philipp Wich [Thu, 13 Jun 2019 13:16:12 +0000 (15:16 +0200)]
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>
5 years agoluci-base: uci.js: add extended section syntax support, improve loading
Jo-Philipp Wich [Thu, 13 Jun 2019 13:13:11 +0000 (15:13 +0200)]
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>
5 years agoluci-base: {ui,form}.js: allow passing additional CSS classes to modals
Jo-Philipp Wich [Thu, 13 Jun 2019 13:01:00 +0000 (15:01 +0200)]
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>
5 years agoluci-base: luci.js: don't abort finished xhr objects
Jo-Philipp Wich [Fri, 7 Jun 2019 10:51:27 +0000 (12:51 +0200)]
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>
5 years agoluci-base: cbi.js: fix number rounding in string.format()
Jo-Philipp Wich [Thu, 6 Jun 2019 19:06:25 +0000 (21:06 +0200)]
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>
5 years agoluci-base: form.js: support placeholders for DynamicList widgets
Jo-Philipp Wich [Thu, 6 Jun 2019 19:05:34 +0000 (21:05 +0200)]
luci-base: form.js: support placeholders for DynamicList widgets

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: form.js: fix rendering flag values in modals
Jo-Philipp Wich [Thu, 6 Jun 2019 19:05:15 +0000 (21:05 +0200)]
luci-base: form.js: fix rendering flag values in modals

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: form.js: trigger validation before saving cbi map
Jo-Philipp Wich [Thu, 6 Jun 2019 19:04:04 +0000 (21:04 +0200)]
luci-base: form.js: trigger validation before saving cbi map

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: form.js: prevent section creation on modal cbi save failure
Jo-Philipp Wich [Thu, 6 Jun 2019 19:02:04 +0000 (21:02 +0200)]
luci-base: form.js: prevent section creation on modal cbi save failure

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: ui.js: fix rendering of rich dropdown placeholders
Jo-Philipp Wich [Thu, 6 Jun 2019 18:49:19 +0000 (20:49 +0200)]
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>
5 years agoluci-base: implement further ubus calls
Jo-Philipp Wich [Thu, 6 Jun 2019 17:24:10 +0000 (19:24 +0200)]
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>
5 years agoluci-base: fix handling of large ubus HTTP requests
Jo-Philipp Wich [Thu, 6 Jun 2019 17:19:31 +0000 (19:19 +0200)]
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>
5 years agoluci-base: add client-side implementation of luci.model.firewall
Jo-Philipp Wich [Tue, 28 May 2019 15:49:00 +0000 (17:49 +0200)]
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>
5 years agoluci-base: add client-side implementation of luci.model.network
Jo-Philipp Wich [Tue, 28 May 2019 13:32:31 +0000 (15:32 +0200)]
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>
5 years agoluci-base: add client-side prng library
Jo-Philipp Wich [Tue, 28 May 2019 15:50:37 +0000 (17:50 +0200)]
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>
5 years agoluci-base: luci.js: make require() failures catcheable
Jo-Philipp Wich [Tue, 28 May 2019 17:01:51 +0000 (19:01 +0200)]
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>
5 years agoluci-base: split off CBI validations into separate class
Jo-Philipp Wich [Tue, 28 May 2019 16:49:11 +0000 (18:49 +0200)]
luci-base: split off CBI validations into separate class

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: rework L.error()
Jo-Philipp Wich [Tue, 28 May 2019 16:57:43 +0000 (18:57 +0200)]
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>
5 years agoluci-base: form.js: default to unlimited dropdown size
Jo-Philipp Wich [Tue, 28 May 2019 13:31:26 +0000 (15:31 +0200)]
luci-base: form.js: default to unlimited dropdown size

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: ui.js: improve dropdown behaviour
Jo-Philipp Wich [Tue, 28 May 2019 13:28:53 +0000 (15:28 +0200)]
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>
5 years agoluci-mod-network: replace DHCP & DNS view with client side implementation
Jo-Philipp Wich [Fri, 5 Apr 2019 07:25:26 +0000 (09:25 +0200)]
luci-mod-network: replace DHCP & DNS view with client side implementation

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: implement lease status ubus call
Jo-Philipp Wich [Fri, 5 Apr 2019 07:25:00 +0000 (09:25 +0200)]
luci-base: implement lease status ubus call

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: rpc.js: drop batch api
Jo-Philipp Wich [Fri, 5 Apr 2019 06:14:28 +0000 (08:14 +0200)]
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>
5 years agoluci-mod-system: rework leds.js and system.js views
Jo-Philipp Wich [Fri, 5 Apr 2019 06:17:10 +0000 (08:17 +0200)]
luci-mod-system: rework leds.js and system.js views

- Drop manual RPC batch usage
- Use LuCI.Poll for status updates

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: auto-coalesce ubus requests
Jo-Philipp Wich [Fri, 5 Apr 2019 05:59:52 +0000 (07:59 +0200)]
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>
5 years agoluci-base: rpc.js: make base URL configurable
Jo-Philipp Wich [Fri, 5 Apr 2019 06:08:17 +0000 (08:08 +0200)]
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>
5 years agoluci-base: luci.js: introduce generic LuCI.Poll
Jo-Philipp Wich [Fri, 5 Apr 2019 05:55:54 +0000 (07:55 +0200)]
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>
5 years agoluci-base: luci.js: enable strict mode
Jo-Philipp Wich [Fri, 5 Apr 2019 05:51:16 +0000 (07:51 +0200)]
luci-base: luci.js: enable strict mode

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: handle postprocessed sources
Jo-Philipp Wich [Tue, 2 Apr 2019 15:21:58 +0000 (17:21 +0200)]
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>
5 years agoluci-mod-system: use client side cbi forms for system and led config
Jo-Philipp Wich [Mon, 1 Apr 2019 14:53:52 +0000 (16:53 +0200)]
luci-mod-system: use client side cbi forms for system and led config

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: add sys.init.reload() and sys.init.restart() actions
Jo-Philipp Wich [Fri, 5 Jul 2019 10:38:01 +0000 (12:38 +0200)]
luci-base: add sys.init.reload() and sys.init.restart() actions

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: add rpcd backend plugin
Jo-Philipp Wich [Mon, 1 Apr 2019 15:02:38 +0000 (17:02 +0200)]
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>
5 years agoluci-base: luci.js: catch base class loading errors
Jo-Philipp Wich [Mon, 1 Apr 2019 14:36:30 +0000 (16:36 +0200)]
luci-base: luci.js: catch base class loading errors

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: introduce form.js
Jo-Philipp Wich [Mon, 1 Apr 2019 14:22:13 +0000 (16:22 +0200)]
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>
5 years agoluci-base: switch from server side to client side widget markup
Jo-Philipp Wich [Mon, 1 Apr 2019 14:09:41 +0000 (16:09 +0200)]
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>
5 years agoluci-base: cbi.js, ui.js: add custom validation callbacks, new ui widgets
Jo-Philipp Wich [Mon, 1 Apr 2019 14:00:10 +0000 (16:00 +0200)]
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>
5 years agoluci-base: add client based view actions
Jo-Philipp Wich [Mon, 1 Apr 2019 13:38:00 +0000 (15:38 +0200)]
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>
5 years agoluci-base: luci.js: tweak error handling
Jo-Philipp Wich [Mon, 1 Apr 2019 13:30:42 +0000 (15:30 +0200)]
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>
5 years agoluci-base: replace uci change pages with client side modal dialog
Jo-Philipp Wich [Thu, 7 Feb 2019 18:10:34 +0000 (19:10 +0100)]
luci-base: replace uci change pages with client side modal dialog

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: add uci.js and rpc.js classes
Jo-Philipp Wich [Thu, 7 Feb 2019 17:53:25 +0000 (18:53 +0100)]
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>
5 years agoluci-base: add ubus-http gateway
Jo-Philipp Wich [Thu, 7 Feb 2019 17:40:36 +0000 (18:40 +0100)]
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>
5 years agoluci-base: move dropdown, combox and dynlist widget code to L.ui
Jo-Philipp Wich [Thu, 7 Feb 2019 17:29:29 +0000 (18:29 +0100)]
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>
5 years agoluci-base: luci.js: add L.dom.data()
Jo-Philipp Wich [Thu, 7 Feb 2019 17:19:58 +0000 (18:19 +0100)]
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>
5 years agoluci-base: cbi.js: support field validation for formless inputs
Jo-Philipp Wich [Tue, 5 Feb 2019 12:21:33 +0000 (13:21 +0100)]
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>
5 years agoluci-base: cbi.js: untangle dropdown and dynlists from dependency update
Jo-Philipp Wich [Tue, 5 Feb 2019 09:39:17 +0000 (10:39 +0100)]
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>
5 years agoluci-base: luci.js: add L.bind() helper
Jo-Philipp Wich [Fri, 25 Jan 2019 07:19:36 +0000 (08:19 +0100)]
luci-base: luci.js: add L.bind() helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: consolidate error handling
Jo-Philipp Wich [Tue, 8 Jan 2019 14:32:17 +0000 (15:32 +0100)]
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>
5 years agoluci-base: luci.js: convert LuCI.dom to Class instance
Jo-Philipp Wich [Mon, 7 Jan 2019 14:40:20 +0000 (15:40 +0100)]
luci-base: luci.js: convert LuCI.dom to Class instance

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
5 years agoluci-base: luci.js: split ui helper functions into external ui.js
Jo-Philipp Wich [Mon, 7 Jan 2019 14:26:08 +0000 (15:26 +0100)]
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>
5 years agoluci-base: luci.js: add dynamic class loader
Jo-Philipp Wich [Mon, 7 Jan 2019 13:48:19 +0000 (14:48 +0100)]
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>
5 years agoluci-base: luci.js: convert LuCI to Class instance
Jo-Philipp Wich [Mon, 7 Jan 2019 13:25:20 +0000 (14:25 +0100)]
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>
5 years agoluci-base: luci.js: add HTTP request functions
Jo-Philipp Wich [Sun, 6 Jan 2019 16:08:37 +0000 (17:08 +0100)]
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>
5 years agoluci-base: luci.js: add class construction helper
Jo-Philipp Wich [Sun, 6 Jan 2019 15:40:59 +0000 (16:40 +0100)]
luci-base: luci.js: add class construction helper

Signed-off-by: Jo-Philipp Wich <jo@mein.io>