[pve-devel] [PATCH pve-manager 2/2] Fix indentation, lint errors and add changes suggested by Dominik

Michael Rasmussen mir at datanom.net
Tue Jun 13 10:32:23 CEST 2017


Signed-off-by: Michael Rasmussen <mir at datanom.net>
---
 www/manager6/Utils.js               |  2 +-
 www/manager6/dc/StorageView.js      | 20 ++++++++++----------
 www/manager6/lxc/ResourceEdit.js    | 16 ++++++++--------
 www/manager6/qemu/Clone.js          |  2 +-
 www/manager6/qemu/HDEdit.js         |  2 +-
 www/manager6/qemu/HDMove.js         |  2 +-
 www/manager6/storage/FreeNASEdit.js | 33 ++++++++++++++++++++-------------
 7 files changed, 42 insertions(+), 35 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index c6227d0..068c784 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -800,7 +800,7 @@ Ext.define('PVE.Utils', { utilities: {
 	} else if (value === 'drbd') {
 	    return 'DRBD';
 	} else if (value === 'freenas') {
-        return 'FreeNAS';
+            return 'FreeNAS';
     } else {
 	    return PVE.Utils.unknownText;
 	}
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index c16d464..586d4a9 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -59,7 +59,7 @@ Ext.define('PVE.dc.StorageView', {
 	    } else if (type === 'zfspool') {
 		editor = 'PVE.storage.ZFSPoolEdit';
 	    } else if (type === 'freenas') {
-        editor = 'PVE.storage.FreeNASEdit';
+                editor = 'PVE.storage.FreeNASEdit';
         } else {
 		return;
 	    }
@@ -194,15 +194,15 @@ Ext.define('PVE.dc.StorageView', {
                                     win.show();
                                 }
                             },
-                {
-                    text: PVE.Utils.format_storage_type('freenas'),
-                    iconCls: 'fa fa-fw fa-building',
-                    handler: function() {
-                        var win = Ext.create('PVE.storage.FreeNASEdit', {});
-                        win.on('destroy', reload);
-                        win.show();
-                    }
-                }
+                            {
+                                text: PVE.Utils.format_storage_type('freenas'),
+                                iconCls: 'fa fa-fw fa-building',
+                                handler: function() {
+                                    var win = Ext.create('PVE.storage.FreeNASEdit', {});
+                                    win.on('destroy', reload);
+                                    win.show();
+                                }
+                            }
 
 /* the following type are conidered unstable
  * so we do not enable that on the GUI for now
diff --git a/www/manager6/lxc/ResourceEdit.js b/www/manager6/lxc/ResourceEdit.js
index 8bc3e76..4336d86 100644
--- a/www/manager6/lxc/ResourceEdit.js
+++ b/www/manager6/lxc/ResourceEdit.js
@@ -388,7 +388,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
 		    var rec = f.store.getById(value);
 		    if (rec.data.type === 'zfs' ||
 		        rec.data.type === 'zfspool' ||
-                rec.data.type === 'freenas') {
+                        rec.data.type === 'freenas') {
 			me.quota.setDisabled(true);
 			me.quota.setValue(false);
 		    } else {
@@ -403,13 +403,13 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
 			me.hdfilesel.setVisible(true);
 			me.hdsizesel.setDisabled(true);
 			me.hdsizesel.setVisible(false);
-		    } else if (rec.data.type === 'lvm' ||
-			       rec.data.type === 'lvmthin' ||
-			       rec.data.type === 'rbd' ||
-			       rec.data.type === 'sheepdog' ||
-			       rec.data.type === 'zfs' ||
-			       rec.data.type === 'zfspool' ||
-                   rec.data.type === 'freenas') {
+                    } else if (rec.data.type === 'lvm' ||
+                               rec.data.type === 'lvmthin' ||
+                               rec.data.type === 'rbd' ||
+                               rec.data.type === 'sheepdog' ||
+                               rec.data.type === 'zfs' ||
+                               rec.data.type === 'zfspool' ||
+                               rec.data.type === 'freenas') {
 			me.hdfilesel.setDisabled(true);
 			me.hdfilesel.setVisible(false);
 			me.hdsizesel.setDisabled(false);
diff --git a/www/manager6/qemu/Clone.js b/www/manager6/qemu/Clone.js
index 9de9777..0dbae3b 100644
--- a/www/manager6/qemu/Clone.js
+++ b/www/manager6/qemu/Clone.js
@@ -117,7 +117,7 @@ Ext.define('PVE.window.Clone', {
 		rec.data.type === 'sheepdog' ||
 		rec.data.type === 'zfs' ||
 		rec.data.type === 'zfspool' ||
-        rec.data.type === 'freenas'
+                rec.data.type === 'freenas'
 	) {
 	    formatsel.setValue('raw');
 	    formatsel.setDisabled(true);
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 6920c0d..69fc047 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -47,7 +47,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 			       rec.data.type === 'sheepdog' ||
 			       rec.data.type === 'zfs' ||
 			       rec.data.type === 'zfspool' ||
-                   rec.data.type === 'freenas') {
+                               rec.data.type === 'freenas') {
 			me.hdfilesel.setDisabled(true);
 			me.hdfilesel.setVisible(false);
 			me.formatsel.setValue('raw');
diff --git a/www/manager6/qemu/HDMove.js b/www/manager6/qemu/HDMove.js
index 4e69aa7..6caf34b 100644
--- a/www/manager6/qemu/HDMove.js
+++ b/www/manager6/qemu/HDMove.js
@@ -81,7 +81,7 @@ Ext.define('PVE.window.HDMove', {
 			    rec.data.type === 'sheepdog' ||
 			    rec.data.type === 'zfs' ||
 			    rec.data.type === 'zfspool' ||
-                rec.data.type === 'freenas'
+                            rec.data.type === 'freenas'
                         ) {
                             me.formatsel.setValue('raw');
                             me.formatsel.setDisabled(true);
diff --git a/www/manager6/storage/FreeNASEdit.js b/www/manager6/storage/FreeNASEdit.js
index 5cc9f28..cad51ff 100644
--- a/www/manager6/storage/FreeNASEdit.js
+++ b/www/manager6/storage/FreeNASEdit.js
@@ -6,7 +6,7 @@ Ext.define('PVE.storage.FreeNASInputPanel', {
 
 	if (me.isCreate) {
 	    values.type = 'freenas';
-	    values.content = 'images';
+	    values.content = 'rootdir, images';
 	} else {
 	    delete values.storage;
 	}
@@ -14,6 +14,10 @@ Ext.define('PVE.storage.FreeNASInputPanel', {
 	values.disable = values.enable ? 0 : 1;
 	delete values.enable;
 
+        if (values.password === '') {
+            delete values.password;
+        }
+
 	return values;
     },
 
@@ -56,7 +60,7 @@ Ext.define('PVE.storage.FreeNASInputPanel', {
 		value: '',
 		fieldLabel: gettext('Initiator Group ID'),
 		allowBlank: false
-	    },
+	    }
 	];
 
 	me.column2 = [
@@ -67,13 +71,14 @@ Ext.define('PVE.storage.FreeNASInputPanel', {
 		uncheckedValue: 0,
 		fieldLabel: gettext('Enable')
 	    },
-/*        {
-        xtype: 'textfield',
-        name: 'blocksize',
-        emptyText: '8k',
-        fieldLabel: gettext('Block Size'),
-        allowBlank: true
-        },*/
+/* This setting is first available in the API with next stable release
+            {
+                xtype: 'textfield',
+                name: 'blocksize',
+                emptyText: '8k',
+                fieldLabel: gettext('Block Size'),
+                allowBlank: true
+            },*/
 	    {
 		xtype: 'textfield',
 		name: 'username',
@@ -85,10 +90,10 @@ Ext.define('PVE.storage.FreeNASInputPanel', {
 		xtype: 'textfield',
 		name: 'password',
 		emptyText: '',
-        inputType: 'password',
+                inputType: 'password',
 		fieldLabel: gettext('Password'),
-		allowBlank: false
-	    },
+		allowBlank: true
+	    }
 	];
 
 	if (me.isCreate || me.storageId !== 'local') {
@@ -129,7 +134,7 @@ Ext.define('PVE.storage.FreeNASEdit', {
 	});
 
 	Ext.apply(me, {
-            subject: 'FreeNAS Storage',
+            subject: PVE.Utils.format_storage_type('freenas'),
 	    isAdd: true,
 	    items: [ ipanel ]
 	});
@@ -144,6 +149,8 @@ Ext.define('PVE.storage.FreeNASEdit', {
                         values.nodes = values.nodes.split(',');
                     }
                     values.enable = values.disable ? 0 : 1;
+                    delete values.password;
+
                     ipanel.setValues(values);
                 }
             });
-- 
2.1.4


----

This mail was virus scanned and spam checked before delivery.
This mail is also DKIM signed. See header dkim-signature.




More information about the pve-devel mailing list