summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs/luci-static/resources/uci.js
AgeCommit message (Collapse)Author
2020-08-04luci-base: uci.js: fix option deletion quirksJo-Philipp Wich
Since option deletions are sent first, followed by ubus set commands, a call sequence like: uci.set('config', 'section', 'option', ['foo', 'bar']) uci.set('config', 'section', 'option', ['foo']) uci.unset('config', 'section', 'option') ... would result in the option retainining `foo` as value, instead of it getting removed as one would expect. Fix this issue by reverting the internal change state of the option before storing the deletion. While we're at it, also rework the internal tracking of deleted options to not result in duplicate removal requests when the same option is unset several times. Finally change all `undefined` returns to `null` in order to comply with the function documentation. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-26luci-base: uci.js: fix section deletion logicJo-Philipp Wich
- Process deletions before additions or changes, allowing user code to remove and recreate a section with the same name. - Only record section deletions when the section to be removed actually existed in the original config or when it was staged for creation earlier. This avoids stray ubus not found exception when saving. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14luci-base: uci.js: do not issue malformed uci/delete requestsJo-Philipp Wich
Fixes: #3912 Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7)
2020-04-13luci-base: uci.js: fix variable clashJo-Philipp Wich
Don't overwrite the `r` variable which is supposed to refer to the reordered uci sections with temporary data for collecting uci add parameters. Fixes stray uci/get permission errors caused by an attempt to load nonsensical uci package names. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10luci-base: uci.js: let internal RPC functions reject on errorsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-02luci-base: harmonize JS class naming and requestingJo-Philipp Wich
- 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>
2019-10-02luci-base: luci.js, rpc.js, uci.js, network.js: add JSDoc annotationsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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: 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: add uci.js and rpc.js classesJo-Philipp Wich
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>