Commit graph

96 commits

Author SHA1 Message Date
Jo-Philipp Wich
733ee9a7b6 luci-base: ui.js: warn about connectivity loss on changing iface settings
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>
2022-05-16 13:35:18 +02:00
Jo-Philipp Wich
8583efb5a9 luci-base: ui.js: make "Apply unchecked" available from the changes dialog
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>
2022-05-06 13:42:55 +02:00
Jo-Philipp Wich
b6797821b8 luci-base: ui.js: gracefully handle failing confirm calls on rollback
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>
2022-05-06 13:42:54 +02:00
Jo-Philipp Wich
180d39dcd2 luci-base: ui: resolve aliases and rewrites on obtaining menu node children
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>
2022-04-28 16:06:25 +02:00
Jo-Philipp Wich
d29400ea09 luci-base: ui: fix null access in ui.Table.update()
Fixes: #5702
Fixes: e0e6989a4a ("luci-base: introduce new LuCI.ui.Table class")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-02-27 20:33:02 +01:00
Jo-Philipp Wich
e0e6989a4a luci-base: introduce new LuCI.ui.Table class
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>
2022-02-24 23:45:17 +01:00
Jo-Philipp Wich
604c009059 luci-base: ui.js: avoid error tooltips overlapping dropdowns
Fixes: #5588
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-12-09 15:29:36 +01:00
Lukas Voegl
735d949bfc luci-base: show validation message in error
Signed-off-by: Lukas Voegl <lvoegl@tdt.de>
2021-10-26 12:31:05 +02:00
Jo-Philipp Wich
e4d24f07c9 luci-base: dispatcher: rework dispatching and menu filtering logic
- 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>
2021-10-11 20:38:04 +02:00
Jo-Philipp Wich
e3bf521edb luci-base: ui.js: determine dropdown position relative to overflow parent
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-09 21:55:43 +02:00
Sven Roederer
ddf6357cda luci-base: change button-text from Dismiss to Close in UCI changes overview
Change the left button of the UCI Apply-changes overview to the more correct function close.
This also avoids confusion between Dismiss and Revert, which translate to the same in german.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-05-04 00:09:11 +02:00
Jo-Philipp Wich
95b5c6cd64 luci-base: ui.js: fix UICheckbox widget operation when tooltips are set
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-29 11:24:59 +02:00
Jo-Philipp Wich
b8d2bcd432 luci-base: ui.js: resolve parent ul early in UIDropdown.toggleItem()
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-19 10:41:00 +01:00
Florian Eckert
df2a135a08 luci-base: make tooltip icon string configurable
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-13 12:29:02 +01:00
Florian Eckert
e951236e36 luci-base: add tooltip handling
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2021-01-13 11:59:02 +01:00
Ansuel Smith
84ba852993
luci-base: delay cbi-tab-active event on tab init
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-24 02:36:50 +01:00
Jo-Philipp Wich
18eddc9624 luci-base: ui.js: implement AbstractElement.isChanged()
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-06 17:56:34 +02:00
Jo-Philipp Wich
f2965b759a luci-base: ui.js: implement AbstractElement.setPlaceholder()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-08-05 13:51:16 +02:00
Jo-Philipp Wich
0c479891ae luci-base: ui.js: order menu entries with the same weight by name
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-07-05 00:11:59 +02:00
Anton Kikin
c00d0d9473 luci-base: ui.js: fix function declaration in nested statement
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-24 02:12:20 +03:00
Jo-Philipp Wich
b34b7fc504 luci-base: replace filebrowser icons with SVG variants
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-07 19:39:32 +02:00
Jo-Philipp Wich
915e446c07 luci-base: ui.js: fix UITextfield.setValue()
Fixes: d02c26772 ("luci-base: ui.js: rework password input handling")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-04 21:31:38 +02:00
Jo-Philipp Wich
4df3a90b3d luci-base: ui.js: reset scroll position when opening modal overlay
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-02 23:53:03 +02:00
Jo-Philipp Wich
e3ef463ccd luci-base: ui.js: fix input value reading for select widgets
Fixes: #3989
Fixes: 81effc111 ("luci-base: ui.js: assume select widget by default for ListValue widget")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-02 23:53:03 +02:00
Jo-Philipp Wich
d02c26772b luci-base: ui.js: rework password input handling
- Get rid of dummy element
 - Render password field as text input initially and later transform
   it to a password field
 - Use .control-group markup to allow better styling

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-02 23:53:02 +02:00
Jo-Philipp Wich
81effc1112 luci-base: ui.js: assume select widget by default for ListValue widget
Fixes: #3973
Fixes: 2fb55e1ab ("luci-base: ui.js: fixes for radio widget type of select element")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 15:37:02 +02:00
Jo-Philipp Wich
2fb55e1ab5 luci-base: ui.js: fixes for radio widget type of select element
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 09:48:34 +02:00
Jo-Philipp Wich
acae1378a8 luci-base: ui.js: fix textarea width
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-20 09:44:14 +02:00
Jo-Philipp Wich
7882f3ebdd luci-base: ui.js: hide unsatisfied firstchild menu nodes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-18 23:25:22 +02:00
Jo-Philipp Wich
01d8283ece luci-base: ui.js: order indicators by ID value
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-17 09:30:54 +02:00
Jo-Philipp Wich
90a51ab3b9 luci-base: ui.js: add LuCI.ui.menu.flushCache() function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 15:13:26 +02:00
Jo-Philipp Wich
46d31efc73 luci-base: ui.js: apply disabled attribute to toplevel dynlist node
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
930f28b606 luci-base: ui.js: add LuCI.ui.menu helper class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
51186355ea luci-base: ui.js: use session data api to persist tab selection state
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
b6e93d54a0 luci-base: ui.js: use standard indicator framework to display uci changes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:10:06 +02:00
Jo-Philipp Wich
86c797041a luci-base: ui.js: add disabled property to widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:07:34 +02:00
Jo-Philipp Wich
d9e9cf92d1 luci-base: ui.js: add instantiateView() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-03 13:26:44 +02:00
Jo-Philipp Wich
711f759278 luci-base: harmonize JS class naming and requesting
- Make builtin classes available via `require` to allow view code to
   request external and internal classes in a consistent manner without
   having to know which classes are builtin and which not

 - Make base classes request any used class explicitely instead of
   relying on implicitly set up L.{dom,view,Poll,Request,Class} aliases

 - Consistently convert class names to lower case in JSdoc to match
   the names used in `require` statements

 - Deprecate L.{dom,view,Poll,Request,Class} aliases

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-02 21:51:20 +02:00
Jo-Philipp Wich
f1aa3f8f6e luci-base: ui.js: properly handle null choices in dropdown constructor
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-01 18:45:18 +02:00
Jo-Philipp Wich
4250f99d7f luci-base: ui.js: add generic indicator handling functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-31 21:31:04 +02:00
Jo-Philipp Wich
1bb2717729 luci-base: ui.js: add documentation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-31 21:31:04 +02:00
Jo-Philipp Wich
0fb2f8f1d1 luci-base: ui.js: improve mobile dropdown scroll behaviour
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-25 12:35:15 +01:00
Jo-Philipp Wich
82fb5a67d3 luci-base: form.js / ui.js: tie form labels to widgets
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 22ba6fc40933bee02c3ea93bbda952bb44bf3af1)
2020-03-24 22:14:18 +01:00
Jo-Philipp Wich
993b4f7950 luci-base: ui.js: various tweaks
- emit checkbox markup suitable for CSS styling
 - use .btn CSS class where appropriate
 - dispatch events when updating uci change indicator
 - use correct target node when handling events in createHandlerFn()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-23 21:36:59 +01:00
