]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
node network view: rework finding free interface ID
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 11 Jan 2023 14:18:10 +0000 (15:18 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 11 Jan 2023 14:18:10 +0000 (15:18 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/node/NetworkView.js

index f79a1ea881a7961825b1d909b2e157fd9cc45f95..6f60965a998bd9ec6166e85bc4aeeb7446849262 100644 (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 = [];