Commit graph

75 commits

Author SHA1 Message Date
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
Jo-Philipp Wich
b0836b037e luci-base: ui.js: implement UIDropdown.{add,clear}Choices()
The new `addChoices()` and `clearChoices()` functions allow clearing and
adding new options to existing dropdown instances respectively.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 14:51:40 +01:00
Jo-Philipp Wich
0d0a3f4d0d luci-base: ui.js: expose UIElement class as AbstractElement
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 14:51:40 +01:00
Jo-Philipp Wich
90a161018c luci-base: ui.js: allow custom validation in Dropdown and DynamicList
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 17:46:01 +01:00
Jo-Philipp Wich
71d370a964 luci-base: ui.js: ensure that select choice labels are properly escaped
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-04 18:06:58 +01:00
Jo-Philipp Wich
ee36066947 luci-base: ui.js: properly escape dynlist items for rendering
Ref: https://forum.openwrt.org/t/luci-theme-openwrt-reports-error/49736
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-04 16:09:23 +01:00
Kevin Darbyshire-Bryant
9b266d11c6 luci-base: Improve change application message
As a native English speaker the luci message displayed when clicking
'Save & Apply' has a somewhat uncomfortable English phrasing of "Waiting
for configuration to get applied".  It could be improved by replacing
'get' with 'be' but once you've got that far you might as well replace
this with the shorter & simpler "Applying configuration changes".  This
is also technically more correct since luci/openwrt should only be
updating/restarting processes that are related to the changed areas, not
changing the entire configuration.

As a result of that, change both the 'success' and 'rolled back'
messages to "Configuration changes have been applied" & "Configuration
changes have been rolled back"

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2019-11-15 14:29:57 +00:00
Jo-Philipp Wich
4cc7772ed5 luci-base: ui.js: show filename after selecting upload file
Fixes: #3286
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-10 19:45:58 +01:00
Jo-Philipp Wich
97a3bef84b luci-base: ui.js: add ComboButton widget
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-10 18:20:39 +01:00
Jo-Philipp Wich
33346dadf4 luci-base, luci-mod-system: move file upload handling to ui.js
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00
Jo-Philipp Wich
2b7ca79118 luci-base: ui.js: prevent race condition in tab initialization
Fixes: #3150
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-22 15:51:51 +02:00
Jo-Philipp Wich
f3ef2ca2eb luci-base: ui.js: add pingDevice() and awaitReconnect() functions
Import these functions from the flash.js for use with other views that
might trigger a device reboot.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:39 +02:00
Jo-Philipp Wich
df8078d542 luci-base: ui.js: use common fs.js class for filebrowser operations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-10-07 11:53:39 +02:00
Jo-Philipp Wich
4dfa657f77 luci-base: ui.js: mark user-changed widgets
Set a `data-changed=true` attribute on the widget element when the user
did any change to the default value.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-19 15:39:46 +02:00
Jo-Philipp Wich
934fa275b2 luci-base: ensure that button labels are properly html escaped
Fixes: #3067
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-18 13:51:16 +02:00
Jo-Philipp Wich
94a9f600d3 luci-base: ui.js: implement addNotification() helper
The L.ui.addNotification() function pushes a dismissable banner message to
the top of the view.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-11 09:22:13 +02:00
Jo-Philipp Wich
3f93650901 luci-base: use cgi-io and rpcd-mod-file to handle file upload and browsing
Remove the old server side support for file browsing and file uploading
and switch to a client side widget instead which uses XMLHTTPRequests to
upload files via cgi-io and RPC calls for file listing and status queries.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
d905dacf97 luci-base: ui.js: update tabs after initial render
This ensures that the error badges are properly set.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
b0dde567ca luci-base: ui.js: also handle failed promises in createHandlerFn()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
3500562d5e luci-base: ui.js: ignore description when checking for empty tab panes
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-10 15:28:16 +02:00
Jo-Philipp Wich
afd361e368 luci-base: ui.js: implement Textarea widget
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-19 15:04:16 +02:00
Jo-Philipp Wich
7179d2e6dd luci-base: ui.js: add createHandlerFn() helper
The createHandlerFn() helper function is useful to construct onclick
or similar event handling functions. It will add a "spinning" CSS
class on the event target element and disable the element, wrap the
given function with Promise.resolv() and re-enable the target element
once the promise is settled.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-14 22:58:15 +02:00