mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 15:21:28 +00:00
new IPProtocolSelector implementation.
and do not use pvetextfield/deleteEmpty, because that is no longer necessary with recent firewall API changes.
This commit is contained in:
parent
9184785c0b
commit
5491c98f86
@ -45,6 +45,7 @@ JSSRC= \
|
|||||||
form/BridgeSelector.js \
|
form/BridgeSelector.js \
|
||||||
form/SecurityGroupSelector.js \
|
form/SecurityGroupSelector.js \
|
||||||
form/IPSetSelector.js \
|
form/IPSetSelector.js \
|
||||||
|
form/IPProtocolSelector.js \
|
||||||
form/CPUModelSelector.js \
|
form/CPUModelSelector.js \
|
||||||
form/VNCKeyboardSelector.js \
|
form/VNCKeyboardSelector.js \
|
||||||
form/LanguageSelector.js \
|
form/LanguageSelector.js \
|
||||||
|
98
www/manager/form/IPProtocolSelector.js
Normal file
98
www/manager/form/IPProtocolSelector.js
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
Ext.define('PVE.form.IPProtocolSelector', {
|
||||||
|
extend: 'PVE.form.ComboGrid',
|
||||||
|
alias: ['widget.pveIPProtocolSelector'],
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
var store = Ext.create('Ext.data.Store', {
|
||||||
|
fields: [ 'p', 'd', 'n'],
|
||||||
|
data: [
|
||||||
|
{ p: 'tcp', n: 6, d: 'Transmission Control Protocol' },
|
||||||
|
{ p: 'udp', n: 17, d: 'User Datagram Protocol' },
|
||||||
|
{ p: 'icmp', n: 1, d: 'Internet Control Message Protocol' },
|
||||||
|
{ p: 'igmp', n: 2, d: 'Internet Group Management' },
|
||||||
|
{ p: 'ggp', n: 3, d: 'gateway-gateway protocol' },
|
||||||
|
{ p: 'ipencap', n: 4, d: 'IP encapsulated in IP' },
|
||||||
|
{ p: 'st', n: 5, d: 'ST datagram mode' },
|
||||||
|
{ p: 'egp', n: 8, d: 'exterior gateway protocol' },
|
||||||
|
{ p: 'igp', n: 9, d: 'any private interior gateway (Cisco)' },
|
||||||
|
{ p: 'pup', n: 12, d: 'PARC universal packet protocol' },
|
||||||
|
{ p: 'hmp', n: 20, d: 'host monitoring protocol' },
|
||||||
|
{ p: 'xns-idp', n: 22, d: 'Xerox NS IDP' },
|
||||||
|
{ p: 'rdp', n: 27, d: '"reliable datagram" protocol' },
|
||||||
|
{ p: 'iso-tp4', n: 29, d: 'ISO Transport Protocol class 4 [RFC905]' },
|
||||||
|
{ p: 'dccp', n: 33, d: 'Datagram Congestion Control Prot. [RFC4340]' },
|
||||||
|
{ p: 'xtp', n: 36, d: 'Xpress Transfer Protocol' },
|
||||||
|
{ p: 'ddp', n: 37, d: 'Datagram Delivery Protocol' },
|
||||||
|
{ p: 'idpr-cmtp', n: 38, d: 'IDPR Control Message Transport' },
|
||||||
|
{ p: 'ipv6', n: 41, d: 'Internet Protocol, version 6' },
|
||||||
|
{ p: 'ipv6-route', n: 43, d: 'Routing Header for IPv6' },
|
||||||
|
{ p: 'ipv6-frag', n: 44, d: 'Fragment Header for IPv6' },
|
||||||
|
{ p: 'idrp', n: 45, d: 'Inter-Domain Routing Protocol' },
|
||||||
|
{ p: 'rsvp', n: 46, d: 'Reservation Protocol' },
|
||||||
|
{ p: 'gre', n: 47, d: 'General Routing Encapsulation' },
|
||||||
|
{ p: 'esp', n: 50, d: 'Encap Security Payload [RFC2406]' },
|
||||||
|
{ p: 'ah', n: 51, d: 'Authentication Header [RFC2402]' },
|
||||||
|
{ p: 'skip', n: 57, d: 'SKIP' },
|
||||||
|
{ p: 'ipv6-icmp', n: 58, d: 'ICMP for IPv6' },
|
||||||
|
{ p: 'ipv6-nonxt', n: 59, d: 'No Next Header for IPv6' },
|
||||||
|
{ p: 'ipv6-opts', n: 60, d: 'Destination Options for IPv6' },
|
||||||
|
{ p: 'vmtp', n: 81, d: 'Versatile Message Transport' },
|
||||||
|
{ p: 'eigrp', n: 88, d: 'Enhanced Interior Routing Protocol (Cisco)' },
|
||||||
|
{ p: 'ospf', n: 89, d: 'Open Shortest Path First IGP' },
|
||||||
|
{ p: 'ax.25', n: 93, d: 'AX.25 frames' },
|
||||||
|
{ p: 'ipip', n: 94, d: 'IP-within-IP Encapsulation Protocol' },
|
||||||
|
{ p: 'etherip', n: 97, d: 'Ethernet-within-IP Encapsulation [RFC3378]' },
|
||||||
|
{ p: 'encap', n: 98, d: 'Yet Another IP encapsulation [RFC1241]' },
|
||||||
|
{ p: 'pim', n: 103, d: 'Protocol Independent Multicast' },
|
||||||
|
{ p: 'ipcomp', n: 108, d: 'IP Payload Compression Protocol' },
|
||||||
|
{ p: 'vrrp', n: 112, d: 'Virtual Router Redundancy Protocol [RFC5798]' },
|
||||||
|
{ p: 'l2tp', n: 115, d: 'Layer Two Tunneling Protocol [RFC2661]' },
|
||||||
|
{ p: 'isis', n: 124, d: 'IS-IS over IPv4' },
|
||||||
|
{ p: 'sctp', n: 132, d: 'Stream Control Transmission Protocol' },
|
||||||
|
{ p: 'fc', n: 133, d: 'Fibre Channel' },
|
||||||
|
{ p: 'mobility-header', n: 135, d: 'Mobility Support for IPv6 [RFC3775]' },
|
||||||
|
{ p: 'udplite', n: 136, d: 'UDP-Lite [RFC3828]' },
|
||||||
|
{ p: 'mpls-in-ip', n: 137, d: 'MPLS-in-IP [RFC4023]' },
|
||||||
|
{ p: 'hip', n: 139, d: 'Host Identity Protocol' },
|
||||||
|
{ p: 'shim6', n: 140, d: 'Shim6 Protocol [RFC5533]' },
|
||||||
|
{ p: 'wesp', n: 141, d: 'Wrapped Encapsulating Security Payload' },
|
||||||
|
{ p: 'rohc', n: 142, d: 'Robust Header Compression' }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
Ext.apply(me, {
|
||||||
|
store: store,
|
||||||
|
valueField: 'p',
|
||||||
|
displayField: 'p',
|
||||||
|
listConfig: {
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
header: gettext('Protocol'),
|
||||||
|
dataIndex: 'p',
|
||||||
|
hideable: false,
|
||||||
|
sortable: false,
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: gettext('Number'),
|
||||||
|
dataIndex: 'n',
|
||||||
|
hideable: false,
|
||||||
|
sortable: false,
|
||||||
|
width: 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
header: gettext('Description'),
|
||||||
|
dataIndex: 'd',
|
||||||
|
hideable: false,
|
||||||
|
sortable: false,
|
||||||
|
flex: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
}
|
||||||
|
});
|
@ -130,7 +130,6 @@ Ext.define('PVE.FirewallRulePanel', {
|
|||||||
xtype: 'pveFWMacroSelector',
|
xtype: 'pveFWMacroSelector',
|
||||||
name: 'macro',
|
name: 'macro',
|
||||||
value: '',
|
value: '',
|
||||||
deleteEmpty: !me.create,
|
|
||||||
fieldLabel: gettext('Macro'),
|
fieldLabel: gettext('Macro'),
|
||||||
allowBlank: true,
|
allowBlank: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@ -148,13 +147,10 @@ Ext.define('PVE.FirewallRulePanel', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'pveKVComboBox',
|
xtype: 'pveIPProtocolSelector',
|
||||||
name: 'proto',
|
name: 'proto',
|
||||||
value: '',
|
value: '',
|
||||||
deleteEmpty: !me.create,
|
|
||||||
emptyText: 'any',
|
emptyText: 'any',
|
||||||
editable: true,
|
|
||||||
data: [['tcp', 'TCP'], ['udp', 'UDP'], ['icmp', 'ICMP'], ['igmp', 'IGMP']],
|
|
||||||
fieldLabel: gettext('Protocol'),
|
fieldLabel: gettext('Protocol'),
|
||||||
allowBlank: true
|
allowBlank: true
|
||||||
},
|
},
|
||||||
@ -165,17 +161,15 @@ Ext.define('PVE.FirewallRulePanel', {
|
|||||||
value: ''
|
value: ''
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'pvetextfield',
|
xtype: 'textfield',
|
||||||
name: 'sport',
|
name: 'sport',
|
||||||
deleteEmpty: !me.create,
|
|
||||||
value: '',
|
value: '',
|
||||||
fieldLabel: gettext('Source port')
|
fieldLabel: gettext('Source port')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'pvetextfield',
|
xtype: 'textfield',
|
||||||
name: 'dport',
|
name: 'dport',
|
||||||
height: 22, // hack: set same height as text fields
|
height: 22, // hack: set same height as text fields
|
||||||
deleteEmpty: !me.create,
|
|
||||||
value: '',
|
value: '',
|
||||||
fieldLabel: gettext('Dest. port')
|
fieldLabel: gettext('Dest. port')
|
||||||
}
|
}
|
||||||
@ -390,36 +384,7 @@ Ext.define('PVE.FirewallRules', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createRule: function(editor, rule) {
|
updateRule: function(rule) {
|
||||||
var me = this;
|
|
||||||
|
|
||||||
if (!me.base_url) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rule.pos = 0;
|
|
||||||
|
|
||||||
rule.enable = rule.enable ? 1 : 0;
|
|
||||||
|
|
||||||
PVE.Utils.API2Request({
|
|
||||||
url: me.base_url,
|
|
||||||
method: 'POST',
|
|
||||||
params: rule,
|
|
||||||
waitMsgTarget: me,
|
|
||||||
failure: function(response, options) {
|
|
||||||
if (editor) {
|
|
||||||
editor.form.markInvalid(response.result.errors);
|
|
||||||
} else {
|
|
||||||
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
callback: function() {
|
|
||||||
me.store.load();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
updateRule: function(editor, rule) {
|
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
if (!me.base_url) {
|
if (!me.base_url) {
|
||||||
@ -598,7 +563,7 @@ Ext.define('PVE.FirewallRules', {
|
|||||||
if (!me.allow_iface || !data.iface) {
|
if (!me.allow_iface || !data.iface) {
|
||||||
delete data.iface;
|
delete data.iface;
|
||||||
}
|
}
|
||||||
me.updateRule(undefined, data);
|
me.updateRule(data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
width: 50
|
width: 50
|
||||||
|
Loading…
Reference in New Issue
Block a user