From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 77ABE6B777 for ; Wed, 17 Mar 2021 11:47:34 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6BF952C465 for ; Wed, 17 Mar 2021 11:47:34 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 350C72C458 for ; Wed, 17 Mar 2021 11:47:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F282C426F8 for ; Wed, 17 Mar 2021 11:47:32 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 17 Mar 2021 11:47:32 +0100 Message-Id: <20210317104732.29276-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210317104732.29276-1-d.csapak@proxmox.com> References: <20210317104732.29276-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.185 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 2/2] ui: tape/DriveStatus: fix updating pointer+click handler on info widget X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:47:34 -0000 we can only do this after it is rendered, the element does not exist before Signed-off-by: Dominik Csapak --- www/tape/DriveStatus.js | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/www/tape/DriveStatus.js b/www/tape/DriveStatus.js index b529a9af..38cddaaf 100644 --- a/www/tape/DriveStatus.js +++ b/www/tape/DriveStatus.js @@ -469,17 +469,38 @@ Ext.define('PBS.TapeManagement.DriveInfoPanel', { let vm = me.getViewModel(); vm.set('drive', record.data); + vm.notify(); + me.updatePointer(); + }, + + updatePointer: function() { + let me = this; let stateWidget = me.down('pmxInfoWidget[reference=statewidget]'); let stateEl = stateWidget.getEl(); - stateEl.removeListener('click', me.clickState); - if (record.data.state) { - stateEl.on('click', me.clickState, me); + if (!stateEl) { + setTimeout(function() { + me.updatePointer(); + }, 100); + return; + } + + let vm = me.getViewModel(); + let drive = vm.get('drive'); + + if (drive.state) { stateEl.addCls('info-pointer'); } else { stateEl.removeCls('info-pointer'); } + }, - vm.notify(); + listeners: { + afterrender: function() { + let me = this; + let stateWidget = me.down('pmxInfoWidget[reference=statewidget]'); + let stateEl = stateWidget.getEl(); + stateEl.on('click', me.clickState, me); + }, }, initComponent: function() { @@ -488,12 +509,12 @@ Ext.define('PBS.TapeManagement.DriveInfoPanel', { throw "no drive given"; } + me.callParent(); + let tapeStore = Ext.ComponentQuery.query('navigationtree')[0].tapestore; me.mon(tapeStore, 'load', me.updateData, me); if (tapeStore.isLoaded()) { me.updateData(tapeStore); } - - me.callParent(); }, }); -- 2.20.1