node network view: rework finding free interface ID

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-01-11 15:18:10 +01:00
parent 13220ad1f5
commit bcd21f899e

View File

@ -151,13 +151,14 @@ Ext.define('Proxmox.node.NetworkView', {
};
let find_next_iface_id = function(prefix) {
let next;
for (next = 0; next <= 9999; next++) {
if (!store.getById(prefix + next.toString())) {
break;
for (let next = 0; next <= 9999; next++) {
let id = `${prefix}${next.toString()}`;
if (!store.getById(id)) {
return id;
}
}
return prefix + next.toString();
Ext.Msg.alert('Error', `No free ID for ${prefix} found!`);
return '';
};
let menu_items = [];