[pve-devel] [PATCH manager 5/6] ui: storage/ZFSPoolInputPanel: modernize & cleanup code
Dominik Csapak
d.csapak at proxmox.com
Wed Jan 18 14:13:02 CET 2023
using cbind + pmxDisplayEditField, getting rid of initComponent
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
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
More information about the pve-devel
mailing list