summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
AgeCommit message (Collapse)Author
2019-07-10luci-base: luci.js: fix undefined "this" when /ubus/ is unavailableJo-Philipp Wich
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-10luci-base: luci.js: cache determined RPC base url in session storageJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-09luci-base: properly handle getWifiNetidBySid() return valueJo-Philipp Wich
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-09luci-base: fix label-to-input association in js cbi mapsJo-Philipp Wich
Fixes: #2845 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08luci-base: use native ubus HTTP gateway if availableJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08luci-base,luci-mod-system: split ubus localtime into get and set callJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-08luci-base: add rpcd ACL rulesJo-Philipp Wich
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-07Revert "luci-base: luasrcdiet: switch to scm clone and fix tarball name"Jo-Philipp Wich
This reverts commit faa5f0eacd2b2c90c33a75ee1e7fd3ec776601af. Fixes: #2834 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: mvalue.htm: fix reading back multi value optionsJo-Philipp Wich
Fixes: 2a229e50c ("luci-base: fix cbi mvalue templates") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: fix cbi mvalue templatesJo-Philipp Wich
Fixes: 9c7eb1dec ("luci-base: switch from server side to client side widget markup") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: network.js: dynamically calculate IPv4 netmasksJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07treewide: switch to shared isObject(), toArray() and sortedKeys() helpersJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: add isObject(), toArray() and sortedKeys() helperJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: form.js: reload map data when saving modal formsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: widgets.js: add textvalude representation for network selectJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07Merge pull request #2806 from dibdot/magicJo-Philipp Wich
system-wide: fix escaping of magic chars
2019-07-07luci-base: uci.js: track packages affected by reorder operationsJo-Philipp Wich
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-07luci-base: fix regular expression in network.Protocol.getDevices()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: add tools.widgets JS libraryJo-Philipp Wich
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-07luci-base: validation.js: rework translation labelsJo-Philipp Wich
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-07luci-base: uci.js: add extended section syntax support, improve loadingJo-Philipp Wich
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-07luci-base: {ui,form}.js: allow passing additional CSS classes to modalsJo-Philipp Wich
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-07luci-base: luci.js: don't abort finished xhr objectsJo-Philipp Wich
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-07luci-base: cbi.js: fix number rounding in string.format()Jo-Philipp Wich
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-07luci-base: form.js: support placeholders for DynamicList widgetsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: form.js: fix rendering flag values in modalsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: form.js: trigger validation before saving cbi mapJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: form.js: prevent section creation on modal cbi save failureJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: ui.js: fix rendering of rich dropdown placeholdersJo-Philipp Wich
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-07luci-base: implement further ubus callsJo-Philipp Wich
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-07luci-base: fix handling of large ubus HTTP requestsJo-Philipp Wich
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-07luci-base: add client-side implementation of luci.model.firewallJo-Philipp Wich
Introduce firewall.js, a client side reimplementation of the luci.model.firewall class. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: add client-side implementation of luci.model.networkJo-Philipp Wich
Introduce network.js, a client side reimplementation of the luci.model.network class. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: add client-side prng libraryJo-Philipp Wich
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-07luci-base: luci.js: make require() failures catcheableJo-Philipp Wich
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-07luci-base: split off CBI validations into separate classJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: rework L.error()Jo-Philipp Wich
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-07luci-base: form.js: default to unlimited dropdown sizeJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: ui.js: improve dropdown behaviourJo-Philipp Wich
- 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-07luci-base: implement lease status ubus callJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: rpc.js: drop batch apiJo-Philipp Wich
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-07luci-base: luci.js: auto-coalesce ubus requestsJo-Philipp Wich
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-07luci-base: rpc.js: make base URL configurableJo-Philipp Wich
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-07luci-base: luci.js: introduce generic LuCI.PollJo-Philipp Wich
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-07luci-base: luci.js: enable strict modeJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: handle postprocessed sourcesJo-Philipp Wich
- 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-07luci-base: add sys.init.reload() and sys.init.restart() actionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: add rpcd backend pluginJo-Philipp Wich
Add an rpcd executable plugin containing procedures required by client side views. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: catch base class loading errorsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: introduce form.jsJo-Philipp Wich
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>