From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id DA3F41FF133 for ; Mon, 11 May 2026 18:24:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9AA2320D3B; Mon, 11 May 2026 18:24:55 +0200 (CEST) Message-ID: Date: Mon, 11 May 2026 18:24:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH pve-manager v8 20/25] ui: sdn: prefix list: adapt to changed api structure To: Lukas Sichert , pve-devel@lists.proxmox.com References: <20260511133650.310040-1-s.hanreich@proxmox.com> <20260511133650.310040-21-s.hanreich@proxmox.com> Content-Language: en-US From: Stefan Hanreich In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.528 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_MAILER 2 Automated Mailer Tag Left in Email POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [prefixlistentry.pm,me.data,prefixlists.pm,prefixlist.pm] Message-ID-Hash: RACKT244TLTSL6ME6WS5A6S4WE6INCBM X-Message-ID-Hash: RACKT244TLTSL6ME6WS5A6S4WE6INCBM X-MailFrom: s.hanreich@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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 5/11/26 6:09 PM, Lukas Sichert wrote: > On 2026-05-11 15:36, Stefan Hanreich wrote: > >> From: Dominik Csapak >> >> instead of having to parse out the prefix list entries from the overall >> prefix list GET api call, the entries are now queried below: >> >> /sdn/cluster/prefix-list/{id}/entries >> >> so the entries grid can be simplified to use it's own store + url. >> This makes it possible to move the stores out of the viewmodel and into >> the respective grid views. >> >> Also use proxmoxStdRemoveButtons here to simplify the removal code. >> >> Signed-off-by: Dominik Csapak >> [SH: fixed wrong url in edit window, made sequence number optional and >> added empty text] >> Signed-off-by: Stefan Hanreich >> --- >> www/manager6/sdn/PrefixListPanel.js | 279 ++++++++++------------------ >> 1 file changed, 96 insertions(+), 183 deletions(-) >> >> diff --git a/www/manager6/sdn/PrefixListPanel.js b/www/manager6/sdn/PrefixListPanel.js >> index cdb860f4f..0e5cc11b8 100644 >> --- a/www/manager6/sdn/PrefixListPanel.js >> +++ b/www/manager6/sdn/PrefixListPanel.js >> @@ -1,16 +1,11 @@ >> Ext.define('PVE.sdn.PrefixList', { >> extend: 'Ext.data.Model', >> - fields: ['id', 'entries', 'pending'], >> - >> - getId: function () { >> - let me = this; >> - return me.data.pending?.[me.idProperty] ?? me.data[me.idProperty]; >> - }, >> + fields: ['id', 'state'], >> }); >> >> Ext.define('PVE.sdn.PrefixListEntry', { >> extend: 'Ext.data.Model', >> - fields: ['id', 'action', 'prefix', 'le', 'ge', 'pending'], >> + fields: ['id', 'action', 'seq', 'prefix', 'le', 'ge', 'pending'], >> }); >> >> Ext.define('PVE.sdn.EditPrefixListWindow', { >> @@ -45,10 +40,11 @@ Ext.define('PVE.sdn.EditPrefixListWindow', { >> >> Ext.define('PVE.sdn.EditPrefixListEntryWindow', { >> extend: 'Proxmox.window.Edit', >> + mixins: ['Proxmox.Mixin.CBind'], >> >> subject: gettext('Prefix List Entry'), >> >> - url: '/cluster/sdn/prefix-lists', >> + baseUrl: '/cluster/sdn/prefix-lists', >> >> config: { >> entry: null, >> @@ -57,6 +53,15 @@ Ext.define('PVE.sdn.EditPrefixListEntryWindow', { >> isCreate: false, >> >> items: [ >> + { >> + xtype: 'proxmoxintegerfield', >> + name: 'seq', >> + fieldLabel: gettext('Sequence Nr.'), >> + emptyText: gettext('autogenerated'), >> + cbind: { >> + deleteEmpty: '{!isCreate}', >> + } >> + }, >> { >> xtype: 'proxmoxKVComboBox', >> fieldLabel: gettext('Action'), >> @@ -88,6 +93,17 @@ Ext.define('PVE.sdn.EditPrefixListEntryWindow', { >> initComponent: function () { >> let me = this; >> me.method = me.isCreate ? 'POST' : 'PUT'; >> + >> + if (!me.prefixList) { >> + throw new 'no prefixList given'(); >> + } >> + >> + if (me.entry) { >> + me.url = `${me.baseUrl}/${me.prefixList}/entries/${me.entry.seq}`; >> + } else { >> + me.url = `${me.baseUrl}/${me.prefixList}/entries`; >> + } >> + >> me.callParent(); >> >> me.setValues(me.getEntry()); >> @@ -108,19 +124,28 @@ Ext.define('PVE.sdn.PrefixListView', { >> }, >> { >> text: gettext('Remove'), >> - xtype: 'button', >> - handler: 'removePrefixList', >> - bind: { >> - disabled: '{!prefixListGrid.selection}', >> - }, >> + xtype: 'proxmoxStdRemoveButton', >> + baseurl: '/cluster/sdn/prefix-lists/', >> + dangerous: true, >> + callback: 'reloadPrefixList', >> }, >> + '->', >> { >> text: gettext('Reload'), >> xtype: 'button', >> - handler: 'reload', >> + handler: 'reloadPrefixList', >> }, >> ], >> >> + store: { >> + autoLoad: true, >> + model: 'PVE.sdn.PrefixList', >> + proxy: { >> + type: 'proxmox', >> + url: '/api2/json/cluster/sdn/prefix-lists?pending=1', >> + }, >> + }, >> + >> columns: [ >> { >> text: gettext('Name'), >> @@ -139,6 +164,12 @@ Ext.define('PVE.sdn.PrefixListView', { >> }, >> }, >> ], >> + >> + initComponent: function () { >> + let me = this; >> + me.callParent(); >> + Proxmox.Utils.monStoreErrors(me, me.getStore()); >> + }, >> }); >> >> Ext.define('PVE.sdn.PrefixListEntriesView', { >> @@ -151,30 +182,22 @@ Ext.define('PVE.sdn.PrefixListEntriesView', { >> prefixList: null, >> }, >> >> - viewConfig: { >> - plugins: [ >> - { >> - ptype: 'gridviewdragdrop', >> - }, >> - ], >> - }, >> - >> listeners: { >> - drop: 'saveEntries', >> itemdblclick: 'editPrefixListEntry', >> }, >> >> + store: { >> + model: 'PVE.sdn.PrefixListEntry', >> + proxy: { >> + type: 'proxmox', >> + }, >> + }, >> + >> columns: [ >> { >> - width: 40, >> - resizable: false, >> - sortable: false, >> - hideable: false, >> - menuDisabled: true, >> - renderer: function (value, metaData, record, rowIdx, colIdx) { >> - metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special'; >> - return ""; >> - }, >> + text: gettext('Sequence Nr.'), >> + dataIndex: 'seq', >> + flex: 1, >> }, >> { >> text: gettext('Action'), >> @@ -209,21 +232,32 @@ Ext.define('PVE.sdn.PrefixListEntriesView', { >> }, >> { >> text: gettext('Edit'), >> - xtype: 'button', >> + xtype: 'proxmoxButton', >> + disabled: true, >> handler: 'editPrefixListEntry', >> - bind: { >> - disabled: '{!prefixListEntriesGrid.selection}', >> - }, >> }, >> { >> text: gettext('Remove'), >> - xtype: 'button', >> - handler: 'removePrefixListEntry', >> - bind: { >> - disabled: '{!prefixListEntriesGrid.selection}', >> + xtype: 'proxmoxStdRemoveButton', >> + customConfirmationMessage: gettext( >> + 'Are you sure you want to remove entry with sequence {0}', >> + ), >> + getRecordName: (rec) => rec.data.seq, >> + getUrl: function (rec) { >> + let grid = this.up('grid'); >> + let prefixList = grid.prefixList; >> + let id = prefixList.getId(); >> + let seq = rec.data.seq; >> + return `/cluster/sdn/prefix-lists/${id}/entries/${seq}`; > > I am a bit confused here. I cannot find a Api Handler for '/entries' in > the pve-network PrefixLists.pm File. Also if I want to look at the > prefix-list entries in the Gui I get 'Method 'GET > /cluster/sdn/prefix-lists//entries' not implemented (501)'. > Is this somehow handled in a more obscure way or is it a bug that > happened during rewriting the API interface? hmm, just double-checked here: root@elementalist:~# pvesh get /cluster/sdn/prefix-lists/qwe/entries ┌────────┬────┬────────────────┬─────┐ │ action │ le │ prefix │ seq │ ╞════════╪════╪════════════════╪═════╡ │ permit │ │ 203.0.113.0/24 │ 5 │ ├────────┼────┼────────────────┼─────┤ │ permit │ 32 │ 192.0.2.0/24 │ 7 │ └────────┴────┴────────────────┴─────┘ root@elementalist:~# pvesh get /cluster/sdn/prefix-lists/qwe/entries/5 ┌────────┬────────────────┐ │ key │ value │ ╞════════╪════════════════╡ │ action │ permit │ ├────────┼────────────────┤ │ prefix │ 203.0.113.0/24 │ ├────────┼────────────────┤ │ seq │ 5 │ └────────┴────────────────┘ root@elementalist:~# pvesh delete /cluster/sdn/prefix-lists/qwe/entries/5 The respective subfolder is defined in: pve-network/src/PVE/API2/Network/SDN/PrefixLists/PrefixList.pm and the handlers then in: pve-network/src/PVE/API2/Network/SDN/PrefixLists/PrefixListEntry.pm