From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 5667D1FF0B4 for ; Fri, 27 Nov 2026 18:58:55 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id AFA0B21759; Fri, 27 Nov 2026 18:58:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795773666; x=1796378466; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=YjX/bHgd+m99mOT5aW+YMWKZtmIo3Q9I+MvYFafa9p0=; b=mmONWOqJAQqu0xvI7NP6HM4RPeCafu0MldRNw4Vtxy97j34Uk40OnbToq0dAZ21clO Vhr2QiOYWWIwjN5ivAIa7u7OYwCD9u98Rg8hURam12SUzrLZ32r1jXQ+YQB54yxKHHLY OA4VubFkAWi4jVLlQjEowsDNaVYn88lUsfTii+0SUIZI0idfc3SRP5x+i/np1kE9uxDL 0sKwFijrrEp9SOxLSvz2HcZevlWNkuApWz3BFaTLP7GS7qlt1w14zyqsctRyvyd7mODh rmvl54PcwHVjP44rEn5cswUmAnGGrBfL01/XAuuXIfk1eO5cESsCPuqg7pbckb/fkNue a8lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795773666; x=1796378466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YjX/bHgd+m99mOT5aW+YMWKZtmIo3Q9I+MvYFafa9p0=; b=nlh+D+xutP7JYPBn49Xfz4Y2thBuPJCq8kB2qV2lAgRIfbEv7T9xrYbWb6a5B0PE5S 01F9BrXaKG0Ufs3TkQOrfEr8RYYgCathaOTDHZ4n7K4n8diDxl0aZK4kb5VO2qQ0ilze GvZlqKNvjr6mO5izARW7dWxwoWGgTlsY0YWoAF/1DuPoDipRhP8Ai3BinloPRQlWvN/t yepJnmH2FMdo+baOqBVfBvwyWtSvBXfck//FsycyK/AfxptKxOYjgILUFDO/butvAiRp 2huQWs1Cbdxc7njp/eOmSUe29Vb8AZrdV4GX52EgIQrwa2+HUwGbPXVXu3w2S3ULV2B9 MSeA== X-Gm-Message-State: APuU4Z/PAsvO5l86+KPDJRE6ZBhdYY6qnRpHESDFDcDIngf/f7gBPIb7 ar9etajX24R00syXsi7ybn9LPZszxqFOydxOsRcWnOGhkWKHxnobMX/9rN2JD7diUHE= X-Gm-Gg: AZFdTZfLiRNgsPsEwVHF05qs6Rwfr8KDkbsn3Bi/mG92+0sBZlvPa4DD5Ao3+KW2E/F CWUO1GAdk/xZVNqMGTzEJOq2ouZR/o4l11bEg3G16tfO2ySvni6UE1W1JxElWQ5XDx/5/e+lmfI TK/j4aK9fjVENRNXFH+T2TzLslPp7yRP94skUvhuCTRSol5UGBePO04pYVJqnwyFUZByRr6ol10 ZqMvpVw2X3kwNYInWC6Or5hoKlJzfbUJMdrla8RPdT8E1NNLQmlhjy+8GC2fE0McFmFmhtdQXag bikzhsPH2Z+wMFARsM7QC0xUEuyr2yy8K1ohkPl5EhVMAk3YRr+KeandWEc78x4ZAcCw4RnuLfT WnKhUrFVdILinwmppFz2GQXj+3bN/CV8sVXCm7T2pUpGSITJYHB0JK1Gj9cQDj6xkAdsMK9BMJV yOineugGwTXL/NcEjsmcRUCGiPWL2DtX1cwknvexghIeV/+cCKOouk5qsheZDVxyua3hfGlBR2s 2jTWYGa/GKyr4OFFpRiDRLvYLQ/gMaZd1s/39C5kMPD6b+Xyl1uQi8nUULaX59L2CIwphlbIxIj kcUnafo0l4gRE94VLqcUUtgAFJnniSjkBg0vievBlB/TfS7jce7Ds9M4Fmg= X-Received: by 2002:a05:600c:4e87:b0:4a3:59c9:a758 with SMTP id 5b1f17b1804b1-4bb88922c81mr478803775e9.32.1795773660623; Fri, 27 Nov 2026 02:01:00 -0800 (PST) From: Krasimir Rangelov To: pve-devel@lists.proxmox.com Subject: [PATCH manager] ui: bridge selector: add search field to the drop-down list Date: Fri, 27 Nov 2026 12:00:53 +0200 Message-ID: <20261127100053.61325-1-krasiaa123@gmail.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_ENVFROM_END_DIGIT 1 Envelope-from freemail username ends in digit FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: krasiaa123@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: LQ4SD2DO6KJSUISBF25YTIKN3NIJX3DV X-Message-ID-Hash: LQ4SD2DO6KJSUISBF25YTIKN3NIJX3DV X-Mailman-Approved-At: Fri, 27 Nov 2026 18:58:52 +0100 CC: Krasimir Rangelov X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On nodes with many bridges or SDN VNets, finding the right one in the network device edit window means scrolling through the whole list. Add a search field on top of the bridge list, similar to the one in the storage add wizard. It filters the list to the entries that contain all entered words in their name, type or comment, so one can also search for e.g. a VLAN or a description noted in the comment. The search field gets the focus when the list opens. The arrow keys move the highlight through the matches without changing the value, ENTER selects the highlighted entry and ESC clears the search or closes the list. The search is reset whenever the list closes. As the list normally only closes when the focus leaves the field, and a click on the mask of the modal edit window focuses its first field again, also close the list on any click outside of it. This affects the network device edit windows of VMs and containers, as well as the guest import wizard. Signed-off-by: Krasimir Rangelov --- www/manager6/form/BridgeSelector.js | 144 ++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/www/manager6/form/BridgeSelector.js b/www/manager6/form/BridgeSelector.js index b5949018..7e84a0b3 100644 --- a/www/manager6/form/BridgeSelector.js +++ b/www/manager6/form/BridgeSelector.js @@ -39,6 +39,150 @@ Ext.define('PVE.form.BridgeSelector', { ], }, + // filter the list to the entries that contain every word of the search text in their name, + // type or comment, and highlight the first match + applySearch: function (value) { + let me = this; + let words = (value ?? '').toLowerCase().split(/\s+/).filter(Boolean); + if (words.join(' ') === me.searchText) { + return; // keep the highlight, e.g. on ENTER after the buffered change already applied + } + me.searchText = words.join(' '); + if (!words.length) { + me.store.removeFilter('bridgeSearch'); + me.highlightRecord(me.getSelection()); + return; + } + let text = (rec) => + [rec.get('iface'), rec.get('type'), rec.get('comments')].join(' ').toLowerCase(); + me.store.addFilter({ + id: 'bridgeSearch', + filterFn: (rec) => words.every((word) => text(rec).includes(word)), + }); + me.highlightRecord(me.store.first()); + }, + + // mark an entry without selecting it, as selecting would set the value and close the list + highlightRecord: function (rec) { + let me = this; + let picker = me.picker; + me.highlighted = rec && me.store.indexOf(rec) !== -1 ? rec : null; + if (!me.highlighted) { + picker.getView().clearHighlight(); + return; + } + picker.ensureVisible(me.highlighted, { + callback: (success, record, node) => { + if (success && node) { + picker.getView().highlightItem(node); + } + }, + }); + }, + + moveHighlight: function (step) { + let me = this; + let count = me.store.getCount(); + if (!count) { + return; + } + let index = me.highlighted ? me.store.indexOf(me.highlighted) : -1; + index = index === -1 ? 0 : Ext.Number.constrain(index + step, 0, count - 1); + me.highlightRecord(me.store.getAt(index)); + }, + + chooseRecord: function (rec) { + let me = this; + if (rec) { + me.picker.getSelectionModel().select(rec); + } + me.collapse(); + me.focus(); + }, + + // The combobox marks the current value when the list opens by moving the focus to its row, + // which would take the focus away from the search field. Highlight it without focus instead. + doAutoSelect: function () { + let me = this; + if (me.isExpanded) { + me.highlightRecord(me.getSelection()); + me.searchField.focus(); + } + }, + + createPicker: function () { + let me = this; + let picker = me.callParent(arguments); + + me.searchField = Ext.create('Ext.form.field.Text', { + flex: 1, + emptyText: gettext('Search bridge'), + submitValue: false, + isFormField: false, + listeners: { + change: { + buffer: 150, + fn: (field, value) => me.applySearch(value), + }, + specialkey: (field, event) => { + let key = event.getKey(); + if (key === event.DOWN || key === event.UP) { + event.stopEvent(); + me.moveHighlight(key === event.DOWN ? 1 : -1); + } else if (key === event.ENTER) { + event.stopEvent(); + me.applySearch(field.getValue()); + if (me.highlighted) { + me.chooseRecord(me.highlighted); + } + } else if (key === event.ESC) { + event.stopEvent(); + if (field.getValue()) { + field.setValue(''); + } else { + me.chooseRecord(); + } + } + }, + }, + }); + + picker.addDocked({ + xtype: 'toolbar', + dock: 'top', + items: [me.searchField], + }); + + // The list normally closes when the focus leaves the field. But a click on the mask of a + // modal edit window focuses its first field again, which can be this one, so also close + // the list on any click outside of it. + me.on({ + expand: () => { + me.outsideClickListener = me.mon(Ext.getDoc(), { + mousedown: me.collapseIf, + scope: me, + delegated: false, + destroyable: true, + }); + }, + collapse: () => { + Ext.destroy(me.outsideClickListener); + me.outsideClickListener = null; + }, + }); + + picker.on('hide', () => { + me.searchField.suspendEvents(); + me.searchField.setValue(''); + me.searchField.resumeEvents(); + me.store.removeFilter('bridgeSearch'); + me.searchText = ''; + me.highlighted = null; + }); + + return picker; + }, + setNodename: function (nodename) { var me = this; -- 2.51.0