summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/luci.js
AgeCommit message (Collapse)Author
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: 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: 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: 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: 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>
2019-07-07luci-base: add client based view actionsJo-Philipp Wich
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-07luci-base: luci.js: tweak error handlingJo-Philipp Wich
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-07luci-base: add ubus-http gatewayJo-Philipp Wich
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-07luci-base: luci.js: add L.dom.data()Jo-Philipp Wich
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-07luci-base: luci.js: add L.bind() helperJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: consolidate error handlingJo-Philipp Wich
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-07luci-base: luci.js: convert LuCI.dom to Class instanceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: split ui helper functions into external ui.jsJo-Philipp Wich
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-07luci-base: luci.js: add dynamic class loaderJo-Philipp Wich
Introduce L.require() to fetch additional JavaScript classes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: convert LuCI to Class instanceJo-Philipp Wich
Also hijack cbi_init() and call it after the LuCI DOM setup. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: add HTTP request functionsJo-Philipp Wich
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-07luci-base: luci.js: add class construction helperJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-07luci-base: luci.js: add Object.assign polyfillJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-10luci-base: rework ui tabbing codeJo-Philipp Wich
- 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-10luci-base: luci.js: emit custom events for tooltip open/close actionsJo-Philipp Wich
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-11-23luci-base: modal accessibility fix, wrap XHR.stop()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-22luci-base: move DOM manipulation functions to luci.jsJo-Philipp Wich
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-22luci-base: introduce common JavaScript apiJo-Philipp Wich
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>