Also fix a bug in apply that assigned undefined to a value if
this.apply was used multiple times in the same caller.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Fix incorrect @lends, @name, @class, and @classdesc annotations to match the actual
public API (LuCI.form.Flag and LuCI.form.Button).
Signed-off-by: LASER-Yi <liangyi0007@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>
We also implement delbtntitle functionality for various *Table
types. This means one can implement a table and rename its
Delete button like so:
s.delbtntitle = _('Kill it with fire!');
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
FileUpload was extended to accommodate the new features, since
it has nearly everything already. Create a DirectoryPicker
convenience wrapper.
Additions are:
-directory creation (dialogue); set directory_create to true
-directory select mode (instead of file); set directory_select to true
Also fix a bug in the breadcrumb generation which produced:
/foo » » bar
for /foo/bar if root_directory is not '/', and another bug that
merged links together when navigating upward again using the
breadcrumbs.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
mandate proper firewall compliant zone names. Use
validation ucifw4zonename instead of uciname. The former
does not permit leading digits which
Now we only permit "*" if flags .allowany and .nocreate are
set. This is when the widget is used to select pre-existing
zones and the zone 'any' ("*") is added as a .value.
Creating a zone named "*" shall not be allowed.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
follow-up to a2fce95248
hasSystemFeature() inspects the cached result of
probeSystemFeatures() which needs to have completed.
Once all of the legacy (Lua) stuff is ready, this block
runs:
initDOM() {
...
L.loaded = true;
document.dispatchEvent(new CustomEvent('luci-loaded'));
},
This commit now calls View.load() once system feature
probing has completed, and LuCI itself has loaded. This
ensures that the following load paradigm succeeds:
return view.extend({
load() {
return Promise.all([
...,
L.hasSystemFeature('x'),
]);
}, ...
The luci-loaded check prevents waiting when LuCI is already
loaded (the common case after initial page load), but the
listener handles the race condition where a View is
instantiated before initDOM() completes.
The flow:
If L.loaded is true: initDOM() already ran --> skip waiting,
proceed immediately.
If L.loaded is false: initDOM() hasn't run yet --> add
listener --> wait for it to complete.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This allows disabling selection of multiple entries by removing all
checkboxes from the dropdown list.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
for LuCI.request and `fs.exec_direct()`.
This commit adds XHR response progress event option in luci.js and fs.js.
And diagnostics.js will use this new event to update command output.
This commit also adds a `stderr` option in `fs.exec_direct()`, and
requires a patch for `cgi-io`.
Currently `cgi-io` redirects stderr to /dev/null, which makes user
unable to see error messages. The patch adds a `stderr` option,
and if it's set to `1`, redirects stderr to stdout.
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
Link: https://github.com/openwrt/luci/pull/7920
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>
A trace-back is produced when a netmask is set, and the contents of the IPv4
address field are removed or otherwise unset.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Bonding is configured under interface properties, and handled by netifd.
luci-proto-bonding was removed, even if the proto-bonding package is still
useful. This change prevents the trace-back from attempting to load
luci-proto-bonding.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This widget is modeled after CBINetworkSelect, which is similar in nature.
It presents a dropdown box of all device IPs with an accompanying badge of the
device.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
The rationale here is that tabbed CBIMaps were introduced in commit
082fd9ff10.
With tabbed maps, code could typically look like this:
m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo', _('foo Settings'));
The problem is that the title of "s" will be used as the name of the tab
rendered in "m", but also rendered as an <h3> right below the tab. IOW,
the same information will be presented twice, which looks weird.
Doing this instead...
m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo');
...means that the superfluous <h3> won't be rendered (since "s" has no
title), but the tab will then simply have the name of the section
("foo"), which can't be translated (bad).
After this change, the tabbed map can be written like this:
m = new form.Map('foobar', _('FooBar'));
m.tabbed = true;
s = m.section(form.TypedSection, 'foo', _('foo Settings'));
s.hidetitle = true;
Which will give the Map tab the name "foo Settings", but won't add a
title for the TypedSection right under the tab.
Signed-off-by: David Härdeman <david@hardeman.nu>
The current handling method introduces extraneous spaces into the translations.
For instance, 'System Log', which is correctly translated to Japanese as 'システムログ' (without extra spaces), is being displayed as 'システム ログ' under the current approach.
Other CJK/Southeast Asian languages are experiencing similar issues, including Chinese, Thai, and Lao.
Therefore, these elements should be translated together as a single unit, rather than separately.
Signed-off-by: Andy Chiang <AndyChiang_git@outlook.com>
Remodeled the CBILogreadBox after the syslog viewer. Also
updated to use ubus log read, and drops the use of the logread binary
(logread is broken on snapshots). The JSON output from ubus is nice
enough to work with.
One potential drawback is that all log entries are sent to the browser
(as it always has been), and no on-device pre-filtering is available yet
except for line count.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Because the setupDOM/initDOM methods do strange things related
to the old lua server rendered templates
(like remove all the elements currently hidden by dependencies...),
we want to be sure that these have finished before the view
itself renders.
This also ensures that any caching (e.g. from probeSystemFeatures)
is finished before the view render.
This feels like a hacky fix, but it's not clear to me what the best
one is.
Signed-off-by: James Haggerty <james.haggerty@morsemicro.com>
The usecalc property suffers from recursive calculation; that is, its
output becomes its input at the next save. It is not known in advance
whether a stored value is one that was calculated or not. So this part
was removed. The getCalculatedValue() function is retained should it be
desirable to get this value.
The 'optional' property was removed since it didn't do anything.
The 'validate' property is now correctly bound.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
textarea widgets have more value as readonly and not disabled, than
just disabled: you can scroll through them when they're readonly and
not disabled.
So give the form element separate readonly and disabled properties, so
textarea elements defined as readonly with a large amount of content
still cannot be modified, but at least the whole content can be viewed
(because the textarea scrollbars still function).
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This control is used to set values within a predefined range, and uses
the HTML 'input' element of type 'range' supported in all browsers.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Returning a device via getDevice() doesn't work out for tunnel configs,
like wireguard-wg0. Its dev property (for determining dev.getType()) is
always empty, but device is 'wireguard-wg0' and network is 'wg0'.
getDevice() returns an instantiated prototype which is not up, defeating
the purpose of querying its 'up' status.
When dealing with firewall zones and device widgets, what's interesting
is the dev. And getL3Device() is intended for this.
This effectively reverts commit f17ae7fd96
which attempted to address the problem of 'up' status; now calls via
getL3Device() get the correct up status.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Clear, crisp, resolution independent vector graphics replace the trusty
microscopic PNG. Some minor CSS changes were needed to constrain images
in some locations to make sure they don't consume too much space.
Iconography taken from Mate desktop theme with minor adjustments:
https://github.com/mate-desktop/mate-icon-theme/
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This Unicode character is intended to be followed by 2 more characters
which are combined. It's entirely unnecessary, so just remove it.
Fixes: #7754
Signed-off-by: Doug Freed <dwfreed@mtu.edu>
In the underlying uci system, all variables are effectively strings, so
for those configuration values which serve as 'boolean' flags, we need
to coerce the various forms into a real boolean. Only the following
string values result in true: 1|on|true|yes|enabled. Otherwise, false.
Checkboxes now fill correctly.
"Unchanged" configurations may write changed values as the Flag values
are coerced to '1' or '0' on write, but the configuration behaviour
remains synonymous.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
follow-up fix for 0be4ad51a0
It seems to have been this way for a while, for zone selections
involving the 'any' ('*') choice. firewall forwards.js has no
'this.allowany;' property on the widgets, so the any choice is absent,
leading to a traceback, caused by the 'src' widget, even though
this code block operates on the 'dst' value. Certain combinations of
'src' and 'dst' also triggered tracebacks.
This might not be the correct behaviour for this widget, but it does
prevent tracebacks caused by null values.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Tunnel devices which are up, show as down, since they don't have access
to any device status. The 'device' being enumerated is e.g.
'wireguard_wg0', a configuration for a tunnel interface, whose parent
is an 'ethernet' type.
That's a bug for another day. So they shall get parent device status.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>