]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: lxc: pass full property name to for-each dev & mountpoint helpers
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Apr 2024 08:59:33 +0000 (10:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Apr 2024 08:59:33 +0000 (10:59 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/Utils.js
www/manager6/lxc/DeviceEdit.js
www/manager6/lxc/MPEdit.js
www/manager6/lxc/Resources.js

index 2c3c56caab4dbd7c04e60d046eb80b8922a1014e..54aa8bacae5e2f91b210f627c987b6cac31e80b6 100644 (file)
@@ -1597,7 +1597,7 @@ Ext.define('PVE.Utils', {
 
     forEachLxcMP: function(func, includeUnused) {
        for (let i = 0; i < PVE.Utils.lxc_mp_counts.mp; i++) {
-           let cont = func('mp', i);
+           let cont = func('mp', i, `mp${i}`);
            if (!cont && cont !== undefined) {
                return;
            }
@@ -1608,7 +1608,7 @@ Ext.define('PVE.Utils', {
        }
 
        for (let i = 0; i < PVE.Utils.lxc_mp_counts.unused; i++) {
-           let cont = func('unused', i);
+           let cont = func('unused', i, `unused${i}`);
            if (!cont && cont !== undefined) {
                return;
            }
@@ -1619,7 +1619,7 @@ Ext.define('PVE.Utils', {
 
     forEachLxcDev: function(func) {
        for (let i = 0; i < PVE.Utils.lxc_dev_count; i++) {
-           let cont = func(i);
+           let cont = func(i, `dev${i}`);
            if (!cont && cont !== undefined) {
                return;
            }
index 845c452c1e7799a4f920a8dd7a91fae19195a345..2e886b38ed677fd0e422e774dea6a79bfee4bf64 100644 (file)
@@ -13,8 +13,7 @@ Ext.define('PVE.lxc.DeviceInputPanel', {
        me.vmconfig = vmconfig;
 
        if (me.isCreate) {
-           PVE.Utils.forEachLxcDev((i) => {
-               let name = "dev" + i.toString();
+           PVE.Utils.forEachLxcDev((i, name) => {
                if (!Ext.isDefined(vmconfig[name])) {
                    me.confid = name;
                    me.down('field[name=devid]').setValue(i);
index 1ea0f10ecf3549d377d120c32d4307c4e46c6ea4..f1db867b8e764536344dcb2c2f629674a61c9272 100644 (file)
@@ -87,8 +87,7 @@ Ext.define('PVE.lxc.MountPointInputPanel', {
        let me = this;
 
        me.updateVMConfig(vmconfig);
-       PVE.Utils.forEachLxcMP((bus, i) => {
-           let name = "mp" + i.toString();
+       PVE.Utils.forEachLxcMP((bus, i, name) => {
            if (!Ext.isDefined(vmconfig[name])) {
                me.down('field[name=mpid]').setValue(i);
                return false;
index 8203d32bc0642e0425d4761cf5682f1c2730dc33..0c77dc60ba3d46d1b4cf64a4d8d16f993b5f6fe9 100644 (file)
@@ -28,7 +28,6 @@ Ext.define('PVE.lxc.RessourceView', {
 
     initComponent: function() {
        var me = this;
-       let confid;
 
        var nodename = me.pveSelNode.data.node;
        if (!nodename) {
@@ -116,8 +115,7 @@ Ext.define('PVE.lxc.RessourceView', {
            },
        };
 
-       PVE.Utils.forEachLxcMP(function(bus, i) {
-           confid = bus + i;
+       PVE.Utils.forEachLxcMP(function(bus, i, confid) {
            var group = 5;
            var header;
            if (bus === 'mp') {
@@ -137,8 +135,7 @@ Ext.define('PVE.lxc.RessourceView', {
 
        let deveditor = Proxmox.UserName === 'root@pam' ? 'PVE.lxc.DeviceEdit' : undefined;
 
-       PVE.Utils.forEachLxcDev(function(i) {
-           confid = 'dev' + i;
+       PVE.Utils.forEachLxcDev(function(i, confid) {
            rows[confid] = {
                group: 7,
                order: i,