From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-manager 7/9] ui: sdn: fabrics: add redistribution grid component
Date: Mon, 4 May 2026 18:31:52 +0200 [thread overview]
Message-ID: <20260504163157.429628-8-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20260504163157.429628-1-s.hanreich@proxmox.com>
This component can be used to configure the redistribution settings
for fabrics that utilize FRR. Since the redistribution settings are
basically the same for each protocol, except for the allowed source
protocols, implement a generic component where it is possible to
override the possible source protocols.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
www/manager6/Makefile | 1 +
.../sdn/fabrics/RedistributionGrid.js | 173 ++++++++++++++++++
2 files changed, 174 insertions(+)
create mode 100644 www/manager6/sdn/fabrics/RedistributionGrid.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 002ac9733..1ad77f3d3 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -337,6 +337,7 @@ JSSRC= \
sdn/fabrics/InterfacePanel.js \
sdn/fabrics/NodeEdit.js \
sdn/fabrics/FabricEdit.js \
+ sdn/fabrics/RedistributionGrid.js \
sdn/fabrics/openfabric/InterfacePanel.js \
sdn/fabrics/openfabric/NodeEdit.js \
sdn/fabrics/openfabric/FabricEdit.js \
diff --git a/www/manager6/sdn/fabrics/RedistributionGrid.js b/www/manager6/sdn/fabrics/RedistributionGrid.js
new file mode 100644
index 000000000..8580c4793
--- /dev/null
+++ b/www/manager6/sdn/fabrics/RedistributionGrid.js
@@ -0,0 +1,173 @@
+Ext.define('PVE.sdn.Fabric.OspfRedistribution', {
+ extend: 'Ext.data.Model',
+ fields: ['source'],
+});
+
+Ext.define('PVE.sdn.Fabric.RedistributionGrid', {
+ alias: 'widget.pveSDNRedistributionGrid',
+ extend: 'Ext.grid.Panel',
+ mixins: ['Ext.form.field.Field'],
+
+ config: {
+ sources: [],
+ additionalColumns: [],
+ },
+
+ store: {
+ model: 'PVE.sdn.Fabric.OspfRedistribution',
+ listeners: {
+ update: 'handleUpdate',
+ }
+ },
+
+ tbar: [
+ '->',
+ {
+ text: gettext('Add'),
+ handler: 'addRedistribution',
+ }
+ ],
+
+ border: false,
+
+ columns: [],
+
+ controller: {
+ xclass: 'Ext.app.ViewController',
+
+ addRedistribution: function() {
+ let me = this;
+
+ let source = me.getView().getSources()[0][0];
+
+ me.getView().getStore().add({
+ source,
+ });
+
+ me.handleUpdate();
+ },
+
+ deleteRedistribution: function (table, rI, cI, item, e, rec) {
+ let me = this;
+ me.getView().getStore().remove(rec);
+ me.handleUpdate();
+ },
+
+ handleUpdate: function() {
+ let me = this;
+ me.getView().checkChange();
+ }
+ },
+
+ initComponent: function() {
+ let me = this;
+
+ if (me.getSources().length === 0) {
+ throw "must define at least one redistribution source!";
+ }
+
+ me.columns = [
+ {
+ text: gettext("Source"),
+ xtype: 'widgetcolumn',
+ flex: 1,
+ widget: {
+ xtype: 'proxmoxKVComboBox',
+ comboItems: me.getSources(),
+ bind: {
+ value: '{record.source}',
+ },
+ listeners: {
+ select: 'handleUpdate',
+ },
+ },
+ },
+ {
+ text: gettext("Route Map"),
+ xtype: 'widgetcolumn',
+ flex: 1,
+ widget: {
+ xtype: 'pveSDNRouteMapSelector',
+ bind: {
+ value: '{record.route_map}',
+ },
+ listeners: {
+ select: 'handleUpdate',
+ },
+ },
+ },
+ ...me.getAdditionalColumns(),
+ {
+ text: gettext("Action"),
+ xtype: 'actioncolumn',
+ width: 100,
+ items: [
+ {
+ tooltip: gettext('Delete'),
+ handler: 'deleteRedistribution',
+ iconCls: 'fa critical fa-trash-o',
+ },
+ ],
+ },
+ ];
+
+ me.callParent();
+ },
+
+ isEqual: function(value1, value2) {
+ return JSON.stringify(value1) === JSON.stringify(value2);
+ },
+
+ getValue: function() {
+ let me = this;
+
+ return me.getStore().getData().items.map((record) => {
+ let data = structuredClone(record.data);
+ delete data.id;
+
+ return PVE.Parser.printPropertyString(data, undefined);
+ });
+ },
+
+ setValue: function(value) {
+ let me = this;
+
+ me.getStore().setData(value.map((item) => PVE.Parser.parsePropertyString(item)));
+ me.resetOriginalValue();
+ },
+
+ getSubmitData: function () {
+ let me = this;
+
+ let name = me.getName();
+ let value = me.getValue();
+
+ if (value.length === 0 && !me.isCreate) {
+ return {
+ delete: name,
+ };
+ }
+
+ return {
+ [name]: value,
+ };
+ },
+
+ getErrors: function(value) {
+ let me = this;
+
+ let errors = [];
+ let sourceCount = {};
+
+ for (const record of me.getStore().getData().items) {
+ sourceCount[record.data.source] ??= 0;
+ sourceCount[record.data.source]++;
+
+ if (sourceCount[record.data.source] === 2) {
+ errors.push(`Duplicate source: ${record.data.source}`);
+ }
+ }
+
+ return errors;
+ }
+});
--
2.47.3
next prev parent reply other threads:[~2026-05-04 16:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 16:31 [PATCH manager/network/proxmox-ve-rs 0/9] Implement route redistribution for OSPF Stefan Hanreich
2026-05-04 16:31 ` [PATCH proxmox-ve-rs 1/9] frr: ospf: add redistribute setting Stefan Hanreich
2026-05-04 16:31 ` [PATCH proxmox-ve-rs 2/9] frr-templates: render " Stefan Hanreich
2026-05-04 16:31 ` [PATCH proxmox-ve-rs 3/9] ve-config: add redistribute setting to ospf section config Stefan Hanreich
2026-05-04 16:31 ` [PATCH proxmox-ve-rs 4/9] ve-config: use constructor instead of instantiating struct Stefan Hanreich
2026-05-04 16:31 ` [PATCH proxmox-ve-rs 5/9] ve-config: ospf: generate redistribute config Stefan Hanreich
2026-05-04 16:31 ` [PATCH pve-network 6/9] fabrics: ospf: add redistribute to api types Stefan Hanreich
2026-05-04 16:31 ` Stefan Hanreich [this message]
2026-05-04 16:31 ` [PATCH pve-manager 8/9] ui: sdn: fabric edit: allow defining multiple tabs Stefan Hanreich
2026-05-04 16:31 ` [PATCH pve-manager 9/9] ui: sdn: ospf fabric: add redistribution grid to ospf fabric Stefan Hanreich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260504163157.429628-8-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox