validation:
use correct argument position for apply
network:
spec.need_tag -> port.need_tag agrees with old lua compat
widgets:
rv.length is undefined, use firstChild
form:
Follow-up to 315dbfc749
checkDepends recursion fix and implement cache lookup
uci:
improve timeout and Promise handling
ui:
follow-up to 92381c3ca2
renderListing sort: put directories first
getActiveTabId: check isNaN for tab state
getScrollParent: fix evaluation logic
fadeOutNotification: implement immediate timeout
openDropdown: accelerate draw via getBoundingClientRect
form:
ensure FlagValue parse always resolves
fs:
parse all 'expect' keys in RpcReply
luci:
Use the same source of truth in both the check and the dispatch
for flushRequestQueue
string check for dom string additions
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Linking the namespaces provides hierarchy which satisfies
various errors and warnings, but hides the front matter
for the classes for some reason.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
prevent global variable bleed and reduce size somewhat
-cbi
-network
-protocol/static
-rpc
-tools/widgets
-tools/views
-uci
protocols
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
When working with JSONMap backed data sources in tables, sort
triggers a null error because this.state is not available.
Prevent the null error if it is unavailable.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
The get_bool function documentation was missing an option value, so
add it. Provide a link into the developer's guide on how it's used
in scripts, for better background.
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
Any number of apps read boolean values from configuration files, then use
various inconsistent means for checking truth values. The get_bool function
allows app authors to fetch the value without regard for how it is represented
in the config file.
For example, this
let enabled = uci.get('system', 'ntp', 'enable_server');
if (enabled == '1') ...
could become the more natural
let enabled = uci.get_bool('system', 'ntp', 'enable_server');
if (enabled) ...
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
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>
This augments CBITableSection, affecting types which extend it, i.e.
CBIGridSection.
Setting a table 'cloneable' property to true reveals a column of clone
buttons who designate the current entry as a clone source. Clicking the
clone button duplicates the data of that section_id into a new entry,
while the new entry gets a new and unique SID. E.g.
s = m.section(form.GridSection, 'foo', _('Bar'));
...
s.cloneable = true;
Clone and add actions differ: clone will not open a dialogue. That is a
user exercise.
One may set the put_next flag to false to put the new clone last, or
true to put it next (after the clone source).
This uses a new uci action which fulfills the behaviour: clone
It is possible for the uci clone action to be used independently.
See also:
https://forum.openwrt.org/t/add-clone-button-to-luci-configurations-esp-in-firewall/196232
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This reverts commit 97ebdcbddb.
The commit seems to cause errors already before the login screen.
Discussion in https://github.com/openwrt/luci/commit/97ebdcbddb9cad76dc551086fcb887e55886a069#commitcomment-139871175
Errors like:
In error(), file [C]
called from function [anonymous function] (/usr/lib/lua/luci/ucodebridge.lua:23)
called from function ((tail call))
In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 148, byte 45:
called from function build_pagetree (/usr/share/ucode/luci/dispatcher.uc:382:73)
called from function menu_json (/usr/share/ucode/luci/dispatcher.uc:439:26)
called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:898:24)
called from anonymous function (/www/cgi-bin/luci:39:13)
` return lcall.call(modname, method, ...args);`
Near here ----------------------------------------^
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Because the menu JSON can have 'depends' in them, uci changes
should force the menu to regenerate.
Closes#6423
Signed-off-by: James Haggerty <james.haggerty@morsemicro.com>
Signed-off-by: Paul Donald <newtwen@gmail.com>
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>
Under certain circumstances, a staged uci option value might get unset
again before saving the config, leaving an empty section change set
behind, causing the save call to send an empty uci set request via rpc,
triggering an ubus code 4 (Resource not found) error.
In particular this prevented bridge VLANs from getting saved properly.
Fixes: #5876
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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>
- 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>
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>
- 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>
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>
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>
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>