]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: utils: add nextFreeMP
authorAaron Lauterer <a.lauterer@proxmox.com>
Tue, 5 Apr 2022 12:30:13 +0000 (14:30 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 7 Apr 2022 13:32:44 +0000 (15:32 +0200)
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
www/manager6/Utils.js

index 3351e53b21f3040ae22e4d69495cf52524ae3011..fe5be283a6a5e038ca2f498b8fecd67b5f13c8f9 100644 (file)
@@ -1800,6 +1800,21 @@ Ext.define('PVE.Utils', {
 
        return undefined;
     },
+
+    nextFreeMP: function(type, config) {
+       for (let i = 0; i < PVE.Utils.mp_counts[type]; i++) {
+           let confid = `${type}${i}`;
+           if (!Ext.isDefined(config[confid])) {
+               return {
+                   type,
+                   id: i,
+                   confid,
+               };
+           }
+       }
+
+       return undefined;
+    },
 },
 
     singleton: true,