mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 15:21:28 +00:00
SafeDestroy: remove viewModel - it not flexible enough
This commit is contained in:
parent
52721af8dc
commit
763ec2ecf8
@ -14,8 +14,6 @@ Ext.define('PVE.window.SafeDestroy', {
|
|||||||
layout: 'hbox',
|
layout: 'hbox',
|
||||||
defaultFocus: 'confirmField',
|
defaultFocus: 'confirmField',
|
||||||
|
|
||||||
viewModel: { type: 'default' },
|
|
||||||
|
|
||||||
config: {
|
config: {
|
||||||
item: {
|
item: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
@ -24,22 +22,6 @@ Ext.define('PVE.window.SafeDestroy', {
|
|||||||
url: undefined
|
url: undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
applyItem: function(item) {
|
|
||||||
var me = this;
|
|
||||||
|
|
||||||
if (!Ext.isDefined(item.id)) {
|
|
||||||
throw "no ID specified";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Ext.isDefined(item.type)) {
|
|
||||||
throw "no VM type specified";
|
|
||||||
}
|
|
||||||
|
|
||||||
me.getViewModel().set('item', item);
|
|
||||||
|
|
||||||
return item;
|
|
||||||
},
|
|
||||||
|
|
||||||
controller: {
|
controller: {
|
||||||
|
|
||||||
xclass: 'Ext.app.ViewController',
|
xclass: 'Ext.app.ViewController',
|
||||||
@ -98,17 +80,14 @@ Ext.define('PVE.window.SafeDestroy', {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
xtype: 'component',
|
xtype: 'component',
|
||||||
bind: gettext('Are you sure you want to remove {item.type} {item.id}?') + ' ' +
|
reference: 'messageCmp'
|
||||||
gettext('This will permanently erase all data.')
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
itemId: 'confirmField',
|
itemId: 'confirmField',
|
||||||
|
reference: 'confirmField',
|
||||||
xtype: 'numberfield',
|
xtype: 'numberfield',
|
||||||
name: 'confirm',
|
name: 'confirm',
|
||||||
labelWidth: 300,
|
labelWidth: 300,
|
||||||
bind: {
|
|
||||||
fieldLabel: gettext('Please enter the {item.type} ID to confirm'),
|
|
||||||
},
|
|
||||||
hideTrigger: true,
|
hideTrigger: true,
|
||||||
allowBlank: false
|
allowBlank: false
|
||||||
}
|
}
|
||||||
@ -121,5 +100,39 @@ Ext.define('PVE.window.SafeDestroy', {
|
|||||||
text: gettext('Remove'),
|
text: gettext('Remove'),
|
||||||
disabled: true
|
disabled: true
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
initComponent : function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
|
||||||
|
var item = me.getItem();
|
||||||
|
|
||||||
|
if (!Ext.isDefined(item.id)) {
|
||||||
|
throw "no ID specified";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Ext.isDefined(item.type)) {
|
||||||
|
throw "no VM type specified";
|
||||||
|
}
|
||||||
|
|
||||||
|
var messageCmp = me.lookupReference('messageCmp');
|
||||||
|
var msg;
|
||||||
|
|
||||||
|
if (item.type === 'VM') {
|
||||||
|
msg = PVE.Utils.format_task_description('qmdestroy', item.id);
|
||||||
|
} else if (item.type === 'CT') {
|
||||||
|
msg = PVE.Utils.format_task_description('vzdestroy', item.id);
|
||||||
|
} else {
|
||||||
|
throw "unknown VM type specified";
|
||||||
|
}
|
||||||
|
|
||||||
|
messageCmp.setHtml(msg);
|
||||||
|
|
||||||
|
var confirmField = me.lookupReference('confirmField');
|
||||||
|
msg = gettext('Please enter the ID to confirm') +
|
||||||
|
' (' + item.id + ')';
|
||||||
|
confirmField.setFieldLabel(msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user