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 1126F956A4 for ; Wed, 18 Jan 2023 14:13:10 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C64A1202DF for ; Wed, 18 Jan 2023 14:13:09 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Wed, 18 Jan 2023 14:13:08 +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 9B39845122 for ; Wed, 18 Jan 2023 14:13:05 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Wed, 18 Jan 2023 14:13:02 +0100 Message-Id: <20230118131303.2892050-8-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230118131303.2892050-1-d.csapak@proxmox.com> References: <20230118131303.2892050-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 5/6] ui: storage/ZFSPoolInputPanel: modernize & cleanup code 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, 18 Jan 2023 13:13:10 -0000 using cbind + pmxDisplayEditField, getting rid of initComponent Signed-off-by: Dominik Csapak --- www/manager6/storage/ZFSPoolEdit.js | 77 +++++++++++++---------------- 1 file changed, 35 insertions(+), 42 deletions(-) diff --git a/www/manager6/storage/ZFSPoolEdit.js b/www/manager6/storage/ZFSPoolEdit.js index df12fbbc8..f4c8894e5 100644 --- a/www/manager6/storage/ZFSPoolEdit.js +++ b/www/manager6/storage/ZFSPoolEdit.js @@ -56,38 +56,32 @@ Ext.define('PVE.storage.ZFSPoolSelector', { Ext.define('PVE.storage.ZFSPoolInputPanel', { extend: 'PVE.panel.StorageBase', + mixins: ['Proxmox.Mixin.CBind'], onlineHelp: 'storage_zfspool', - initComponent: function() { - let me = this; + column1: [ + { + xtype: 'pmxDisplayEditField', + cbind: { + editable: '{isCreate}', + }, - me.column1 = []; + name: 'pool', + fieldLabel: gettext('ZFS Pool'), + allowBlank: false, - if (me.isCreate) { - me.column1.push(Ext.create('PVE.storage.ZFSPoolSelector', { - name: 'pool', - fieldLabel: gettext('ZFS Pool'), + editConfig: { + xtype: 'pveZFSPoolSelector', reference: 'zfsPoolSelector', - allowBlank: false, listeners: { nodechanged: function(value) { - me.lookup('storageNodeRestriction').setValue(value); + this.up('inputpanel').lookup('storageNodeRestriction').setValue(value); }, }, - })); - } else { - me.column1.push(Ext.createWidget('displayfield', { - name: 'pool', - value: '', - fieldLabel: gettext('ZFS Pool'), - allowBlank: false, - })); - } - - // value is an array, - // while before it was a string - me.column1.push({ + }, + }, + { xtype: 'pveContentTypeSelector', cts: ['images', 'rootdir'], fieldLabel: gettext('Content'), @@ -95,24 +89,23 @@ Ext.define('PVE.storage.ZFSPoolInputPanel', { value: ['images', 'rootdir'], multiSelect: true, allowBlank: false, - }); - me.column2 = [ - { - xtype: 'proxmoxcheckbox', - name: 'sparse', - checked: false, - uncheckedValue: 0, - fieldLabel: gettext('Thin provision'), - }, - { - xtype: 'textfield', - name: 'blocksize', - emptyText: '8k', - fieldLabel: gettext('Block Size'), - allowBlank: true, - }, - ]; - - me.callParent(); - }, + } + ], + + column2: [ + { + xtype: 'proxmoxcheckbox', + name: 'sparse', + checked: false, + uncheckedValue: 0, + fieldLabel: gettext('Thin provision'), + }, + { + xtype: 'textfield', + name: 'blocksize', + emptyText: '8k', + fieldLabel: gettext('Block Size'), + allowBlank: true, + }, + ], }); -- 2.30.2