From: Paul Donald Date: Tue, 3 Feb 2026 19:30:37 +0000 (+0100) Subject: luci-base: load luci preferences early X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=01c53bec37cac7ed4878ce1c8537df667eb8c7fa;p=project%2Fluci.git luci-base: load luci preferences early Follow-up to 315dbfc7498e2f43afb0119b992915e8f311bc37 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 --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index b2f308fc51..084fa353e7 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -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++) { diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json index cc7f06b3f0..c043c05b9d 100644 --- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json +++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json @@ -19,7 +19,7 @@ "file": [ "list" ], "uci": [ "changes", "get" ] }, - "uci": [ "system" ] + "uci": [ "system", "luci" ] }, "write": { "cgi-io": [ "upload" ],