allowBlank: true
});
+ var IDfield;
+ if (me.vmid) {
+ IDfield = Ext.create('Ext.form.field.Display', {
+ name: 'vmid',
+ value: me.vmid,
+ fieldLabel: (me.vmtype === 'lxc') ? 'CT' : 'VM'
+ });
+ } else {
+ IDfield = Ext.create('PVE.form.GuestIDSelector', {
+ name: 'vmid',
+ guestType: me.vmtype,
+ loadNextGuestID: true,
+ validateExists: false
+ });
+ }
+
+ var items = [
+ {
+ xtype: 'displayfield',
+ value: me.volidText || me.volid,
+ fieldLabel: gettext('Source')
+ },
+ storagesel,
+ IDfield
+ ];
+
+ if (me.vmtype === 'lxc') {
+ items.push({
+ xtype: 'pvecheckbox',
+ name: 'unprivileged',
+ value: '',
+ fieldLabel: gettext('Unprivileged container')
+ });
+ }
+
me.formPanel = Ext.create('Ext.form.Panel', {
bodyPadding: 10,
border: false,
labelWidth: 100,
anchor: '100%'
},
- items: [
- {
- xtype: 'displayfield',
- value: me.volidText || me.volid,
- fieldLabel: gettext('Source')
- },
- storagesel,
- {
- xtype: me.vmid ? 'displayfield' : 'pveVMIDSelector',
- name: 'vmid',
- fieldLabel: 'VM ID',
- value: me.vmid,
- loadNextFreeVMID: me.vmid ? false: true,
- validateExists: false
- }
- ]
+ items: items
});
var form = me.formPanel.getForm();
var doRestore = function(url, params) {
- PVE.Utils.API2Request({
+ Proxmox.Utils.API2Request({
url: url,
params: params,
method: 'POST',
};
var url;
+ var msg;
if (me.vmtype === 'lxc') {
url = '/nodes/' + me.nodename + '/lxc';
params.ostemplate = me.volid;
params.restore = 1;
+ if (values.unprivileged) { params.unprivileged = 1; }
+ msg = Proxmox.Utils.format_task_description('vzrestore', params.vmid);
} else if (me.vmtype === 'qemu') {
url = '/nodes/' + me.nodename + '/qemu';
params.archive = me.volid;
+ msg = Proxmox.Utils.format_task_description('qmrestore', params.vmid);
} else {
throw 'unknown VM type';
}
if (me.vmid) {
- var msg = gettext('Are you sure you want to restore this VM?') + ' ' +
- gettext('This will permanently erase current VM data.');
+ msg += '. ' + gettext('This will permanently erase current VM data.');
Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') {
return;
submitBtn.setDisabled(!valid);
});
- var title = (me.vmtype === 'openvz') ? gettext('Restore CT') :
- gettext('Restore VM');
+ var title = gettext('Restore') + ": " + (
+ (me.vmtype === 'lxc') ? 'CT' : 'VM');
+
+ if (me.vmid) {
+ title += " " + me.vmid;
+ }
Ext.apply(me, {
title: title,