[pve-devel] [PATCH manager 5/6 v2] importwizard: Move buttons from bottom bar into panel

Dominic Jäger d.jaeger at proxmox.com
Fri Nov 20 10:38:11 CET 2020


As we've dropped the idea of using a single tab for each disk

---
v2: Added

 www/manager6/qemu/ImportWizard.js | 42 +------------------------------
 www/manager6/qemu/MultiHDEdit.js  | 27 ++++++++++++++++++--
 www/manager6/window/Wizard.js     | 14 -----------
 3 files changed, 26 insertions(+), 57 deletions(-)

diff --git a/www/manager6/qemu/ImportWizard.js b/www/manager6/qemu/ImportWizard.js
index c6e91a48..0b382303 100644
--- a/www/manager6/qemu/ImportWizard.js
+++ b/www/manager6/qemu/ImportWizard.js
@@ -335,45 +335,5 @@ Ext.define('PVE.qemu.ImportWizard', {
 	    }
 	}
 	],
-    initComponent: function () {
-	var me = this;
-	me.callParent();
-
-	let addDiskButton = {
-		text: gettext('Add disk'),
-		disabled: true,
-		itemId: 'addDisk',
-		minWidth: 60,
-		handler: me.addDiskFunction,
-		isValid: function () {
-			let isValid = true;
-			if (!me.isImport) {
-				isValid = false;
-			}
-			let type = me.down('#wizcontent').getActiveTab().xtype;
-			if (type !== 'pveQemuHDInputPanel') {
-				isValid=false;
-			}
-			return isValid;
-		},
-	};
-
-	let removeDiskButton = {
-	    text: gettext('Remove disk'), // TODO implement
-	    disabled: false,
-	    itemId: 'removeDisk',
-	    minWidth: 60,
-	    handler: function() {
-		console.assert(me.xtype === 'pveQemuImportWizard');
-		let multihd = me.down('pveQemuMultiHDInputPanel');
-		multihd.removeCurrentDisk();
-	    },
-	};
-	me.down('toolbar').insert(4, addDiskButton);
-	me.down('toolbar').insert(5, removeDiskButton);
-    },
-});
-
-
-
 
+});
\ No newline at end of file
diff --git a/www/manager6/qemu/MultiHDEdit.js b/www/manager6/qemu/MultiHDEdit.js
index 632199ba..d81e96f6 100644
--- a/www/manager6/qemu/MultiHDEdit.js
+++ b/www/manager6/qemu/MultiHDEdit.js
@@ -45,8 +45,31 @@ Ext.define('PVE.qemu.MultiHDInputPanel', {
 			.setActiveItem(record.data.panel);
 		},
 	    },
-	    anchor: '100% 100%', // Required because resize does not happen yet
-	},
+	    anchor: '100% 90%', // TODO Resize to parent
+	},{
+	    xtype: 'container',
+	    layout: 'hbox',
+	    center: true, // TODO fix me
+	    defaults: {
+		margin: '5',
+		xtype: 'button',
+	    },
+	    items: [
+		{
+		    iconCls: 'fa fa-plus-circle',
+		    itemId: 'addDisk',
+		    handler: function(button) {
+			button.up('pveQemuMultiHDInputPanel').addDiskFunction();
+		    },
+		},{
+		    iconCls: 'fa fa-trash-o',
+		    itemId: 'removeDisk',
+		    handler: function(button) {
+			button.up('pveQemuMultiHDInputPanel').removeCurrentDisk();
+		    },
+		}
+	    ],
+	}
     ],
     column2: [
 	{
diff --git a/www/manager6/window/Wizard.js b/www/manager6/window/Wizard.js
index f16ba107..d31afd8e 100644
--- a/www/manager6/window/Wizard.js
+++ b/www/manager6/window/Wizard.js
@@ -81,13 +81,6 @@ Ext.define('PVE.window.Wizard', {
 
 	    // only set the buttons on the current panel
 	    if (i === topbar.curidx) {
-		if (window.isImport) {
-		    console.debug('valid in window?');
-		    console.debug(valid);
-		    console.debug('because tab is');
-		    console.debug(tab);
-		    window.down('#addDisk').setDisabled(!valid);
-		}
 		window.down('#next').setDisabled(!valid);
 		window.down('#submit').setDisabled(!valid);
 	    }
@@ -131,13 +124,6 @@ Ext.define('PVE.window.Wizard', {
 		me.down('#submit').setVisible(false); 
 	    }
 	    var valid = me.check_card(newcard);
-	    let addDiskButton = me.down('#addDisk'); // TODO undefined in first invocation?
-	    if (me.isImport && addDiskButton) {
-		addDiskButton.setDisabled(!valid); // TODO check me
-		addDiskButton.setHidden(!addDiskButton.isValid());
-		addDiskButton.setDisabled(false);
-		addDiskButton.setHidden(false);
-	    }
 	    me.down('#next').setDisabled(!valid);    
 	    me.down('#submit').setDisabled(!valid);    
 	    me.down('#back').setDisabled(tp.items.indexOf(newcard) == 0);
-- 
2.20.1





More information about the pve-devel mailing list