add upload button conditionally

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2020-11-13 14:16:23 +01:00 committed by Thomas Lamprecht
parent dbeddeb322
commit 8798c35bcd
2 changed files with 6 additions and 9 deletions

View File

@ -80,6 +80,7 @@ Ext.define('PVE.storage.Browser', {
content: 'iso',
stateful: true,
stateId: 'grid-storage-content-iso',
useUploadButton: true,
});
}
if (contents.includes('rootdir')) {
@ -113,6 +114,7 @@ Ext.define('PVE.storage.Browser', {
content: 'vztmpl',
stateful: true,
stateId: 'grid-storage-content-vztmpl',
useUploadButton: true,
});
}
me.insertNodes(items);

View File

@ -440,24 +440,17 @@ Ext.define('PVE.storage.ContentView', {
}
var uploadButton = Ext.create('Proxmox.button.Button', {
contents : ['iso','vztmpl'],
text: gettext('Upload'),
handler: function() {
var me = this;
var win = Ext.create('PVE.storage.Upload', {
nodename: nodename,
storage: storage,
contents: me.contents
contents: [content],
});
win.show();
win.on('destroy', reload);
}
});
if (content === 'iso' || content === 'vztmpl') {
uploadButton.contents = [content];
} else {
uploadButton.setDisabled(true);
}
var imageRemoveButton;
var removeButton = Ext.create('Proxmox.button.StdRemoveButton',{
@ -530,6 +523,9 @@ Ext.define('PVE.storage.ContentView', {
if (!me.tbar) {
me.tbar = [];
}
if (me.useUploadButton) {
me.tbar.push(uploadButton);
}
me.tbar.push(
{
xtype: 'proxmoxButton',
@ -562,7 +558,6 @@ Ext.define('PVE.storage.ContentView', {
removeButton,
imageRemoveButton,
templateButton,
uploadButton,
{
xtype: 'proxmoxButton',
text: gettext('Show Configuration'),