1145 Warn if datacenter firewall is disabled

This warns the user that the datacenter firewall is disabled when editing the
host or the VM/CT firewall status.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2019-03-13 09:57:31 +01:00 committed by Thomas Lamprecht
parent 5fbbbaf6b7
commit 73c64dc513
3 changed files with 71 additions and 3 deletions

View File

@ -84,6 +84,7 @@ JSSRC= \
window/Settings.js \
window/StartupEdit.js \
window/CephInstall.js \
window/FirewallEnableEdit.js \
panel/NotesView.js \
grid/ResourceGrid.js \
grid/PoolMembers.js \

View File

@ -64,9 +64,17 @@ Ext.define('PVE.FirewallOptions', {
};
};
if (me.fwtype === 'node') {
add_boolean_row('enable', gettext('Firewall'), 1);
me.rows.enable = {
required: true,
defaultValue: 1,
header: gettext('Firewall'),
renderer: Proxmox.Utils.format_boolean,
editor: {
xtype: 'pveFirewallEnableEdit',
defaultValue: 1
}
};
add_boolean_row('nosmurfs', gettext('SMURFS filter'), 1);
add_boolean_row('tcpflags', gettext('TCP flags filter'), 0);
add_boolean_row('ndp', 'NDP', 1);
@ -78,7 +86,16 @@ Ext.define('PVE.FirewallOptions', {
add_log_row('tcp_flags_log_level', 120);
add_log_row('smurf_log_level');
} else if (me.fwtype === 'vm') {
add_boolean_row('enable', gettext('Firewall'), 0);
me.rows.enable = {
required: true,
defaultValue: 0,
header: gettext('Firewall'),
renderer: Proxmox.Utils.format_boolean,
editor: {
xtype: 'pveFirewallEnableEdit',
defaultValue: 0
}
};
add_boolean_row('dhcp', 'DHCP', 1);
add_boolean_row('ndp', 'NDP', 1);
add_boolean_row('radv', gettext('Router Advertisement'), 0);

View File

@ -0,0 +1,50 @@
/*jslint confusion: true*/
Ext.define('PVE.FirewallEnableEdit', {
extend: 'Proxmox.window.Edit',
alias: ['widget.pveFirewallEnableEdit'],
mixins: ['Proxmox.Mixin.CBind'],
subject: gettext('Firewall'),
cbindData: {
defaultValue: 0
},
width: 350,
items: [
{
xtype: 'proxmoxcheckbox',
name: 'enable',
uncheckedValue: 0,
cbind: {
defaultValue: '{defaultValue}',
checked: '{defaultValue}'
},
deleteDefaultValue: false,
fieldLabel: gettext('Firewall')
},
{
xtype: 'displayfield',
name: 'warning',
userCls: 'pve-hint',
value: gettext('Warning: Firewall still disabled at datacenter level!'),
hidden: true
}
],
beforeShow: function() {
var me = this;
Proxmox.Utils.API2Request({
url: '/api2/extjs/cluster/firewall/options',
method: 'GET',
failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
},
success: function(response, opts) {
if (!response.result.data.enable) {
me.down('displayfield[name=warning]').setVisible(true);
}
}
});
}
});