mirror of
https://github.com/openwrt/luci.git
synced 2026-02-04 12:06:01 +08:00
luci-base: load luci preferences early
Follow-up to 315dbfc749
In order to look at any saved uci value, the luci config
must be loaded before we render the page, so we can determine
stored preferences, for things like table filter, without
encumbering all consumers of configurable elements to load
the luci uci configuration.
All (Table) elements extend CBIAbstractElement, so load
there.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@@ -378,6 +378,7 @@ const CBIAbstractElement = baseclass.extend(/** @lends LuCI.form.AbstractElement
|
||||
const CBIMap = CBIAbstractElement.extend(/** @lends LuCI.form.Map.prototype */ {
|
||||
__init__(config, ...args) {
|
||||
this.super('__init__', args);
|
||||
uci.load('luci');
|
||||
|
||||
this.config = config;
|
||||
this.parsechain = [ config ];
|
||||
@@ -2740,7 +2741,7 @@ const CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection
|
||||
const max_cols = this.max_cols ?? this.children.length;
|
||||
const has_more = max_cols < this.children.length;
|
||||
const anon_class = (!this.anonymous || this.sectiontitle) ? 'named' : 'anonymous';
|
||||
const tableFilter = this.map.data.get('luci', 'main', 'tablefilters') || false;
|
||||
const tableFilter = uci.get('luci', 'main', 'tablefilters') || false;
|
||||
const trEls = E([]);
|
||||
|
||||
for (let i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"file": [ "list" ],
|
||||
"uci": [ "changes", "get" ]
|
||||
},
|
||||
"uci": [ "system" ]
|
||||
"uci": [ "system", "luci" ]
|
||||
},
|
||||
"write": {
|
||||
"cgi-io": [ "upload" ],
|
||||
|
||||
Reference in New Issue
Block a user