Jo-Philipp Wich
bf774e4c2a luci-base: ui.js: dispatch "cbi-tab-active" event when a tab is selected
This is useful to lazy-load tab contents.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-12 11:59:41 +01:00
Jo-Philipp Wich
136b965b25 luci-base: ui.js: UIFileUpload fixes
- Introduce a new option `initial_directory` which describes the initial
   directory to display when nothing is selected, default to the root
   directory

 - Prevent stray legacy cbi reloads when deselecting files

 - Fix within-root-directory-check for initial rendering

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-20 19:40:46 +01:00
Jo-Philipp Wich
cc123a03ce luci-base: ui.js: support clearChoices()/addChoices() for DynLists
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-19 16:15:22 +01:00
Jo-Philipp Wich
9733a182e8 luci-base: ui.js: use placeholder as select placeholder in DynLists
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-19 16:15:22 +01:00
Jo-Philipp Wich
4c52718dea luci-base: ui.js: properly handle rich choices in Dropdowns, DynLists
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-19 16:15:22 +01:00
Ansuel Smith
5e6ec8562f
luci-base: remove hardcoded cgi-bin path
Currently LuCI can be loaded only when placed in the root of the server as the cgi-bin path are hardcoded. Change the index.html to load the cgi-bin path from the current level.
Also add a new entry in the env Object to make the cgi_base path easily accessible.
This variable will be based on the position of /cgi-bin/luci.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-01-16 15:02:14 +01:00