Follow-up to 315dbfc749
In order to look at any saved uci value, the luci config
must be loaded before we render the page, so we can determine
stored preferences, for things like table filter, without
encumbering all consumers of configurable elements to load
the luci uci configuration.
All (Table) elements extend CBIAbstractElement, so load
there.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 01c53bec37)
Adds PoE/PSE configuration support for modern linux (PSE-PD).
This change is based on the PSE-PD backport (from 6.17)
and netifd|ubus changes.
* Add getPSE() [receive all status information]
and hasPSE() [has the device PSE hardware?]
* Changes ACL permissions to query network.device status information
* Add two new PoE icons (PoE active with link up + link down) for
the port status page
* Changes port status to show PoE information, next to link information
and data transfer.
* Add a new tab for PoE/PSE to the device configuration,
which will only be displayed if the device supports PSE
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
(cherry picked from commit 8e493db75a)
Message contains an embedded URL.
Better move it out of the translatable string
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit b8c049a1ed)
This is an area users seem to have most trouble searching
(via the browser window search), and firewall tables
tend to be the largest tables. Enable search.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit d9036435d5)
Filters might not be everyone's aesthetics, so hide filters
by default and expose a global flag which can be set under
System -> System -> Language and Style. Only tables which
have .filterrow set to true will show filters.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit d2511f4bfe)
filter() is already available to pre-filter any data we
want to display in a table prior to render, although this
is primarily to filter on data types in a config file.
Now it is possible to display a header row (thead)
with text fields to search a table column. Set the table
property .filterrow to true to enable. It is null by default
so the filter header row is disabled. The filters work
cumulatively, so they can be used in combination.
Stabilize column widths so when nothing shows due to
filters, the filter header rows don't eat up all the table
width and jump around if action buttons are present at the
right end of data rows.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 315dbfc749)
Tables are now structured with standard HTML tags:
table -> thead -> tr rows
table -> tbody -> tr rows
table -> tfoot -> tr rows
- wrap table header rows in a thead element
- wrap table body rows in a tbody element
- wrap footer rowss in a tfoot element
Footer row data can be provided by initializing any of the
form table types with .footer set to a string or function, or
overriding the renderFooterRows method.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 2da63d766a)
follow-up to 720c96ce5b
While ::before CSS styling has been deactivated, and
'content' removed, cbi-value-first-field is a bit
ambiguous. So, restore cbi-section-table-titles, and
replace the ::before tags in CSS.
Remove also the data-title for title rows. We already
insert titles for named headers and rows via HTML and
not via CSS after the mentioned commit.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 94da6ead86)
follow-up to 4d04877e0f
divs look OK in all themes but for Openwrt2020, but button
looks fine everywhere (as it was before above commit).
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit e365958f7d)
When getting values from the form, especially in a JSONMap,
some objects may be nested, and as such, it's not much use
to return '[object Object]'. Return the object instead, so
the caller can do something useful with it. This makes
multidimensional maps much easier to use.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 2682aecc7f)
* bugfix: check if name passed to setInitAction of rpcd script matches the
package name
* feature: add cron job support to WebUI (thanks @Aethersailor)
* add support for dnsmasq_sanity_check and dnsmasq_validity_check to UI
Signed-off-by: Stan Grishin <stangri@melmac.ca>
(cherry picked from commit 9277cc6faf)
Signed-off-by: Stan Grishin <stangri@melmac.ca>
When adding tabs in modal dialogues, the old code of simply assigning
s.tabs = this.tabs was problematic because it was an array of objects
whose behaviour would cause a traceback when s.tab is called in e.g.
a protocol handler Modal when it was reopened.
Now verify the properties do not already exist before assigning them.
This means one can define s.tab(...) in a Modal UI without a try
block (which would even then sometimes fail).
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 9a07b1b79d)
Previously when a table has the sortable property true, the
whole row was draggable but without any useful effect on desktop
or mobile. Only commencing the drag from the drag button worked
as intended. This interfered with text selections or other actions
in the table row.
Now the drag and touch events are bound to the drag button only.
The result is the same but the row contents are now selectable.
This change works on both desktop and touch only devices like
mobile.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 4d04877e0f)
Fix low-contrast text in dark mode that caused
labels to be hard to read.
Signed-off-by: Brian White <brianwhitedev1996@gmail.com>
(cherry picked from commit ef8ef56430)
While it's possible to stack validation using .datatype semantics,
e.g. o.datatype = 'and(foo,bar)' and those execute serially, they
depend on the internal validation factory and the built-ins there.
Now, one can define multiple functions in the calling code (passed
in an array) which execute serially. All validation functions
shall return true to succeed.
e.g.
```js
function foo(sid, val) {
return val.includes('foo');
}
function bar(sid, val) {
return val.includes('bar');
}
o = s.option(form.Value, 'foobar', _('foobar'));
o.default = 'foobar';
o.validate = [foo, bar];
```
This helps make validation less complex when special data-types
with high cardinality are in play. Previously, reuse of the this
context when calling sub functions was also lost.
The validate property passed to the new ui widget in form.js
```js
new ui.XX(..., { ... validate: this.getValidator(section_id), ...});
```
takes this.getValidator, which either binds a single validation
function or calls all of the validators, if the form element's
this.validate was an [array]. The result and effect are the same.
If a ui element is manually instantiated (when it's not being
called via form.js and this.getValidator might be unavailable),
passing an array to options.validate works identically:
```js
function foo(val) {
return val.includes('foo');
}
function bar(val) {
return val.includes('bar');
}
new ui.XX(..., { ... validate: [foo, bar], ...});
```
And the validation factory calls them serially.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit ed4a3fa933)
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>
(cherry picked from commit 04b289c16d)
Add the missing semicolon at the end of line 5.
Fix the syntax error popup on the LuCI homepage.
Related to 11_upgrades.js.
Fixes: f746a52979
Signed-off-by: NaOH Lin <c2h5ohf@gmail.com>
(cherry picked from commit 20fd3ca00f)
When a menu JSON describes an endpoint like
"admin/app/edit/*" : { ...
and the user navigates to
admin/app/edit/
instead of the URI which supplies an ID to edit, like
admin/app/edit/myfoobarthing
we now can use 'alias' and 'rewrite' to redirect
transparently for more generic endpoints.
Without this, it's possible to navigate to
admin/app/edit/
and the corresponding view does not receive a suitable
path/ID to derive data from, when views use anything
derived via L.env.requestpath.
This menu JSON
"admin/app/entry/*": {
"action": {
"type": "view",
"path": "app/entry"
}
},
"admin/app/entries": {
"title": "entries",
"order": 5,
"action": {
"type": "view",
"path": "app/entries"
}
},
"admin/app/entry": {
"action": {
"type": "alias",
"path": "admin/app/entries"
}
},
Produces JSON with a wildcardaction element
"entry":
{
"satisfied": true,
"wildcard": true,
"action":
{
"type": "alias",
"path": "admin/app/entries"
},
"wildcardaction":
{
"type": "view",
"path": "app/entry"
}
},
"entries":
{
"satisfied": true,
"action":
{
"type": "view",
"path": "app/entries"
},
"order": 5,
"title": "entries"
},
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit df90c60a72)
When no dhcp services are available, return null rather than an
empty container, thus suppressing display of the section altogether.
Add a title to the outer container so that the hide/show button
has something to control.
When both v4 and v6 tables are empty, display a message indicating
this rather than showing nothing below the title.
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
(cherry picked from commit 05f90a2044)
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>
(cherry picked from commit d52b59cbf0)
Do a complete overhaul of the firmware check:
When the Status -> Overview page is loaded, we check if the
configuration is set. If not, we ask the user to choose between
enabled or disabled. Once this is done, it never appears again
(much like the "set password" logic in the shell).
As a result, there is no longer a persistent section on the Overview
page with a simple toggle eating real estate and playing havoc with
the Hide/Show button scheme.
When the setting is enabled, then every time Status -> Overview
is loaded, we do the firmware check and display an alert notice
as before. But, the alert notice now contains a button to disable
the alerts, so navigation is still simple, you don't have to dig
around to figure out how to turn it off.
The logic for version comparisons was cleaned up and simplified.
Fixes: #7925Fixes: #8226
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
(cherry picked from commit 2aa6aba3bc)
This commit adds a new LuCI application for managing Tailscale on OpenWrt.
The application provides a web interface to view service status,
list network peers, and configure various Tailscale settings,
such as exit nodes, advertised routes, and daemon options.
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Signed-off-by: Tokisaki Galaxy <moebest@outlook.jp>
(cherry picked from commit 471ac6b59c)
- Parse and map ports to corresponding service names.
- Display service names when DNS lookups are enabled.
Rationale:
Enhance endpoint readability by showing service names where available,
improving clarity of source/destination information.
Signed-off-by: Konstantin Glukhov <KGlukhov@Hotmail.com>
(cherry picked from commit 62fd5284f6)
The .label.notice selector is defined in the bootstrap theme, and
used in luci-base, but is not present in the openwrt2020 theme.
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
(cherry picked from commit d074b87514)
dispatched.title is sometimes null, especially where menu JSON
does not declare a title for a page.
Also, while we're here, wrap these in i18n tags, since the
JSON titles are often translated (they're included in po matter).
Closes#8222
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
(cherry picked from commit 9fe1334fd5)
Align the hide/show buttons with the header of the section that
they control. Make the buttons as tall as the header line, very
much improving accessibility on mobile.
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
(cherry picked from commit d43fee9733)
At some point after r7, when I no longer had the dual boot device readily
available for testing, a regression was introduced that the RPCD script
would not actually perform the partition switch.
Thanks to @bd0426 for report and @Jackie264 for fixing the issue.
advanced-reboot.js
* simplify partition number validation in handleAlternativeReboot
* reformat text copy
RPCD script
* obtain OpenWrt version from "$OPENWRT_RELEASE" not "$PRETTY_NAME" for
the snapshot compatibility
* refactor parameter processing for boot_partition function
* add logging/better output on error in boot_partition
test.sh
* introduce a test file for heartbeat check of the RPCD script
Signed-off-by: Stan Grishin <stangri@melmac.ca>
(cherry picked from commit 6b271164d8)
Signed-off-by: Stan Grishin <stangri@melmac.ca>
status.js:
* update the donate anchor
* replace RPCD call with direct ubus pull of service info for faster
operation
Overview page include javascript file:
* replace RPCD call with ubus pull
RPCD script:
* remove obsolete getRuntime method
* bugfix: prevent execution of arbitrary code (thanks @iwallplace)
ACL file:
* remove obsolete getRuntime access and add access to service list
Signed-off-by: Stan Grishin <stangri@melmac.ca>
(cherry picked from commit 721ec94145)
Signed-off-by: Stan Grishin <stangri@melmac.ca>
Update call to `rpc-sys packagelist` to list all packages, not just
top-level packages, so that we can actually check if python3-libpass
and python3-bcrypt are installed.
Without this bcrypt authentication will not be made available to the
user.
Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
(cherry picked from commit aca7cc1756)
Update iphostport validation to use bracket notation for ipv6 IP
addresses. Radicale understands it, and it is the preferred notation
when using an IP address and port, together.
Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
(cherry picked from commit 637c075193)
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>
(cherry picked from commit b5cb136860)
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>
(cherry picked from commit f894913007)