From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Oguz Bektas <o.bektas@proxmox.com>
Subject: Re: [pve-devel] [PATCH v4 manager 2/2] fix #1065: ui: fail2ban gui for nodes
Date: Tue, 19 Oct 2021 15:47:20 +0200 [thread overview]
Message-ID: <1035b0be-8d58-9699-4120-15b212fa03e4@proxmox.com> (raw)
In-Reply-To: <20211011105704.760773-3-o.bektas@proxmox.com>
looks mostly ok (besides my comment about the propertystring and options
thing of the previous patch)
comment inline:
On 10/11/21 12:57, Oguz Bektas wrote:
> adds a simple grid for fail2ban options into the node config panel
>
> ---
> v4:
> * no changes
>
>
> www/manager6/Makefile | 1 +
> www/manager6/grid/Fail2banOptions.js | 51 ++++++++++++++++++++++++++++
> www/manager6/node/Config.js | 7 ++++
> 3 files changed, 59 insertions(+)
> create mode 100644 www/manager6/grid/Fail2banOptions.js
>
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 7d491f57..ad9fe58a 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -74,6 +74,7 @@ JSSRC= \
> grid/BackupView.js \
> grid/FirewallAliases.js \
> grid/FirewallOptions.js \
> + grid/Fail2banOptions.js \
> grid/FirewallRules.js \
> grid/PoolMembers.js \
> grid/Replication.js \
> diff --git a/www/manager6/grid/Fail2banOptions.js b/www/manager6/grid/Fail2banOptions.js
> new file mode 100644
> index 00000000..5de0c18c
> --- /dev/null
> +++ b/www/manager6/grid/Fail2banOptions.js
> @@ -0,0 +1,51 @@
> +Ext.define('PVE.Fail2banOptions', {
> + extend: 'Proxmox.grid.ObjectGrid',
> + alias: ['widget.pveFail2banOptions'],
> +
> + base_url: undefined,
> +
> + initComponent: function() {
> + var me = this;
> +
> + me.rows = {};
> +
> + me.add_boolean_row('enable', gettext("Enable Fail2Ban"));
> + me.add_integer_row('maxretry', gettext("Max retries"));
> + me.add_integer_row('bantime', gettext("Minutes to ban"));
> +
> + var edit_btn = new Ext.Button({
> + text: gettext('Edit'),
> + disabled: true,
> + handler: function() { me.run_editor(); },
> + });
> +
> + var set_button_status = function() {
> + var sm = me.getSelectionModel();
> + var rec = sm.getSelection()[0];
> +
> + if (!rec) {
> + edit_btn.disable();
> + return;
> + }
> + var rowdef = me.rows[rec.data.key];
> + edit_btn.setDisabled(!rowdef.editor);
> + };
> +
> + Ext.apply(me, {
> + url: "/api2/json" + me.base_url,
> + tbar: [edit_btn],
> + editorConfig: {
> + url: "/api2/extjs" + me.base_url,
> + },
> + listeners: {
> + itemdblclick: me.run_editor,
> + selectionchange: set_button_status,
> + },
> + });
i know its mostly copy&pasted, but i'd still rather see a more
declarative approach to this, even if it just defining the functions
inline here.
> +
> + me.callParent();
> + me.on('activate', me.rstore.startUpdate);
> + me.on('destroy', me.rstore.stopUpdate);
> + me.on('deactivate', me.rstore.stopUpdate);
> + },
> +});
> diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js index 68f80391..9dbe8d0c 100644
> --- a/www/manager6/node/Config.js
> +++ b/www/manager6/node/Config.js
> @@ -276,6 +276,13 @@ Ext.define('PVE.node.Config', {
> base_url: '/nodes/' + nodename + '/firewall/options',
> fwtype: 'node',
> itemId: 'firewall-options',
> + },
> + {
> + xtype: 'pveFail2banOptions',
> + iconCls: 'fa fa-legal',
> + title: gettext('Fail2ban'),
> + base_url: '/nodes/' + nodename + '/firewall/fail2ban',
> + itemId: 'fail2ban-options',
> });
> }
>
>
prev parent reply other threads:[~2021-10-19 13:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 10:57 [pve-devel] [PATCH-SERIES manager firewall v4 0/2] fix #1065: implement fail2ban api and gui Oguz Bektas
2021-10-11 10:57 ` [pve-devel] [PATCH v4 firewall 1/2] implement fail2ban backend and API Oguz Bektas
2021-10-19 13:43 ` Dominik Csapak
2021-10-20 12:11 ` Oguz Bektas
2021-10-20 14:12 ` Thomas Lamprecht
2021-10-20 14:09 ` Thomas Lamprecht
2021-10-11 10:57 ` [pve-devel] [PATCH v4 manager 2/2] fix #1065: ui: fail2ban gui for nodes Oguz Bektas
2021-10-19 13:47 ` Dominik Csapak [this message]
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=1035b0be-8d58-9699-4120-15b212fa03e4@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=o.bektas@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.