summaryrefslogtreecommitdiff
path: root/modules/luci-base/htdocs
Commit message (Collapse)AuthorAgeFilesLines
* luci-base: comment fixes (sp)Paul Donald2023-12-231-43/+43
| | | | Signed-off-by: Paul Donald <newtwen@gmail.com>
* luci-base: Use getMode in getActiveModeEvan Benn2023-12-151-1/+1
| | | | Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
* luci-base: Replace mode: Master with Access PointEvan Benn2023-12-151-1/+1
| | | | | | | | Access Point is the string used on the network wireless setup dialogue. Use Access Point to report the mode on the network wireless and status screens. Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
* luci-base: Make uci mode strings match iwinfo mode stringsEvan Benn2023-12-151-9/+14
| | | | | | | | | uci mesh was being displayed as 'Mesh', while iwinfo mesh was being reported as 'Mesh Point'. Unify those. Update getActiveModeI18n to deal with all the values iwinfo returns. Fix the incorrect 'Mash' translation. Signed-off-by: Evan Benn <evan.benn@morsemicro.com>
* luci-base: ui.js: sorting fixes for tables initialized from markupJo-Philipp Wich2023-10-191-22/+29
| | | | | | | | | - Populate id option from table id attribute - Update column head sort indicator in UITable.update() - Don't store sort state for tables without id Ref: https://github.com/openwrt/luci/issues/6640 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: Fix typos in JsDocsSergey Ponomarev2023-09-237-150/+150
| | | | | | | | | | | | | | 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>
* luci-base: network.js: simplify getWifiNetidBySidSergey Ponomarev2023-09-231-2/+2
| | | | | | Remove unused variables i and netid and reuse radioname Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
* luci-base: "an URL" replace with "a URL"Sergey Ponomarev2023-09-232-8/+8
| | | | | | This is a correct form Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
* luci-base: cbi.js cbi_validate_named_section_add() simplifySergey Ponomarev2023-09-231-6/+1
| | | | | | Reduce if to a simple boolean evaluation Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
* luci-base: grammar fixesPaul Dee2023-08-111-1/+1
| | | | | | | | Login (n) -> Log (v) in Logout (n) -> Log (v) out Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
* luci-base: ui.js: set `autocomplete="new-password"` for password fieldsJo-Philipp Wich2023-06-071-0/+1
| | | | | | | | Attempt to prevent Firefox from randomly filling nonesense into arbitrary password fields such as the WireGuard private key field by setting the `autocomplete="new-password"` attribute on any password type fields. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: ui.js: make upload cancellation message translatableJo-Philipp Wich2023-04-281-1/+1
| | | | | | | Resync base translation templates as well. Fixes: #6364 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: validation.js: fix xgettext quirkJo-Philipp Wich2023-04-031-1/+1
| | | | | | | | | The xgettext utility does not properly discard `/` inside regex character classes, causing a false positive unterminated string error. Avoid the issue by explicitly escaping the embedded slash. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-mod-network: add stricter wireless interface name validationGlenn Washburn2023-03-151-0/+9
| | | | | | | | | | | | | | | | Linux wireless interface names have the following restrictions: * It must not be an empty string * It must not be '.' or '..' * It must not contain any /, : or space character ( , \t, \n, ...) * It must be less than 16 chars * It likely must not contain any % either Fixes: 8673aef8db ("luci-mod-network: remove uciname validation from wireless interface") Signed-off-by: Glenn Washburn <development@efficientek.com> [reword validation error messages, remove extended description text as it would be shown as part of the validation errors] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "luci-proto-openconnect: fix server url validation"Jo-Philipp Wich2023-02-081-4/+1
| | | | | | | | This reverts commit f1312cadc6675fb29d02425775dd8a2a533d7e7c. The commit contained unrelated changes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Merge pull request #6104 from dhewg/6gJo-Philipp Wich2023-02-071-2/+3
|\ | | | | luci-mod-network: enable configuring wifi ax networks on the 6G band
| * luci-base: use "hwmodes_text" to describe wireless radiosAndre Heider2023-01-231-2/+3
| | | | | | | | | | | | This is a preformatted string like "ac/ax/b/g/n" for presentation. Signed-off-by: Andre Heider <a.heider@gmail.com>
* | luci-proto-openconnect: fix server url validationJo-Philipp Wich2023-02-071-1/+4
| | | | | | | | | | | | | | | | The OpenConnect configuration form incorrectly assumed that the server setting must be hostname while it actually may be a full URL. Fixes: #6184 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* | luci-base: ui.js: modal dialog tweaksJo-Philipp Wich2023-02-051-2/+23
| | | | | | | | | | | | | | | | - Automatically focus modal dialog frame - Close modal dialog on pressing escape key Fixes: #4609, #6205 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* | luci-base: ui.js: improve ui.Dropdown event handlingJo-Philipp Wich2023-02-051-18/+41
| | | | | | | | | | | | | | | | Improve overall event and focus handling, avoid registering a global mouseover event listener, stop propagating escape keypress on closing dropdown and avoid `Element.blur()` to prevent de-focusing open modals. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* | luci-base: form.js: reuse JSONMap data provider in GridSection modalsJo-Philipp Wich2023-02-041-3/+6
| | | | | | | | | | | | | | | | | | Reuse the same data provider as the parent JSONMap instance in order to avoid inadvertently mangling the form data when saving the modal edit dialog. Fixes: bb9ede238a ("luci-base: form.js: reuse JSONMap data provider in GridSection modals") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* | luci-base: form.js: fix GridSection modals in JSONMap instancesJo-Philipp Wich2023-02-041-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Since grid section edit modals construct a new Map instance internally, we must take care of using the correct map constructor type for the internal copy in order to end up with the correct data provider. Ensure that the extended option modal of GridSection instances uses a JSONMap when the grid section's owner map is a JSONMap to avoid stray uci related errors. Ref: https://forum.openwrt.org/t/luci-save-apply/149658/5 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* | luci-base: help-text spell fixPaul Dee2023-01-171-1/+1
|/ | | | Signed-off-by: Paul Dee <itsascambutmailmeanyway@gmail.com>
* luci-base: ui.js: support div based table markup in UITable.update()Jo-Philipp Wich2022-12-271-7/+9
| | | | | | | | | | | | | Constructing UITable instances from existing, div based markup is supported but the UITable.update() implementation did not account for that, leading to defunct data updates on tables built from div based markup. Fix this issue by extending UITable.update() to consider a div based table structure as well, like we do in UITable.initFromMarkup() already. Fixes: #5713 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: fix button handling for named sectionsFlorian Eckert2022-12-131-1/+1
| | | | | | | | | | If more than one named section is added to the page, it is currently the case, that the first button is always switched on or off during input validation of the uci section name. This is because the usage of the 'document.querySelector' function is to imprecise. Changing the search start to the element to be created, fixes this. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* luci-base: ui.js: table enhancementsJo-Philipp Wich2022-11-221-4/+11
| | | | | | | | | - Gracefully handle cells without innerText - Properly handle `DocumentFragment` call values on table update - Introduce ability to fetch actual cell value for sorting purposes from `data-value` attribute Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: cbi.js: await L.ui load before updating tablesJo-Philipp Wich2022-11-091-1/+3
| | | | | | | | On legacy views, the `L.ui` JavaScript class is not automatically loaded, so request it before updating tables. Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* treewide: separate Lua runtime resourcesJo-Philipp Wich2022-10-251-5/+41
| | | | | | | | | | | 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>
* luci-base: revise array sortingJo-Philipp Wich2022-07-274-66/+25
| | | | | | | | | | | | | 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>
* luci-base: luci.js: add array sort utilitiesJo-Philipp Wich2022-07-271-6/+45
| | | | | | | | 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>
* luci-base: uci.js: prevent sending empty uci set operationsJo-Philipp Wich2022-07-231-12/+15
| | | | | | | | | | | | 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>
* luci-base: form.js: fix removing just created named GridSectionJo-Philipp Wich2022-07-221-7/+6
| | | | | | | | | | | | | | | | | | 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>
* luci-base: optimized icons filesizesy042022-06-2522-0/+0
| | | | | Optimized PNG filesize without any quality loss. Signed-off-by: Alexander Semukhin <semukhin@mail.com>
* luci-base: network.js: consider uci config for Device.getType()/getParent()Jo-Philipp Wich2022-06-161-1/+20
| | | | | | | | | | | | | | | | 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>
* luci-base: ui.js: add required CSS class to dynlist widgetJo-Philipp Wich2022-05-171-2/+2
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: form.js: minor tweaks for mobile stylingJo-Philipp Wich2022-05-171-3/+7
| | | | | | | - Annotate gridsection textvalue cells as CBI.DummyValue widgets - Replace `<br>` elements with newlines in `stripTags()` Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: form.js: trim option descriptionJo-Philipp Wich2022-05-161-1/+1
| | | | | | | | | | 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>
* luci-base: luci.js: remove wrong CSS class from page footerJo-Philipp Wich2022-05-161-1/+1
| | | | | | | 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>
* luci-base: form.js: remove stray `<br>` elements from section placeholderJo-Philipp Wich2022-05-161-4/+1
| | | | | | Theme CSS styles shoudl take care of introducing padding as needed. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: form.js: save parent map on opening nested modal mapJo-Philipp Wich2022-05-161-47/+54
| | | | | | | | | 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>
* luci-base: form.js: handle SectionValue objects in GridSection modalsJo-Philipp Wich2022-05-161-22/+52
| | | | | | | | | 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>
* luci-base: form.js: reset parent maps on returning from nested section modalJo-Philipp Wich2022-05-161-3/+13
| | | | | | | | 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>
* luci-base: form.js: allow overriding section placeholder of TableSectionsJo-Philipp Wich2022-05-161-2/+1
| | | | | | | | 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>
* luci-base: ui.js: warn about connectivity loss on changing iface settingsJo-Philipp Wich2022-05-161-27/+77
| | | | | | | | | | 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>
* luci-base: ui.js: make "Apply unchecked" available from the changes dialogJo-Philipp Wich2022-05-061-4/+10
| | | | | | | 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>
* luci-base: ui.js: gracefully handle failing confirm calls on rollbackJo-Philipp Wich2022-05-061-1/+1
| | | | | | | | | | 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>
* luci-base: form.js: rework stacked modal CBI map logicJo-Philipp Wich2022-05-061-7/+12
| | | | | | | | 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>
* luci-base: ui: resolve aliases and rewrites on obtaining menu node childrenJo-Philipp Wich2022-04-281-1/+18
| | | | | | | | 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>
* luci-base: ui: fix null access in ui.Table.update()Jo-Philipp Wich2022-02-271-1/+1
| | | | | | Fixes: #5702 Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* luci-base: form.js: add column sorting to TableSections and GridSectionsJo-Philipp Wich2022-02-241-2/+66
| | | | | | | Add ability to reorder TableSection and GridSection rows by clicking on column headers. Signed-off-by: Jo-Philipp Wich <jo@mein.io>