From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B9ED363C5A for ; Wed, 28 Oct 2020 17:09:07 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AD88721E57 for ; Wed, 28 Oct 2020 17:09:07 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6AAFD21E47 for ; Wed, 28 Oct 2020 17:09:06 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 307DB45F72 for ; Wed, 28 Oct 2020 17:09:06 +0100 (CET) To: Proxmox VE development discussion , Stoiko Ivanov References: <20201028152222.25023-1-s.ivanov@proxmox.com> <20201028152222.25023-2-s.ivanov@proxmox.com> From: Thomas Lamprecht Message-ID: <3da5cb19-e868-b208-4e92-83b84470868a@proxmox.com> Date: Wed, 28 Oct 2020 17:09:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201028152222.25023-2-s.ivanov@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.960 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -2.167 Looks like a legit reply (A) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH widget-toolkit 1/1] move pbsEncryptionCheckbox from pve-manager X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2020 16:09:07 -0000 On 28.10.20 16:22, Stoiko Ivanov wrote: > for reuse in PMG > I'd rather fix this first in PVE, currently it provides a horrendous UX... We want to: * allow uploading a key * explicitly warn about the importance when auto-generating one and provide and easy download and paper-key button. > Signed-off-by: Stoiko Ivanov > --- > src/Makefile | 1 + > src/form/PBSEncryptionCheckbox.js | 63 +++++++++++++++++++++++++++++++ > 2 files changed, 64 insertions(+) > create mode 100644 src/form/PBSEncryptionCheckbox.js > > diff --git a/src/Makefile b/src/Makefile > index cd0bf26..3e10e9d 100644 > --- a/src/Makefile > +++ b/src/Makefile > @@ -31,6 +31,7 @@ JSSRC= \ > form/RoleSelector.js \ > form/DiskSelector.js \ > form/MultiDiskSelector.js \ > + form/PBSEncryptionCheckbox.js \ > button/Button.js \ > button/HelpButton.js \ > grid/ObjectGrid.js \ > diff --git a/src/form/PBSEncryptionCheckbox.js b/src/form/PBSEncryptionCheckbox.js > new file mode 100644 > index 0000000..35c6950 > --- /dev/null > +++ b/src/form/PBSEncryptionCheckbox.js > @@ -0,0 +1,63 @@ > +Ext.define('Proxmox.form.PBSEncryptionCheckbox', { > + extend: 'Ext.form.field.Checkbox', > + xtype: 'pbsEncryptionCheckbox', > + > + inputValue: true, > + > + viewModel: { > + data: { > + value: null, > + originalValue: null, > + }, > + formulas: { > + blabel: (get) => { > + let v = get('value'); > + let original = get('originalValue'); > + if (!get('isCreate') && original) { > + if (!v) { > + return gettext('Warning: Existing encryption key will be deleted!'); > + } > + return gettext('Active'); > + } else { > + return gettext('Auto-generate a client encryption key, saved privately on cluster filesystem'); PMG has no cluster filesystem? > + } > + }, > + }, > + }, > + > + bind: { > + value: '{value}', > + boxLabel: '{blabel}', > + }, > + resetOriginalValue: function() { > + let me = this; > + let vm = me.getViewModel(); > + vm.set('originalValue', me.value); > + > + me.callParent(arguments); > + }, > + > + getSubmitData: function() { > + let me = this; > + let val = me.getSubmitValue(); > + if (!me.isCreate) { > + if (val === null) { > + return { 'delete': 'encryption-key' }; > + } else if (val && !!val !== !!me.originalValue) { > + return { 'encryption-key': 'autogen' }; > + } > + } else if (val) { > + return { 'encryption-key': 'autogen' }; > + } > + return null; > + }, > + > + initComponent: function() { > + let me = this; > + me.callParent(); > + > + let vm = me.getViewModel(); > + vm.set('isCreate', me.isCreate); > + }, > +}); > + >