Commit graph

438 commits

Author SHA1 Message Date
Jo-Philipp Wich
428e3bd6dc luci-base: form.js: toggle inactive CSS class on unsatisfied field cells
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 09:51:54 +02:00
Jo-Philipp Wich
daa318c1b2 luci-base: form.js: ListValue: support widget and orientation properties
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 09:50:28 +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
17ffc84a29 luci-base: form.js: allow secondary configs to fail loading
Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 09:47:08 +02:00
Jo-Philipp Wich
a8d85ed71a luci-base: firewall.js: gracefully handle missing uci configuration
Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-28 09:47:08 +02:00
Jo-Philipp Wich
551d839f90 luci-base: luci.js: add LuCI.session.getToken()
Since we're already have LuCI.session.getID() we should mirror the same
interface for retrieving the session token.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-26 18:45:58 +02:00
Jo-Philipp Wich
49c6a810e9 luci-base: uci.js: fix section deletion logic
- Process deletions before additions or changes, allowing user code to
   remove and recreate a section with the same name.

 - Only record section deletions when the section to be removed actually
   existed in the original config or when it was staged for creation
   earlier. This avoids stray ubus not found exception when saving.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-26 18:45:58 +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
Anton Kikin
7585e5c95a luci-base: form.js: allow to disable descriptions row in TableSection
Add 'nodescriptions' property to the TableSection class that allows
to disable displaying table header row with descriptions.

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-04-19 13:56:24 +03:00
Anton Kikin
da0e974db5 luci-base: form.js: fix TableSection descriptions row rendering
In some cases, a table cell at actions column of a descriptions row
may not be rendered. For example, this happens for GridSection when
sorting is disabled:

    s = m.section(form.GridSection, 'section_type');
    s.sortable = false;

Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-04-19 13:56:24 +03: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
616d2a61e4 luci-base: luci.js: get rid of global L references in internal classes
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
adeb0f3aa6 luci-base: luci.js: disable page action buttons on readonly views
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
b739fc17ea luci-base: luci.js: add hasViewPermission() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
06af541c37 luci-base: luci.js: fix JSdoc markup issues
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
b0c8221926 luci-base: luci.js: convert various probe* functions to session data api
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
ef718246b1 luci-base: luci.js: add LuCI.session class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
e385640505 luci-base: luci.js: share environment object among LuCI base classes
This allows us to get rid of global `L` references in luci.js itself.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 10:49:05 +02:00
Jo-Philipp Wich
0e22d4d87e luci-base: network.js: don't fail loading network config on missing wireless
Fixes: #3914
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-15 09:29:29 +02:00
Jo-Philipp Wich
b9dda90716 Revert "build: luci.mk: gracefully handle missing or unversioned po subdirectories"
This reverts commit e6f77d5d72.
Commit contained unrelated changes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 18:42:36 +02:00
Jo-Philipp Wich
e6f77d5d72 build: luci.mk: gracefully handle missing or unversioned po subdirectories
Fixes: #3911
Fixes: 9d8e99f9b build: gracefully handle non-Git source trees
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 18:29:13 +02:00
Jo-Philipp Wich
5c22340f43 luci-base: form.js: make map readonly on insufficient uci permissions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:13:19 +02:00
Jo-Philipp Wich
c89fd0a7f3 luci-base: tools/widgets.js: honour map readonly property too
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:12:47 +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
0f8e5b2536 luci-base: tools/widgets.js: honour readonly property
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:09:12 +02:00
Jo-Philipp Wich
9279448148 luci-base: form.js: implement readonly property for forms and options
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:08:36 +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
68b2ce84ec luci-base: luci.js: use standard indicator framework for poll status
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-14 17:06:34 +02:00
Jo-Philipp Wich
6ae1cd8fdb luci-base: uci.js: do not issue malformed uci/delete requests
Fixes: #3912
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ec3a202b69b5bf5785c0785b2ac39efbe5cae2b7)
2020-04-14 17:03:43 +02:00
Jo-Philipp Wich
55cb5a753b luci-base: uci.js: fix variable clash
Don't overwrite the `r` variable which is supposed to refer to the reordered
uci sections with temporary data for collecting uci add parameters.

