From cea4e924e70abd48e55bfcb62997bb99c9d3b6a4 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 24 Oct 2017 11:30:52 +0200 Subject: [PATCH] js/ServerAdministration.js - enable upgrade button inside controller init Because Proxmox.UserName may not be set at class load time. --- js/ServerAdministration.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/ServerAdministration.js b/js/ServerAdministration.js index 15e5a2e..8f09360 100644 --- a/js/ServerAdministration.js +++ b/js/ServerAdministration.js @@ -8,6 +8,15 @@ Ext.define('PMG.ServerAdministration', { border: false, defaults: { border: false }, + controller: { + xclass: 'Ext.app.ViewController', + + init: function(view) { + var upgradeBtn = view.lookupReference('upgradeBtn'); + upgradeBtn.setDisabled(!(Proxmox.UserName && Proxmox.UserName === 'root@pam')); + } + }, + items: [ { xtype: 'pmgServerStatus', @@ -29,7 +38,8 @@ Ext.define('PMG.ServerAdministration', { title: gettext('Updates'), upgradeBtn: { xtype: 'button', - disabled: !(Proxmox.UserName && Proxmox.UserName === 'root@pam'), + reference: 'upgradeBtn', + disabled: true, text: gettext('Upgrade'), handler: function() { PMG.Utils.openVNCViewer('upgrade', Proxmox.NodeName);