I have been looking through the source for a number of modules in the luci repo and read through the API docs as well. I get the impression that a single form.Map can only have a single config file that it looks at. As such, each page in the luci UI can only edit the config of a single config file. This seems very limiting, so I am wondering if I am just missing something.
If there is a good pattern for modifying multiple config files with a single page in luci, where would be a good example of that. Like, can I add two form.Maps to the same page, for example?
UPDATE: Look like there are examples of pages with multiples forms, but I don't really understand how they are being rendered onto the same page yet. Are there any good examples that are relatively straightforward to understand? Also, where the renderRowActions defined? I don't see that in the docs at all?
Hi, welcome to the forum.
disclaimer: I haven't done this in JS yet, but I suspect it's similar to what was done in lua in previous branches.
I think a good example could be: modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js
The way it's done is by:
- using chain() to load more configuration
- handling the changes to these files explicitly (see the
modules/luci-base/htdocs/luci-static/resources/form.js seems to be where it's at for renderRowActions() unless you write your own (in the example above, you can find one at line 808 in wireless.js)
.ucioption properties per option to tie the widgets to different underlying UCI values.
Another option, which is also commonly used in legacy Lua code is to override the
.remove() methods of options to read and write different underlying UCI values.
renderRowActions() function is an internal method inherited from the
TableSection class. It can be overridden to render a nonstandard set of action buttons per row. I did not yet document it officially.