disk list: move title bar initialization to initComponent

to conditionally add more buttons later on.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-04-23 12:14:58 +02:00 committed by Thomas Lamprecht
parent 557c45056c
commit e3a5040c55

View File

@ -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();
},
});