js/ServerAdministration.js - enable upgrade button inside controller init

Because Proxmox.UserName may not be set at class load time.
This commit is contained in:
Dietmar Maurer 2017-10-24 11:30:52 +02:00
parent 7b18909823
commit cea4e924e7

View File

@ -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);