Fixes stray uci/get permission errors caused by an attempt to load
nonsensical uci package names.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-13 12:22:13 +02:00
Jo-Philipp Wich
0d0ad80fd1 luci-base: luci.js: add ability to add "preload" classes
Extend the LuCI bootstrap procedure to scan for class files in
/www/luci-static/preload/. Any JavaScript file found there will be
required automatically before setting up the view, allowing to stage
code that should run on every page load.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-12 23:55:36 +02:00
Jo-Philipp Wich
fde144c9be luci-base: luci.js: add LuCI.fspath() helper
The LuCI.fspath() function allows constructing absolute filesystem paths
from path segments relative to the document root.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-12 22:51:28 +02:00
Jo-Philipp Wich
65d673f467 luci-base: network.js: gracefully handle missing wireless config
Ref: https://github.com/openwrt/luci/issues/3895
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-11 21:26:16 +02:00
Jo-Philipp Wich
65d28a4ac9 luci-base: uci.js: let internal RPC functions reject on errors
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10 22:52:52 +02:00
Jo-Philipp Wich
bd713f870a luci-base: rpc.js: add ability to reject nonzero ubus statuses
Add a new declare option `reject` which makes the generated RPC call
function reject with an error in case the remote ubus call returned
a non-zero status.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10 22:50:41 +02:00
Jo-Philipp Wich
2dfcca23e4 luci-base: form.js: improve save error handling
Fixes: #3552
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10 20:38:58 +02:00
Jo-Philipp Wich
e331e32b2c
Merge pull request #3749 from Ansuel/fix_relayd
luci-base: fix error 404 on missing relay protocol
2020-04-08 09:15:38 +02:00
Jo-Philipp Wich
698c8ff843 luci-base: form.js: add documentation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-07 16:35:15 +02:00
Jo-Philipp Wich
249b5bb8c6 luci-base: reintroduce accidentally lost isCreateable() function
Fixes: FS#2976
Fixes: 711f75927 ("luci-base: harmonize JS class naming and requesting")
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2976
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-06 20:49:44 +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
a63cea83bd luci-base: network.js: fix JSDoc syntax error
Fixes: 506dc5a90 ("luci-base: extended network.js for check if new interface is createable")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-30 17:36:29 +02:00
Jo-Philipp Wich
4c55e8226d luci-base: firewall.js: fix Firewall.removeZone()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-26 19:12:38 +01: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
5d8970d76c form.js: use CSS .btn class for drag handles
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-23 21:47:35 +01:00
Jo-Philipp Wich
7c3b3018b3 luci-base: luci.js: tweak CSS classes
- use .btn CSS class for Save & Apply button
 - use .control-group CSS class for page action buttons

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-23 21:41:16 +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
Ansuel Smith
3d70d3e5d7
luci-base: fix error 404 on missing relay protocol
Currently relay.js is included in any case even if
the router doesn't have the needed package to use it.
Fix this by checking if the system has this feature.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-03-12 16:46:53 +01:00
Jo-Philipp Wich
fc94ff1881
Merge pull request #3712 from TDT-AG/pr/20200303-luci-base
luci-base: extended network.js for check if new interface is createable
2020-03-04 20:26:57 +01:00
Jo-Philipp Wich
d5f30d335f luci-base: network.js: gracefully handle deleteConfiguration() rejects
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-03 21:30:32 +01:00
Jo-Philipp Wich
a22aba2fed luci-base: network.js: add Protocol.deleteConfiguration() callback
Add a new Protocol.deleteConfiguration() callback function which can be
overridden by protocol handler to perform additional cleanup tasks, such
as unsetting related uci entries which are not part of the interface
configuration itself.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-03 21:22:44 +01:00
Helge Mader
506dc5a903 luci-base: extended network.js for check if new interface is createable
Signed-off-by: Helge Mader <ma@dev.tdt.de>
2020-03-03 13:53:09 +01:00
Jo-Philipp Wich
4052436d82 luci-base: firewall.js: don't treat zone name as network fallback
Drop obsolete extra logic which treats the zone name as covered network
name in case the network list is unset. This behaviour applied to the
pre-fw3 uci firewall, but is not supported since fw3 anymore.

Ref: https://forum.openwrt.org/t/luci-zone-creation-bug/55921
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-02 10:10:27 +01:00
Jo-Philipp Wich
9ae1f47896 luci-base: cbi.js: avoid double-initialization of dropdowns
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-14 08:43:28 +01:00
Jo-Philipp Wich
5258080ce3 luci-base: cbi.js: handle translation contexts in _()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-14 08:42:04 +01:00
Jo-Philipp Wich
308215ca15 luci-base: luci.js: L.dom.data(): gracefully handle non-node argument
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-14 08:40:15 +01:00
Jo-Philipp Wich
c1aeb300f6 luci-base: form.js: pass section_id to Button onclick handler
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-13 19:26:33 +01:00
Jo-Philipp Wich
311bcd4b5c luci-base: form.js: ButtonValue: pass sid as first onclick argument
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-13 19:26:33 +01:00
Jo-Philipp Wich
dc60aaeb77 luci-base: fs.js: exec_direct(): add ability to encode command as latin1
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-12 11:59:41 +01:00
Jo-Philipp Wich
9bb78b5cd8 luci-base: form.js: rendering fixes for grid sections
- Ensure that last header cell is rendered for grid sections without
   sorting or addremove actions
 - Don't skip header cells for optional options

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-12 11:59:41 +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
187bef9f6c luci-base: validation.js: fix integer and float type validation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-31 17:26:57 +01:00
Jo-Philipp Wich
da4b0f0483 luci-base: fs.js: support Blob/JSON in read_direct() and exec_direct()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-30 11:58:15 +01:00
Jo-Philipp Wich
478ed0d886 luci-base: luci.js: allow overriding response type for requests
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-30 11:45:46 +01:00
Jo-Philipp Wich
b60b4790d1 luci-base: add L.media() URL construction helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-28 11:14:42 +01:00
Jo-Philipp Wich
894752610d luci-base: cbi.js: support plural translations and disambiguation contexts
- Implement `N_(count, "String singular", "String plural" [, "Context"])`
   plural translation function.

 - Extend `_()` to optionally accept a second disambiguation context
   argument.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-22 22:02:24 +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
