and get the Window text to display from the calling function --- change since v2: * use the same gettext string for CTs and VMs to reduce the amount of stuff to localize www/manager6/lxc/Config.js | 11 +++++++++-- www/manager6/qemu/Config.js | 10 ++++++++-- www/manager6/window/SafeDestroy.js | 12 ++++++------ 3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/www/manager6/lxc/Config.js b/www/manager6/lxc/Config.js index 1eafdb5..ca1434f 100644 --- a/www/manager6/lxc/Config.js +++ b/www/manager6/lxc/Config.js @@ -88,9 +88,16 @@ Ext.define('PVE.lxc.Config', { text: gettext('Remove'), disabled: !caps.vms['VM.Allocate'], handler: function() { + + var msg = Ext.String.format(gettext('Are you sure you want to remove {0}? This will permanently erase all data.'), + 'CT ' +vmid); + var inputLabel = Ext.String.format(gettext('Please enter the ID of the {0}'), 'CT'); + Ext.create('PVE.window.SafeDestroy', { - vmid: vmid, - base_url: base_url + base_url: base_url, + inputLabel: inputLabel, + msg: msg, + vmid: vmid }).show(); } }); diff --git a/www/manager6/qemu/Config.js b/www/manager6/qemu/Config.js index dce4792..94d3994 100644 --- a/www/manager6/qemu/Config.js +++ b/www/manager6/qemu/Config.js @@ -99,9 +99,15 @@ Ext.define('PVE.qemu.Config', { text: gettext('Remove'), disabled: !caps.vms['VM.Allocate'], handler: function() { + var msg = Ext.String.format(gettext('Are you sure you want to remove {0}? This will permanently erase all data.'), + 'VM ' +vmid); + var inputLabel = Ext.String.format(gettext('Please enter the ID of the {0}'), 'VM'); + Ext.create('PVE.window.SafeDestroy', { - vmid: vmid, - base_url: base_url + base_url: base_url, + inputLabel: inputLabel, + msg: msg, + vmid: vmid }).show(); } }); diff --git a/www/manager6/window/SafeDestroy.js b/www/manager6/window/SafeDestroy.js index aa0e478..dedb42c 100644 --- a/www/manager6/window/SafeDestroy.js +++ b/www/manager6/window/SafeDestroy.js @@ -28,8 +28,6 @@ Ext.define('PVE.window.SafeDestroy', { { itemId: 'input', xtype: 'numberfield', - name: 'VM id', - fieldLabel: gettext('Please enter the VM ID to confirm'), hideTrigger:true, allowBlank: false, listeners: { @@ -74,13 +72,15 @@ Ext.define('PVE.window.SafeDestroy', { var me = this; me.callParent(); - var msg = Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), me.vmid); - me.getComponent('safepanel').getComponent('message').setValue(msg); + me.getComponent('safepanel').getComponent('message').setValue(me.msg); var submitBtn = me.down('toolbar').getComponent('removeButton'); submitBtn.base_url= me.base_url; - me.getComponent('safepanel').getComponent('input').vmid = me.vmid; - me.getComponent('safepanel').getComponent('input').submitBtn = submitBtn; + Ext.apply(me.getComponent('safepanel').getComponent('input'), { + fieldLabel: me.inputLabel, + vmid: me.vmid, + submitBtn: submitBtn + }); } }); \ No newline at end of file -- 2.1.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel