summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs
AgeCommit message (Collapse)Author
2021-04-16luci-base: form.js: fix AbstractValue.textvalue() for uci list optionsJo-Philipp Wich
Serialize the uci list value into a space separated string before passing it to String.format() for HTML escaping. Without that change, empty strings were returned whenever the underlying uci get operation yieled an array. Fixes: #4993 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29luci-base: uci.js: merge changes when retrieving entire sectionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-29luci-base: ui.js: fix UICheckbox widget operation when tooltips are setJo-Philipp Wich
When a tooltip is rendered for a checkbox widget, an additional node is placed after the checkbox label element, breaking DOM selectors in bind(), isChecked(), setValue(). Apparently the functionality was never actually tested. Fixes: #4938 Fixes: e951236e3 ("luci-base: add tooltip handling") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18luci-base: network.js: recognize DSA ports and bridge VLANsJo-Philipp Wich
Use the newly introduced devtype attribute for more robust network device type detection. This also allows us to easily recognize DSA ports. Furthermore, synthesize VLAN devices declared by uci bridge-vlan sections, similar to how it is done for legacy swconfig switch_vlan ones. Finally implement a new Network.Device.getParent() method to use the newly available "parent" attribute to resolve the base device of DSA ports or VLAN devices. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-15treewide: remove rendundant proto handler optionsJo-Philipp Wich
The introduction of network device configuration support also implemented all common, protocol-independent interface options directly in the interface config view, so drop the redundant option definitions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01luci-base: validation.js: optionally support negative prefixesJo-Philipp Wich
Support negative prefix length in the `cidr`, `cidr4`, `cidr6`, `ipmask`, `ipmask4` and `ipmask6` data types when an optional truish flag is passed to the datatype name. Ref: #4812 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01luci-base: network.js: sort interface statuses by metric, then nameJo-Philipp Wich
Fixes: #4693 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01luci-base: firewall.js: manage zomne networks as listJo-Philipp Wich
Fixes: #4827 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-02-19luci-base: ui.js: resolve parent ul early in UIDropdown.toggleItem()Jo-Philipp Wich
The parent node of the current li might be null after collapsing the dropdown, so resolve the parent ul early to avoid passing null to subsequent calls. Fixes clearing custom input values in DynamicList dropdowns. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-02-10luci-base: luci.js: fix sortedKeys() orderingJo-Philipp Wich
Chrome does not properly sort arrays when the sort function returns boolean results, in contrast to Firefox which does. Fix the issue by returning a numerical result instead. Fixes: #4792 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-01-20treewide: minor fixes to typos, whitespace, and indentationGiovanni Giacobbi
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-19luci-base: luci.js: fix `LuCI.request.poll.add()` exception handlingGiovanni Giacobbi
The try/catch is meant for the `res.json()` call and should apply to that. As it was before, an exception inside the poll callback would cause the callback to be reinvoked without the JSON parameter, which is an odd behaviour. Moreover, it makes it hard to debug because it is completely hidden from the browser console. We now differentiate between exceptions thrown due to bad JSON in `responseText` from exceptions generated inside the callback itself, which are let through for browser console logging. Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-13luci-base: make tooltip icon string configurableFlorian Eckert
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-13luci-base: add tooltip handlingFlorian Eckert
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-07Merge pull request #4598 from Ansuel/wifi_chanHannu Nyman
luci-mod-status: add new channel analysis page
2020-11-27treewide: transition div tables to actual table markupJo-Philipp Wich
Modern browsers allow decomposing table markup equally well as nested div constructs, therefor migrate our <div> table markup to actual <table> tags but keep the old table/tr/th/td CSS classes for now to allow for a smooth theme transition. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-24luci-base: delay cbi-tab-active event on tab initAnsuel Smith
Delay the cbi-tab-active custom event so any eventListner attached to the tab doesn't miss the first event. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-18luci-base: generalize random color generationAnsuel Smith
Generation of pseudo random hex color from a string can be useful also for other task. Generalize it to make it available also for other purpose. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-11-07luci-base: tools.widgets.NetworkSelect: properly validate multi selectJo-Philipp Wich
Fixes: 2b99473f2 ("luci-base: tools.widget.NetworkSelect: disallow invalid network names") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-07luci-base: tools.widget.NetworkSelect: disallow invalid network namesJo-Philipp Wich
Fixes: #4523, #4573 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-10-30Merge pull request #4531 from oldium/add-widget-changedJo-Philipp Wich
luci-base: Fix using isActive in widget-change notification.
2020-10-30luci-base: Fix using isActive in widget-change notification.Oldřich Jedlička
The `onchange` notification handler is called too early to be able to evaluate other widget's `isActive()` status. Solve this by changing order of event handling - first register/execute `map.checkDepends` and then `onchange`. Fixes: openwrt/luci#4516. Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-24luci-base: Replace legend element with h3.Oldřich Jedlička
The legend HTML element is allowed only as first element in fieldset, so use h3 instead, which is rendered the same within themes. Fixes #3149. Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-10-06luci-base: network.js: Show clients also from wifi VLANs.Oldřich Jedlička
Iterate through VLANs to get the clients connected on configured wifi VLANs (as configured by `wifi-vlan` sections in `wireless` configuration). This is a minimum support for VLANs on wireless network. The VLAN name is nowhere displayed, but at least clients using VLANs are visible. Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
2020-09-23luci-base: don't append object.method to the RPC urlRafał Miłecki
It was a cosmetic feature that doesn't work anymore with the latest uhttpd ubus API. Adding RESTful API resulted in treating URL part following the /ubus/ as the new API request. Suggested-by: Rafał Miłecki <rafal@milecki.pl> Fixes: #4465 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-19luci-base: make translatable default values for dhcp hostnameAnton Kikin
We must be able to translate these values. Fixes: fd75c2b7c ("luci-base: add default value options dhcp hostname") Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-09-16luci-base: add default value options dhcp hostnameFlorian Eckert
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-09-16luci-base: dhcp.js: allow hostname to be "*"Jo-Philipp Wich
Fixes: #4430 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-09-15luci-base: use actual JSON-RPC for verifying ubus RPC URLRafał Miłecki
Sending GET request to the main RPC base URL and expecting HTTP response code 400 had two flaws: 1. It was not verifying actual JSON-RPC interface availability 2. It did not allow implementing support for new requests Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
2020-08-06luci-base: form.js: implement AbstractSection.getOption() helperJo-Philipp Wich
The `getOption()` function allows to easily obtain a reference to another option object instance within the same section. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-06luci-base: ui.js: implement AbstractElement.isChanged()Jo-Philipp Wich
The new `isChanged()` utility functions allows to query the dirty state of an ui input widget. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05luci-base: network.js: recognize uci declared network devicesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05luci-base: form.js: add cfgvalue(), formvalue() and getUIElement() helpersJo-Philipp Wich
This commit introduces new per-section cfgvalue(), formvalue() and getUIElement() helper functions which complement the respective per-option functions. Their intent is to simplify querying input data or obtaining UI widget instances from other options within the same section. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05luci-base: form.js: add AbstractValue.onchange propertyJo-Philipp Wich
Introduce a new, widget agnostic onchange property which allows setting custom handler functions to react on element value changes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05luci-base: form.js: add ability to specify regular expression dependenciesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05luci-base: ui.js: implement AbstractElement.setPlaceholder()Jo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
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-07-28luci-base: form.js: add CSS class to invalid option dismiss buttonJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-07-28luci-base: form.js: don't destroy modal form on invalid values when savingJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-07-24luci-base: fix widgets CBIUserSelect appending list on loadHelge Mader
The user list was appended to the dropdown again each time the page is loaded. Signed-off-by: Helge Mader <ma@dev.tdt.de>
2020-07-05luci-base: ui.js: order menu entries with the same weight by nameJo-Philipp Wich
The previous server side menu rendering ordered items first by their order weight value, then by their internal name. Do the same for client side menu rendering. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-06-14luci-base: form.js: fix handling of array sections in JSONMap formsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-29luci-base: luci.js: properly skip comments when finding require tokensJo-Philipp Wich
Fixes: #4020, #4022, #4111 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-24luci-base: firewall.js: remove further zone network/name fallback logicJo-Philipp Wich
Fixes: #4093 Fixes: 4052436d8 ("luci-base: firewall.js: don't treat zone name as network fallback") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-24luci-base: ui.js: fix function declaration in nested statementAnton Kikin
Fix "SyntaxError: Strict mode does not allow function declarations in a lexically nested statement" error that may occur in some old browsers (detected on QtWebKit 5.212). Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-05-19Merge pull request #4053 from TDT-AG/pr/20200515-luci-baseFlorian Eckert
luci-base: fix host validation function
2020-05-19luci-base: fix host validation functionFlorian Eckert
Allow only ipv4 or ipv6 addresses without IP mask. A host IP with mask does not make sense in this context. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-05-17luci-base: validation.js: count byte- instead of character length of stringsJo-Philipp Wich
Fixes: #4055 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-07luci-base: optimize some PNG filesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-07luci-base: move old cbi icons to luci-compatJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>