mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-29 21:16:13 +00:00
make network devices types configureable
so that we can show all on pve and only bonds on pmg Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
00ee113714
commit
7c0e4c25c1
@ -15,6 +15,10 @@ Ext.define('Proxmox.node.NetworkView', {
|
|||||||
|
|
||||||
alias: ['widget.proxmoxNodeNetworkView'],
|
alias: ['widget.proxmoxNodeNetworkView'],
|
||||||
|
|
||||||
|
// defines what types of network devices we want to create
|
||||||
|
// order is always the same
|
||||||
|
types: ['bridge', 'bond', 'ovs'],
|
||||||
|
|
||||||
initComponent : function() {
|
initComponent : function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
@ -144,75 +148,91 @@ Ext.define('Proxmox.node.NetworkView', {
|
|||||||
return prefix + next.toString();
|
return prefix + next.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var menu_items = [];
|
||||||
|
|
||||||
|
if (me.types.indexOf('bridge') !== -1) {
|
||||||
|
menu_items.push({
|
||||||
|
text: Proxmox.Utils.render_network_iface_type('bridge'),
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
iftype: 'bridge',
|
||||||
|
iface_default: find_next_iface_id('vmbr')
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (me.types.indexOf('bond') !== -1) {
|
||||||
|
menu_items.push({
|
||||||
|
text: Proxmox.Utils.render_network_iface_type('bond'),
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
iftype: 'bond',
|
||||||
|
iface_default: find_next_iface_id('bond')
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (me.types.indexOf('ovs') !== -1) {
|
||||||
|
if (menu_items.length > 0) {
|
||||||
|
menu_items.push({ xtype: 'menuseparator' });
|
||||||
|
}
|
||||||
|
|
||||||
|
menu_items.push(
|
||||||
|
{
|
||||||
|
text: Proxmox.Utils.render_network_iface_type('OVSBridge'),
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
iftype: 'OVSBridge',
|
||||||
|
iface_default: find_next_iface_id('vmbr')
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: Proxmox.Utils.render_network_iface_type('OVSBond'),
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
iftype: 'OVSBond',
|
||||||
|
iface_default: find_next_iface_id('bond')
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: Proxmox.Utils.render_network_iface_type('OVSIntPort'),
|
||||||
|
handler: function() {
|
||||||
|
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
||||||
|
nodename: me.nodename,
|
||||||
|
iftype: 'OVSIntPort'
|
||||||
|
});
|
||||||
|
win.on('destroy', reload);
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ext.apply(me, {
|
Ext.apply(me, {
|
||||||
layout: 'border',
|
layout: 'border',
|
||||||
tbar: [
|
tbar: [
|
||||||
{
|
{
|
||||||
text: gettext('Create'),
|
text: gettext('Create'),
|
||||||
menu: new Ext.menu.Menu({
|
menu: {
|
||||||
plain: true,
|
plain: true,
|
||||||
items: [
|
items: menu_items
|
||||||
{
|
}
|
||||||
text: Proxmox.Utils.render_network_iface_type('bridge'),
|
|
||||||
handler: function() {
|
|
||||||
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
|
||||||
nodename: me.nodename,
|
|
||||||
iftype: 'bridge',
|
|
||||||
iface_default: find_next_iface_id('vmbr')
|
|
||||||
});
|
|
||||||
win.on('destroy', reload);
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: Proxmox.Utils.render_network_iface_type('bond'),
|
|
||||||
handler: function() {
|
|
||||||
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
|
||||||
nodename: me.nodename,
|
|
||||||
iftype: 'bond',
|
|
||||||
iface_default: find_next_iface_id('bond')
|
|
||||||
});
|
|
||||||
win.on('destroy', reload);
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
}, '-',
|
|
||||||
{
|
|
||||||
text: Proxmox.Utils.render_network_iface_type('OVSBridge'),
|
|
||||||
handler: function() {
|
|
||||||
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
|
||||||
nodename: me.nodename,
|
|
||||||
iftype: 'OVSBridge',
|
|
||||||
iface_default: find_next_iface_id('vmbr')
|
|
||||||
});
|
|
||||||
win.on('destroy', reload);
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: Proxmox.Utils.render_network_iface_type('OVSBond'),
|
|
||||||
handler: function() {
|
|
||||||
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
|
||||||
nodename: me.nodename,
|
|
||||||
iftype: 'OVSBond',
|
|
||||||
iface_default: find_next_iface_id('bond')
|
|
||||||
});
|
|
||||||
win.on('destroy', reload);
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: Proxmox.Utils.render_network_iface_type('OVSIntPort'),
|
|
||||||
handler: function() {
|
|
||||||
var win = Ext.create('Proxmox.node.NetworkEdit', {
|
|
||||||
nodename: me.nodename,
|
|
||||||
iftype: 'OVSIntPort'
|
|
||||||
});
|
|
||||||
win.on('destroy', reload);
|
|
||||||
win.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}, ' ',
|
}, ' ',
|
||||||
{
|
{
|
||||||
text: gettext('Revert'),
|
text: gettext('Revert'),
|
||||||
|
Loading…
Reference in New Issue
Block a user