[pve-devel] [PATCH proxmox-widget-toolkit 2/7] safe destroy: allow specifing additional items

Fabian Ebner f.ebner at proxmox.com
Mon Apr 19 15:14:36 CEST 2021


to be used to add more checkboxes for PVE's guest destroy use case.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/window/SafeDestroy.js | 104 ++++++++++++++++++++------------------
 1 file changed, 54 insertions(+), 50 deletions(-)

diff --git a/src/window/SafeDestroy.js b/src/window/SafeDestroy.js
index 91e0f2c..72e7e19 100644
--- a/src/window/SafeDestroy.js
+++ b/src/window/SafeDestroy.js
@@ -15,6 +15,8 @@ Ext.define('Proxmox.window.SafeDestroy', {
     defaultFocus: 'confirmField',
     showProgress: false,
 
+    additionalItems: [],
+
     config: {
 	item: {
 	    id: undefined,
@@ -96,56 +98,6 @@ Ext.define('Proxmox.window.SafeDestroy', {
 	},
     },
 
-    items: [
-	{
-	    xtype: 'component',
-	    cls: [Ext.baseCSSPrefix + 'message-box-icon',
-		   Ext.baseCSSPrefix + 'message-box-warning',
-		   Ext.baseCSSPrefix + 'dlg-icon'],
-	},
-	{
-	    xtype: 'container',
-	    flex: 1,
-	    layout: {
-		type: 'vbox',
-		align: 'stretch',
-	    },
-	    items: [
-		{
-		    xtype: 'component',
-		    reference: 'messageCmp',
-		},
-		{
-		    itemId: 'confirmField',
-		    reference: 'confirmField',
-		    xtype: 'textfield',
-		    name: 'confirm',
-		    labelWidth: 300,
-		    hideTrigger: true,
-		    allowBlank: false,
-		},
-		{
-		    xtype: 'container',
-		    reference: 'noteContainer',
-		    flex: 1,
-		    hidden: true,
-		    layout: {
-			type: 'vbox',
-			align: 'middle',
-		    },
-		    height: 25,
-		    items: [
-			{
-			    xtype: 'component',
-			    reference: 'noteCmp',
-			    width: '300px',
-			    style: 'font-size: smaller; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;',
-			},
-		    ],
-		},
-	    ],
-	},
-    ],
     buttons: [
 	{
 	    reference: 'removeButton',
@@ -157,6 +109,58 @@ Ext.define('Proxmox.window.SafeDestroy', {
     initComponent: function() {
 	let me = this;
 
+	me.items = [
+	    {
+		xtype: 'component',
+		cls: [Ext.baseCSSPrefix + 'message-box-icon',
+		       Ext.baseCSSPrefix + 'message-box-warning',
+		       Ext.baseCSSPrefix + 'dlg-icon'],
+	    },
+	    {
+		xtype: 'container',
+		flex: 1,
+		layout: {
+		    type: 'vbox',
+		    align: 'stretch',
+		},
+		items: [
+		    {
+			xtype: 'component',
+			reference: 'messageCmp',
+		    },
+		    {
+			itemId: 'confirmField',
+			reference: 'confirmField',
+			xtype: 'textfield',
+			name: 'confirm',
+			labelWidth: 300,
+			hideTrigger: true,
+			allowBlank: false,
+		    },
+		].concat(me.additionalItems).concat([
+		    {
+			xtype: 'container',
+			reference: 'noteContainer',
+			flex: 1,
+			hidden: true,
+			layout: {
+			    type: 'vbox',
+			    align: 'middle',
+			},
+			height: 25,
+			items: [
+			    {
+				xtype: 'component',
+				reference: 'noteCmp',
+				width: '300px',
+				style: 'font-size: smaller; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;',
+			    },
+			],
+		    },
+		]),
+	    },
+	];
+
 	me.callParent();
 
 	const item = me.getItem();
-- 
2.20.1






More information about the pve-devel mailing list