]> git.proxmox.com Git - pve-manager.git/commitdiff
add upload button conditionally
authorFabian Ebner <f.ebner@proxmox.com>
Fri, 13 Nov 2020 13:16:23 +0000 (14:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 15 Nov 2020 17:41:11 +0000 (18:41 +0100)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
www/manager6/storage/Browser.js
www/manager6/storage/ContentView.js

index 1e1be6bcbf6bcaaeb34c699b6647c11993964d58..6e455625f4b247b6bedb953bfb192608796c3b49 100644 (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);
index b9a53e11dc65866f49759be26d1ef0585188aab5..de319095bbb458b934f728f6ada7494a6cf74fa4 100644 (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'),