601c4ee01e luci-base: form.js: add a new "contains" dependency mode
By tagging option dependencies with `!contains`, dependencies are
considered satisfied when the value is contained in the value of
a related field, instead of being equal to it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-19 16:15:22 +01:00
Jo-Philipp Wich
4670099a20 luci-base: form.js: don't stringify node arguments in CBIValue.value()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-19 16:15:22 +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
Jo-Philipp Wich
aca2c4ba4e luci-base: cbi.js: collapse whitespace before language string hashing
To mirror the behavior of the Lua runtime, we need to collapse whitepace
in translation source strings before doing the string table lookup.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-16 18:17:09 +01:00
Jo-Philipp Wich
b65588ebc6
Merge pull request #3511 from Ansuel/no-hard
luci-base: remove hardcoded cgi-bin path
2020-01-16 15:36:05 +01:00
Ansuel Smith
529bde4408
luci-base: make rpc webserver path configurable
Currently the ubus path that provide the webserver is hardcoded to be /ubus.
Change this to make it configurable from the luci config file.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-01-16 15:16:09 +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
77c2998f32 luci-base: form.js: fix immediate validation of activated options
When form options are activated because their dependencies are satisified,
ensure that an immediate validation is triggered to highlight potential
errors without having the user to activate another form control first.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-15 18:52:16 +01:00
Jo-Philipp Wich
9e25917432 luci-base: form.js: implement AbstractValue.getUIElement()
Introduce a new method `getUIElement()` which simplifies obtaining the
underlying per-section UI widget class instance for a from option object.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 14:51:40 +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
e884b63916 luci-base: fs.js: properly escape arguments in exec_direct()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-18 21:22:06 +01:00
Jo-Philipp Wich
f3724e46a5 luci-base: fs.js: add read_direct() and exec_direct() functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-18 21:10:15 +01:00
Balázs Úr
d0bc86bcc3 luci-base: fix typos
Signed-off-by: Balázs Úr <balazs@urbalazs.hu>
2019-12-17 11:41:00 +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
Jo-Philipp Wich
4a08fdd2d3 luci-base: luci.js: further nested Class.super() call fixes
Use stacks keyed by class id + symbol internally to not clobber the
prototype scope pointer when repeatedly calling super() in invoked
methods.

Ref: https://github.com/openwrt/luci/issues/3316#issuecomment-558531111
Fixes: 374c23cda ("luci-base: luci.js: properly handle nested Class.super() calls")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-26 11:39:14 +01:00
Jo-Philipp Wich
374c23cdab luci-base: luci.js: properly handle nested Class.super() calls
Introduce a unique __id__ attribute per class and use that, together with
the symbol name being looked up to, to form a unique key which is used to
store the prototype scope pointer.

This fixes cases where a call to super() invokes a procedure which is
calling super() as well on a different class or symbol.

Fixes: #3316
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-26 09:37:27 +01:00
Jo-Philipp Wich
4f0d67a289 luci-base: validation.js: fix "unique" validator
Previous refactoring renamed the "data-type" attribute of widget markup
containers to "data-widget", breaking the "unique" validator as it relies
on it to lookup options.

Fixes: #3341
Fixes: 13e9e3e9e ("treewide: fix "Unhandled token" errors with Lua CBI maps")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-22 08:42:58 +01:00
Jo-Philipp Wich
13e9e3e9e8 treewide: fix "Unhandled token" errors with Lua CBI maps
The `data-type` attribute is used to bind datatype validators to a widget
while some templates used the same attribute to denote the name of the
underlying widget.

Change the `data-type` attributes referring to the widget name to
`data-widget` in order to stop the JS token error spam.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-16 18:25:52 +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