[pve-devel] r6279 - in pve-manager/pve2/www/manager: . qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Jul 8 16:05:15 CEST 2011


Author: dietmar
Date: 2011-07-08 16:05:15 +0200 (Fri, 08 Jul 2011)
New Revision: 6279

Modified:
   pve-manager/pve2/www/manager/PVEUtils.js
   pve-manager/pve2/www/manager/qemu/Config.js
   pve-manager/pve2/www/manager/qemu/CreateWizard.js
   pve-manager/pve2/www/manager/qemu/Options.js
Log:
make lint happy


Modified: pve-manager/pve2/www/manager/PVEUtils.js
===================================================================
--- pve-manager/pve2/www/manager/PVEUtils.js	2011-07-08 12:41:12 UTC (rev 6278)
+++ pve-manager/pve2/www/manager/PVEUtils.js	2011-07-08 14:05:15 UTC (rev 6279)
@@ -251,14 +251,13 @@
 
     assemble_field_data: function(values, data) {
         if (Ext.isObject(data)) {
-            Ext.iterate(data, function(name, val) {
-                if (values.hasOwnProperty[name]) {
-                    var bucket = values[name],
-                    isArray = Ext.isArray;
-                    if (!isArray(bucket)) {
+	    Ext.Object.each(data, function(name, val) {
+                if (values.hasOwnProperty(name)) {
+                    var bucket = values[name];
+                    if (!Ext.isArray(bucket)) {
                         bucket = values[name] = [bucket];
                     }
-                    if (isArray(val)) {
+                    if (Ext.isArray(val)) {
                         values[name] = bucket.concat(val);
                     } else {
                         bucket.push(val);

Modified: pve-manager/pve2/www/manager/qemu/Config.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Config.js	2011-07-08 12:41:12 UTC (rev 6278)
+++ pve-manager/pve2/www/manager/qemu/Config.js	2011-07-08 14:05:15 UTC (rev 6279)
@@ -6,12 +6,14 @@
         var me = this;
 
 	var nodename = me.pveSelNode.data.node;
-	if (!nodename) 
+	if (!nodename) {
 	    throw "no node name specified";
+	}
 
 	var vmid = me.pveSelNode.data.vmid;
-	if (!vmid) 
+	if (!vmid) {
 	    throw "no VM ID specified";
+	}
 
 	var vmname = me.pveSelNode.data.name;
 	var descr = vmname ? "'" + vmname + "' " : '';

Modified: pve-manager/pve2/www/manager/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/CreateWizard.js	2011-07-08 12:41:12 UTC (rev 6278)
+++ pve-manager/pve2/www/manager/qemu/CreateWizard.js	2011-07-08 14:05:15 UTC (rev 6279)
@@ -87,21 +87,25 @@
 			    fieldLabel: 'VM ID',
 			    allowBlank: false,
 			    validator: function(value) {
-				if (!PVE.data.ResourceStore.findVMID(value))
+				/*jslint confusion: true */
+				if (!PVE.data.ResourceStore.findVMID(value)) {
 				    return true;
-				return "This VM ID is already in use."
+				}
+				return "This VM ID is already in use.";
 			    }
 			},
 			{
 			    xtype: 'textfield',
 			    name: 'name',
+			    value: '',
 			    fieldLabel: 'VM name',
 			    allowBlank: true
 			}
 		    ],
 		    onGetValues: function(values) {
-			if (!values.name)
+			if (!values.name) {
 			    delete values.name;
+			}
 			return values;
 		    }
 		},
@@ -112,7 +116,7 @@
 		    layout: 'column',
 		    defaultType: 'container',
 		    items: [{
-			columnWidth: .5,
+			columnWidth: 0.5,
 			items: [
 			    {
 				xtype: 'component', 
@@ -145,7 +149,7 @@
 			    }
 			]
 		    },{
-			columnWidth: .5,
+			columnWidth: 0.5,
 			items: [
 			    {
 				xtype: 'component', 
@@ -207,10 +211,11 @@
 			}
 		    ],
 		    onGetValues: function(values) {
-			if (values.mediaType === 'iso')
+			if (values.mediaType === 'iso') {
 			    return { cdrom: values.cdimage };
-			if (values.mediaType === 'cdrom')
+			} else if (values.mediaType === 'cdrom') {
 			    return { cdrom: 'cdrom' };
+			}
 			return { cdrom: 'none' };
 		    }
 		},
@@ -248,7 +253,7 @@
 			    labelAlign: 'right',
 			    minValue: 1,
 			    maxValue: 128*1024,
-			    value: 32,
+			    value: '32',
 			    fieldLabel: 'Disk size (GB)',
 			    allowBlank: false
 			},
@@ -268,13 +273,13 @@
 			}
 		    ],
 		    onGetValues: function(values) {
-			if (values.hdType === 'none')
+			if (values.hdType === 'none') {
 			    return {};
+			}
 
 			var str = values.hdstorage + ':' + values.disksize +
 			    ',format=' + values.diskformat;
-			var busid = 0;
-			var key = values.controller + "" + busid;
+			var key = values.controller + "0";
 			var res = {};
 			res[key] = str;
 			return res;
@@ -289,7 +294,7 @@
 			    name: 'sockets',
 			    minValue: 1,
 			    maxValue: 4,
-			    value: 1,
+			    value: '1',
 			    fieldLabel: 'Sockets',
 			    allowBlank: false,
 			    listeners: {
@@ -305,7 +310,7 @@
 			    name: 'cores',
 			    minValue: 1,
 			    maxValue: 32,
-			    value: 1,
+			    value: '1',
 			    fieldLabel: 'Cores',
 			    allowBlank: false,
 			    listeners: {
@@ -322,7 +327,7 @@
 			    xtype: 'displayfield',
 			    fieldLabel: 'Total cores',
 			    name: 'totalcores',
-			    value: 1
+			    value: '1'
 			}
 		    ]
 		},
@@ -335,7 +340,7 @@
 			    name: 'memory',
 			    minValue: 32,
 			    maxValue: 128*1024,
-			    value: 512,
+			    value: '512',
 			    step: 32,
 			    fieldLabel: 'Memory (MB)',
 			    allowBlank: false
@@ -355,8 +360,9 @@
 			    checked: true,
 			    listeners: {
 				change: function(f, value) {
-				    if (!me.rendered)
+				    if (!me.rendered) {
 					return;
+				    }
 				    me.down('field[name=bridge]').setDisabled(!value);
 				    me.down('field[name=bridge]').validate();
 				}
@@ -397,15 +403,18 @@
 		    ],
 
 		    onGetValues: function(values) {
-			if (values.networkmode === 'none')
+			if (values.networkmode === 'none') {
 			    return {};
+			}
 
 			var str = values.netcard;
-			if (values.mac)
+			if (values.mac) {
 			    str += '=' + values.mac;
+			}
 
-			if (values.networkmode === 'bridge')
+			if (values.networkmode === 'bridge') {
 			    str += ',bridge=' + values.bridge;
+			}
 
 			return { net0: str };
 		    }
@@ -428,6 +437,7 @@
 			show: function(panel) {
 			    var form = me.down('form').getForm();
 			    var kv = me.getValues();
+			    console.dir(kv);
 			    var data = [];
 			    Ext.Object.each(kv, function(key, value) {
 				var html = Ext.htmlEncode(Ext.JSON.encode(value));

Modified: pve-manager/pve2/www/manager/qemu/Options.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Options.js	2011-07-08 12:41:12 UTC (rev 6278)
+++ pve-manager/pve2/www/manager/qemu/Options.js	2011-07-08 14:05:15 UTC (rev 6279)
@@ -1,3 +1,4 @@
+/*jslint confusion: true */
 Ext.define('PVE.qemu.Options', {
     extend: 'PVE.grid.ObjectGrid',
     alias: ['widget.PVE.qemu.Options'],
@@ -7,12 +8,14 @@
 	var i;
 
 	var nodename = me.pveSelNode.data.node;
-	if (!nodename) 
+	if (!nodename) {
 	    throw "no node name specified";
+	}
 
 	var vmid = me.pveSelNode.data.vmid;
-	if (!vmid) 
+	if (!vmid) {
 	    throw "no VM ID specified";
+	}
 
 	var rows = {
 	    name: {




More information about the pve-devel mailing list