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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5D755766E5 for ; Fri, 23 Apr 2021 12:15:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EA54C276FA for ; Fri, 23 Apr 2021 12:15:18 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 8533D27656 for ; Fri, 23 Apr 2021 12:15:15 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B998742620 for ; Fri, 23 Apr 2021 12:15:05 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Fri, 23 Apr 2021 12:14:58 +0200 Message-Id: <20210423101501.27300-9-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210423101501.27300-1-f.ebner@proxmox.com> References: <20210423101501.27300-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH widget-toolkit 08/11] disk list: move title bar initialization to initComponent X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 10:15:19 -0000 to conditionally add more buttons later on. Signed-off-by: Fabian Ebner --- src/panel/DiskList.js | 80 ++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/src/panel/DiskList.js b/src/panel/DiskList.js index 10cf840..c6f1638 100644 --- a/src/panel/DiskList.js +++ b/src/panel/DiskList.js @@ -206,42 +206,6 @@ Ext.define('Proxmox.DiskList', { return v ? `${v}${extendedInfo}` : Proxmox.Utils.noText; }, - tbar: [ - { - text: gettext('Reload'), - handler: 'reload', - }, - { - xtype: 'proxmoxButton', - text: gettext('Show S.M.A.R.T. values'), - parentXType: 'treepanel', - disabled: true, - enableFn: function(rec) { - if (!rec || rec.data.parent) { - return false; - } else { - return true; - } - }, - handler: 'openSmartWindow', - }, - { - xtype: 'proxmoxButton', - text: gettext('Initialize Disk with GPT'), - parentXType: 'treepanel', - disabled: true, - enableFn: function(rec) { - if (!rec || rec.data.parent || - (rec.data.used && rec.data.used !== 'unused')) { - return false; - } else { - return true; - } - }, - handler: 'initGPT', - }, - ], - columns: [ { xtype: 'treecolumn', @@ -332,4 +296,48 @@ Ext.define('Proxmox.DiskList', { listeners: { itemdblclick: 'openSmartWindow', }, + + initComponent: function() { + let me = this; + + let tbar = [ + { + text: gettext('Reload'), + handler: 'reload', + }, + { + xtype: 'proxmoxButton', + text: gettext('Show S.M.A.R.T. values'), + parentXType: 'treepanel', + disabled: true, + enableFn: function(rec) { + if (!rec || rec.data.parent) { + return false; + } else { + return true; + } + }, + handler: 'openSmartWindow', + }, + { + xtype: 'proxmoxButton', + text: gettext('Initialize Disk with GPT'), + parentXType: 'treepanel', + disabled: true, + enableFn: function(rec) { + if (!rec || rec.data.parent || + (rec.data.used && rec.data.used !== 'unused')) { + return false; + } else { + return true; + } + }, + handler: 'initGPT', + }, + ]; + + me.tbar = tbar; + + me.callParent(); + }, }); -- 2.20.1