Age | Commit message (Collapse) | Author |
|
Move classes required for Lua runtime support into a new `luci-lua-runtime`
package. Also replace the `luci.http` and `luci.util` classes in
`luci-lib-base` with stubbed versions interacting with the ucode based
runtime environment.
Finally merge `luci-base-ucode` into the remainders of `luci-base`.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Refactor various sort operations throughout luci-base to use the new
L.naturalCompare() comparator function.
This primarily ensures that embedded numbers are sorted numerically and
not in a lexicographical way.
It also simplifies some code as a side effect.
Ref: #5899
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add two new utility functions L.naturalCompare() and L.sortedArray() to
simplify sorting arrays naturally.
Ref: #5899
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
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 the `handleModalSave()` handler of the GridSection class invokes
`handleModalCancel()` after saving the data but before removing the
`addedSection` property, the `handleModalCancel` handler incorrectly
removed the uci section that has just been created.
This bug didn't affect anonymous GridSections because after saving the
id of the created section changes, causing the remove command to fail,
but for named ones with stable section IDs, the bug manifested.
Solve the issue by passing a flag to `handleModalCancel()` indicating
whether the method was called from a safe operation and use it do
decide whether to delete the new staged uci section or not.
Fixes: #5760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Optimized PNG filesize without any quality loss.
Signed-off-by: Alexander Semukhin <semukhin@mail.com>
|
|
For network devices declared in uci but not yet created by netifd, the
runtime status information will be unavailable, causing methods such as
`getType()` to assume plain ethernet interfaces and `getParent()` to fail
resolving parent devices.
Fall back to infer the information from uci configuration settings in such
cases to give accurate type hints to callers.
In particular, this prevents LuCI from turning wireless target networks
containing a to-be-created bridge device into bridges themselves.
Fixes: https://github.com/openwrt/packages/issues/18768
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Annotate gridsection textvalue cells as CBI.DummyValue widgets
- Replace `<br>` elements with newlines in `stripTags()`
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
If a whitespace-only description is set on an element, the CSS :empty
selector will not match, causing description icons to be shown when
there's no actual content.
To avoid that, trim the description string when building the element.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The `control-group` class is meant for gapless grouping of inputs with
buttons, while the page actions are just distinct buttons in a row.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Theme CSS styles shoudl take care of introducing padding as needed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Before opening (rendering) a nested modal map, make sure to save the parent
modal map in order to persist any structural uci changes, such as newly added
anonymous sections to prevent the nested map from operating on stale values
or ephemeral config section IDs.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The existing logic for cloning section options into the modal form section
container did not properly handle SectionValue objects. Introduce a new
`cloneOptions()` helper to recursively traverse and properly clowning
such nested sections.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The nested section modal might have changed values also covered/displayed by
the parent map, so ensure to reload all parent maps in the current modal
view stack to ensure that no stale values are shown on return.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The existing implementation was hardcoding the empty TableSection placeholder
instead of invoking `renderSectionPlaceholder()` which might be overridden by
various forms.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
If specific settings such as the protocol, IP address or netmask of an
interface the user is connected to are changed, the apply/rollback
mechanism might interfere. Display an additional warning dialog in this
case, instructing the user to manually reconnect and offering to continue
with a less safe unchecked apply mechanism.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Previously, "Apply unchecked" was only possible from the save action of CBI
maps, allow to invoke it from the configuration change dialog as well.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Do not abort the poll loop if some confirm request attempts fail, which
might happen when the device starts rolling back its configuration.
Before that fix, the rollback information dialog offering an unchecked
apply was not reliably presented in such situations.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Only stack a new modal CBI map on top of the currently displayed modal one
if the related map or section differs. This prevents misbehavior when
switching the protocol of interfaces.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Extend LuCI.ui.menu.getChildren() to resolve aliases and rewrites prior to
returning the menu nodes. This allows aliasing entire menu trees instead of
just single pages.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5702
Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add ability to reorder TableSection and GridSection rows by clicking on
column headers.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce a new `LuCI.ui.Table` class to simplify generating HTML tables
for data output and turn the existing `cbi_update_table()` procedure into
a wrapper around this new facility.
Tables generated by the new class closely resemble the old markup but
provide additional sorting capabilities.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Under some circumstances, ubus RPC requests may be initiated while LuCI is
still resolving the `rpcBaseURL` value. In this situation, the `target`
argument of the `request()` call will be a pending promise object which
results in an invalid URL when serialized by `expandURL()`, leading to an
`Failed to execute 'open' on 'XMLHttpRequest': Invalid URL` exception.
This commonly occured on the index status page which immediately initiates
ubus RPC calls on load to discover existing status page partials.
Solve the issue by filtering the given `target` argument through
`Promise.resolve()` before expanding the URL and initiating the actual
request.
Fixes: #3747
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5685
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Do not fallback to .innerHTML if DOMParser() failed for whatever reason.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Instead of relying on .innerHTML which executes embedded script code to
parse a given HTML fragment, use dom.parse() which utilizies DOMParser()
internally in order to extract textContent in a safe manner.
Fixes: FS#4199
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=4199
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Only replace null, objects and function values with the empty string but
return booleans and numbers as strings.
Spotted while debugging #5587.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5588
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The new `retain` boolean property controls whether the related option value
is purged from the configuration when the dependencies of the option are
not satisifed.
Ref: #5579
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Implement nested grid section support and use it for wireguard peer config
|
|
Fixes: #5544
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Implement a simple view stack within the modal overlay to allow the modal
edit dialog of a table or grid section to render another table or grid
section which recursively opens another modal edit dialog.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
luci-base: show validation message in save error
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Use the new `firewall.getZoneColorStyle()` helper to apply background
color styles.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The getZoneColorStyle() function will produce CSS style properties that
describe the color value of the zone. The color declaration is divided
into a CSS variable called `--zone-color-rgb` which holds the RGB value
of the color and a `background-color` property assigning these values
as background property.
This allows themes to override the color with derived values, e.g. by
applying an alpha channel.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Only treat the given identifier as Linux netdev name if we can find a
corresponding entry in the device info cache and do not consider strings
starting with "wlan", "ath" or "wl" to be existing devices.
This fixes incorrectly adding wireless sections as ifnames to network
interfaces when the wifi-iface section name begins with one of the
`iface_patterns_wireless` patterns.
Fixes: #5069
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
No functional changes but required for styling rules.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5466
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
|
|
When removing a `config interface` section in `/etc/config/network`, drop
related `rule` and `rule6` sections too, as well as related `dhcp` sections
in `/etc/config/dhcp`.
Ref: https://forum.openwrt.org/t/grooming-etc-config/109764/7
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Prefer nodes that do not require authentication over nodes that do
- Honour ACL dependencies while resolving firstchild nodes
- Consider currently active session while scanning menu tree instead
of only loading effective ACLs when a login node is encountered
- Do not consider nodes for firstchild dispatching which specify a
special "firstchild_ineligible" property
- Hide menu nodes that have no accessible children
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5354
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes: #5416
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Support the "loopback" interface by "widgets.NetworkSelect".
Enable the "loopback" option to include this interface.
Can be used to configure interface binding for services.
Signed-off-by: Vladislav Grigoryev <vg.aetera@gmail.com>
|
|
|
|
luci-base: prevent empty field for adding new entry
|
|
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
|