mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 03:07:02 +00:00
Utils: add forEachMP
in the style of forEachBus, but for containers, so that we only have to save the count once Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
53395db153
commit
14a845bc7b
@ -963,6 +963,29 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mp_counts: { mps: 10, unused: 10 },
|
||||||
|
|
||||||
|
forEachMP: function(func, includeUnused) {
|
||||||
|
var i, cont;
|
||||||
|
for (i = 0; i < PVE.Utils.mp_counts.mps; i++) {
|
||||||
|
cont = func('mp', i);
|
||||||
|
if (!cont && cont !== undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!includeUnused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < PVE.Utils.mp_counts.unused; i++) {
|
||||||
|
cont = func('unused', i);
|
||||||
|
if (!cont && cont !== undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -90,25 +90,21 @@ Ext.define('PVE.lxc.RessourceView', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < 10; i++) {
|
PVE.Utils.forEachMP(function(bus, i) {
|
||||||
confid = "mp" + i;
|
confid = bus + i;
|
||||||
|
var header;
|
||||||
|
if (bus === 'mp') {
|
||||||
|
header = gettext('Mount Point') + ' (' + confid + ')';
|
||||||
|
} else {
|
||||||
|
header = gettext('Unused Disk') + ' ' + i;
|
||||||
|
}
|
||||||
rows[confid] = {
|
rows[confid] = {
|
||||||
group: 1,
|
group: 1,
|
||||||
tdCls: 'pve-itype-icon-storage',
|
tdCls: 'pve-itype-icon-storage',
|
||||||
editor: mpeditor,
|
editor: mpeditor,
|
||||||
header: gettext('Mount Point') + ' (' + confid + ')'
|
header: header
|
||||||
};
|
};
|
||||||
}
|
}, true);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
|
||||||
confid = "unused" + i;
|
|
||||||
rows[confid] = {
|
|
||||||
group: 1,
|
|
||||||
tdCls: 'pve-itype-icon-storage',
|
|
||||||
editor: mpeditor,
|
|
||||||
header: gettext('Unused Disk') + ' ' + i
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var baseurl = 'nodes/' + nodename + '/lxc/' + vmid + '/config';
|
var baseurl = 'nodes/' + nodename + '/lxc/' + vmid + '/config';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user