[pve-devel] r5926 - in pve-manager/pve2/www/new: data qemu

svn-commits at proxmox.com svn-commits at proxmox.com
Mon May 9 07:31:26 CEST 2011


Author: dietmar
Date: 2011-05-09 07:31:26 +0200 (Mon, 09 May 2011)
New Revision: 5926

Modified:
   pve-manager/pve2/www/new/data/ResourceStore.js
   pve-manager/pve2/www/new/qemu/CreateWizard.js
Log:
impl. VMID validator


Modified: pve-manager/pve2/www/new/data/ResourceStore.js
===================================================================
--- pve-manager/pve2/www/new/data/ResourceStore.js	2011-05-09 04:49:11 UTC (rev 5925)
+++ pve-manager/pve2/www/new/data/ResourceStore.js	2011-05-09 05:31:26 UTC (rev 5926)
@@ -7,11 +7,17 @@
 	var me = this, i;
 	
 	for (i = 100; i < 10000; i++) {
-	    if (!me.find('vmid', i))
+	    if (me.findExact('vmid', i) < 0)
 		return i;
 	}
     },
 
+    findVMID: function(vmid) {
+	var me = this, i;
+	
+	return (me.findExact('vmid', parseInt(vmid)) >= 0);
+    },
+
     constructor: function(config) {
 	var me = this;
 

Modified: pve-manager/pve2/www/new/qemu/CreateWizard.js
===================================================================
--- pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-09 04:49:11 UTC (rev 5925)
+++ pve-manager/pve2/www/new/qemu/CreateWizard.js	2011-05-09 05:31:26 UTC (rev 5926)
@@ -76,7 +76,12 @@
 			    minValue: 100,
 			    maxValue: 999999999,
 			    fieldLabel: 'VM ID',
-			    allowBlank: false
+			    allowBlank: false,
+			    validator: function(value) {
+				if (!PVE.data.ResourceStore.findVMID(value))
+				    return true;
+				return "This VM ID is already in use."
+			    }
 			},
 			{
 			    xtype: 'textfield',




More information about the pve-devel mailing list