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) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1E1FA73D09 for ; Fri, 16 Apr 2021 16:56:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0C61F272A6 for ; Fri, 16 Apr 2021 16:56:24 +0200 (CEST) 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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 9611627297 for ; Fri, 16 Apr 2021 16:56:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 62F5C45AFE for ; Fri, 16 Apr 2021 16:56:19 +0200 (CEST) Message-ID: <90633710-e22f-66dc-2e77-9e8d6979a4ec@proxmox.com> Date: Fri, 16 Apr 2021 16:56:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Thunderbird/88.0 Content-Language: en-US To: Proxmox VE development discussion , Aaron Lauterer References: <20210416141026.19499-1-a.lauterer@proxmox.com> From: Thomas Lamprecht In-Reply-To: <20210416141026.19499-1-a.lauterer@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.040 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 -0.001 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 manager] ui: RBDStorage: add field for RBD namespace 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: Fri, 16 Apr 2021 14:56:24 -0000 On 16.04.21 16:10, Aaron Lauterer wrote: > Makes it possible to configure the RBD namespace via the GUI. > > RBD namespaces must be configured manually. The most likely use case is > when connecting to an external Ceph cluster as this makes it possible to > separate client PVE clusters by namespace, not by pool. > > Signed-off-by: Aaron Lauterer > --- > Right now the warning field is below the checkbox to select between > external or hyperconverged ceph. > > I wasn't sure which position would be better. Above that checkbox or > directly below the namespace field (same column)? > > www/manager6/storage/RBDEdit.js | 56 +++++++++++++++++++++++++-------- > 1 file changed, 43 insertions(+), 13 deletions(-) > > diff --git a/www/manager6/storage/RBDEdit.js b/www/manager6/storage/RBDEdit.js > index be29dc8a..fad9305b 100644 > --- a/www/manager6/storage/RBDEdit.js > +++ b/www/manager6/storage/RBDEdit.js > @@ -5,6 +5,7 @@ Ext.define('PVE.storage.Ceph.Model', { > data: { > pveceph: true, > pvecephPossible: true, > + namespacePresent: false, > }, > }); > > @@ -26,10 +27,18 @@ Ext.define('PVE.storage.Ceph.Controller', { > disable: 'resetField', > enable: 'resetField', > }, > + 'textfield[name=namespace]': { > + change: 'updateNamespaceHint', > + }, > }, > resetField: function(field) { > field.reset(); > }, > + updateNamespaceHint(field, newVal, oldVal) { why isn't this a function like the others? > + var vm = this.getViewModel(); > + let namespacePresent = newVal? true : false; we really need to get eslint pronto for pve-manager, as it would complain about above :) A ternary resolving to bool almost never makes sense. The whole thing can be updateNamespaceHint: function(field, newVal, oldVal) { this.getViewModel().set('namespacePresent', newVal); } > + vm.set('namespacePresent', namespacePresent); > + }, > queryMonitors: function(field, newVal, oldVal) { > // we get called with two signatures, the above one for a field > // change event and the afterrender from the view, this check only > @@ -88,6 +97,9 @@ Ext.define('PVE.storage.RBDInputPanel', { > this.lookupReference('pvecephRef').setValue(false); > this.lookupReference('pvecephRef').resetOriginalValue(); > } > + if (values.namespace) { > + this.viewModel.set('namespacePresent', true); use the getter for the view model, like you do already above in updateNamespaceHint: this.getViewModel().set(...) > + } > this.callParent([values]); > }, > > @@ -170,6 +182,13 @@ Ext.define('PVE.storage.RBDInputPanel', { > fieldLabel: gettext('User name'), > allowBlank: true, > }, > + { > + xtype: me.isCreate ? 'textfield' : 'displayfield', you could use a 'pmxDisplayEditField' instead > + name: 'namespace', > + value: '', > + fieldLabel: gettext('Namespace'), > + allowBlank: true, > + }, > ); > > me.column2 = [ > @@ -190,20 +209,31 @@ Ext.define('PVE.storage.RBDInputPanel', { > }, > ]; > > - me.columnB = [{ > - xtype: 'proxmoxcheckbox', > - name: 'pveceph', > - reference: 'pvecephRef', > - bind: { > - disabled: '{!pvecephPossible}', > - value: '{pveceph}', > + me.columnB = [ > + { > + xtype: 'proxmoxcheckbox', > + name: 'pveceph', > + reference: 'pvecephRef', > + bind: { > + disabled: '{!pvecephPossible}', > + value: '{pveceph}', > + }, > + checked: true, > + uncheckedValue: 0, > + submitValue: false, > + hidden: !me.isCreate, > + boxLabel: gettext('Use Proxmox VE managed hyper-converged ceph pool'), > + }, > + { > + xtype: 'displayfield', > + name: 'namespace-hint', > + userCls: 'pmx-hint', > + value: gettext('RBD namespaces must be created manually!'), > + bind: { > + hidden: '{!namespacePresent}', > + }, Alternatively we could probe the rbd storage if the namespace is present on submit? I.e., do the RADOS command equivalent to `rbd namespace list -p }, > - checked: true, > - uncheckedValue: 0, > - submitValue: false, > - hidden: !me.isCreate, > - boxLabel: gettext('Use Proxmox VE managed hyper-converged ceph pool'), > - }]; > + ]; > > me.callParent(); > }, >