]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
node: repo: avoid using IDs on elements, as that breaks easily on clusters
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 3 Jul 2021 14:06:14 +0000 (16:06 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 3 Jul 2021 14:06:17 +0000 (16:06 +0200)
Anything where more instances can exist, even if only for a very
short time, must NOT use `id` as that needs to be unique in all
current instances of components/elements of the whole gui.

Here it broke most of the gui when switching between node, as the new
nodes repo gui was instantiated before the old ones was completely
destroyed, so there where (at least) two elements with the same id ->
💥 boom.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/node/APTRepositories.js

index 87ac0226aa08c4a155927df444667f5bfbdde03c..c4848a0090005913b60dc875fb568775b2bf153d 100644 (file)
@@ -159,7 +159,7 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
        },
        {
            text: gettext('Add'),
-           id: 'addButton',
+           name: 'addRepo',
            disabled: true,
            repoInfo: undefined,
            handler: function(button, event, record) {
@@ -192,7 +192,7 @@ Ext.define('Proxmox.node.APTRepositoriesGrid', {
            text: gettext('Enable'),
            defaultText: gettext('Enable'),
            altText: gettext('Disable'),
-           id: 'repoEnableButton',
+           name: 'repoEnable',
            disabled: true,
            bind: {
                text: '{enableButtonText}',
@@ -602,9 +602,9 @@ Ext.define('Proxmox.node.APTRepositories', {
        let me = this;
        let vm = me.getViewModel();
 
-       let addButton = me.down('#addButton');
-       addButton.repoInfo = [];
+       let addButton = me.down('button[name=addRepo]');
 
+       addButton.repoInfo = [];
        for (const standardRepo of standardRepos) {
            const handle = standardRepo.handle;
            const status = standardRepo.status;