From 33d6492459262336cce4b33c05564d73442b1064 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sat, 18 Oct 2025 02:57:32 +0200 Subject: [PATCH] luci-app-lldpd: improvements for IO select ES6 and implement optional property Signed-off-by: Paul Donald --- .../htdocs/luci-static/resources/lldpd.js | 22 +++++++++---------- .../resources/view/lldpd/config.js | 3 +++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/applications/luci-app-lldpd/htdocs/luci-static/resources/lldpd.js b/applications/luci-app-lldpd/htdocs/luci-static/resources/lldpd.js index 8695fc8c55..e9c638b153 100644 --- a/applications/luci-app-lldpd/htdocs/luci-static/resources/lldpd.js +++ b/applications/luci-app-lldpd/htdocs/luci-static/resources/lldpd.js @@ -183,19 +183,19 @@ const CBIMultiIOSelect = form.MultiValue.extend({ __name__: 'CBI.MultiIOSelect', renderWidget(section_id, option_index, cfgvalue) { - const value = (cfgvalue != null) ? cfgvalue : this.default ? this.default : '', - choices = this.transformChoices() ? this.transformChoices() : ''; + const value = (cfgvalue != null) ? cfgvalue : this.default ? this.default : ''; + const choices = this.transformChoices() ? this.transformChoices() : ''; const widget = new ui.Dropdown(L.toArray(value), choices, { - id: this.cbid(section_id), - sort: this.keylist, - multiple: true, - optional: true, - display_items: 5, - dropdown_items: -1, - create: true, - disabled: (this.readonly != null) ? this.readonly : this.map.readonly, - validate: L.bind(this.validate, this, section_id), + id: this.cbid(section_id), + sort: this.keylist, + multiple: this.multiple ?? true, + optional: this.optional ?? true, + display_items: this.display_items ?? 5, + dropdown_items: this.dropdown_items ?? -1, + create: this.create ?? true, + disabled: (this.readonly != null) ? this.readonly : this.map.readonly, + validate: L.bind(this.validate, this, section_id), }); return widget.render(); diff --git a/applications/luci-app-lldpd/htdocs/luci-static/resources/view/lldpd/config.js b/applications/luci-app-lldpd/htdocs/luci-static/resources/view/lldpd/config.js index 60afb11980..c96e38a82c 100644 --- a/applications/luci-app-lldpd/htdocs/luci-static/resources/view/lldpd/config.js +++ b/applications/luci-app-lldpd/htdocs/luci-static/resources/view/lldpd/config.js @@ -440,6 +440,7 @@ return L.view.extend({ 'blacklist IPv6 addresses, use !*:*.') + '
' + usage); o.placeholder = 'Addresses and interfaces'; + o.optional = true; o.depends({lldp_mgmt_addr_advertisements: '1'}); o.cfgvalue = function(section_id) { const opt = uci.get(this.config, section_id, this.option); @@ -541,6 +542,7 @@ return L.view.extend({ 'Absent any value, all interfaces are considered. ' + 'LLDPd takes the first MAC address from all the considered ' + 'interfaces to compute the chassis ID.')); + o.optional = true; o.value('*'); o.value('!*'); @@ -850,6 +852,7 @@ return L.view.extend({ ss.addbtntitle = _('Add Custom TLV', 'lldpd Custom TLV'); oo = ss.option(lldpd.CBIMultiIOSelect, 'ports', _('Network Interface(s)')); + oo.optional = true; net_devices.forEach(nd => { oo.value(nd.getName()); oo.value('!'+nd.getName()); -- 2.30.2