summaryrefslogtreecommitdiff
path: root/modules/luci-base/htdocs/luci-static/resources/rpc.js
Commit message (Collapse)AuthorAgeFilesLines
* luci-base: convert JavaScript code to ES6 stylees6Jo-Philipp Wich2023-09-261-45/+45
| | | | | | | | | | Convert existing JavaScript code in LuCI base to utilize ES6 standard features such as spread arguments, arrow functions, object method declarations etc. This makes the code somewhat easier to follow and slightly smaller. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: Fix typos in JsDocsSergey Ponomarev2023-09-231-5/+5
| | | | | | | | | | | | | | In some places argument name was renamed but in the JsDoc it's remain old. Added more typing for string enum fields like: @param {string} [type=text] replaced with: @param {"blob"|"text"|"blob"} [type=text] Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
* luci-base: don't append object.method to the RPC urlRafał Miłecki2020-09-231-3/+0
| | | | | | | | | | It was a cosmetic feature that doesn't work anymore with the latest uhttpd ubus API. Adding RESTful API resulted in treating URL part following the /ubus/ as the new API request. Suggested-by: Rafał Miłecki <rafal@milecki.pl> Fixes: #4465 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: add ability to reject nonzero ubus statusesJo-Philipp Wich2020-04-101-1/+10
| | | | | | | | Add a new declare option `reject` which makes the generated RPC call function reject with an error in case the remote ubus call returned a non-zero status. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: harmonize JS class naming and requestingJo-Philipp Wich2020-04-021-2/+4
| | | | | | | | | | | | | | | | - Make builtin classes available via `require` to allow view code to request external and internal classes in a consistent manner without having to know which classes are builtin and which not - Make base classes request any used class explicitely instead of relying on implicitly set up L.{dom,view,Poll,Request,Class} aliases - Consistently convert class names to lower case in JSdoc to match the names used in `require` statements - Deprecate L.{dom,view,Poll,Request,Class} aliases Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: luci.js, rpc.js, uci.js, network.js: add JSDoc annotationsJo-Philipp Wich2019-10-021-1/+256
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: increase default timeout to 20s, allow batch preventionJo-Philipp Wich2019-09-211-3/+4
| | | | | | | Support a new option "nobatch: true" in rpc.declare() which prevents the underlying RPC call from being batched with other calls. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: fix list requests, handle aborted http requestsJo-Philipp Wich2019-09-121-19/+25
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: revamp error handling, add interceptor supportJo-Philipp Wich2019-09-111-20/+56
| | | | | | | | Add two new functions L.rpc.addInterceptor() and L.rpc.removeInterceptor() which allow to register and remove interceptor functions which are invoked before the rpc reply result promise is fulfilled. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: add getStatusText() callJo-Philipp Wich2019-09-101-6/+25
| | | | | | | | | The new function allows translating an ubus return code into a human readable error message. Also report the called object and method on ubus rpc errors. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: rpc.js: drop batch apiJo-Philipp Wich2019-07-071-82/+33
| | | | | | | | | | 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>
* luci-base: rpc.js: make base URL configurableJo-Philipp Wich2019-07-071-2/+15
| | | | | | | 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>
* luci-base: add uci.js and rpc.js classesJo-Philipp Wich2019-07-071-0/+196
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>