mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-05 06:56:12 +00:00
implement simple restore dialog
This commit is contained in:
parent
c5125d5a64
commit
89cd40282b
@ -245,6 +245,9 @@ __PACKAGE__->register_method({
|
|||||||
if (PVE::Storage::parse_volume_id($ostemplate, 1)) {
|
if (PVE::Storage::parse_volume_id($ostemplate, 1)) {
|
||||||
$archive = PVE::Storage::path($stcfg, $ostemplate);
|
$archive = PVE::Storage::path($stcfg, $ostemplate);
|
||||||
} else {
|
} else {
|
||||||
|
raise_param_exc({ archive => "Only root can pass arbitrary paths." })
|
||||||
|
if $user ne 'root@pam';
|
||||||
|
|
||||||
$archive = abs_path($ostemplate);
|
$archive = abs_path($ostemplate);
|
||||||
}
|
}
|
||||||
die "can't find file '$archive'\n" if ! -f $archive;
|
die "can't find file '$archive'\n" if ! -f $archive;
|
||||||
|
@ -86,7 +86,47 @@ Ext.define('PVE.grid.BackupView', {
|
|||||||
|
|
||||||
var volid = rec.data.volid;
|
var volid = rec.data.volid;
|
||||||
|
|
||||||
console.log("RESRORE " + volid);
|
msg = 'Are you sure you want to restore from "' + volid + '"? ' +
|
||||||
|
'This will permanently erase current VM data.';
|
||||||
|
Ext.Msg.confirm('Restore Confirmation', msg, function(btn) {
|
||||||
|
if (btn !== 'yes') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var url;
|
||||||
|
var params = {
|
||||||
|
vmid: vmid,
|
||||||
|
force: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
if (vmtype === 'openvz') {
|
||||||
|
url = '/nodes/' + nodename + '/openvz';
|
||||||
|
params.ostemplate = volid;
|
||||||
|
} else if (vmtype === 'qemu') {
|
||||||
|
url = '/nodes/' + nodename + '/qemu';
|
||||||
|
params.archive = volid;
|
||||||
|
} else {
|
||||||
|
throw 'unknown VM type';
|
||||||
|
}
|
||||||
|
|
||||||
|
PVE.Utils.API2Request({
|
||||||
|
url: url,
|
||||||
|
params: params,
|
||||||
|
method: 'POST',
|
||||||
|
waitMsgTarget: me,
|
||||||
|
failure: function(response, opts) {
|
||||||
|
Ext.Msg.alert('Error', response.htmlStatus);
|
||||||
|
},
|
||||||
|
success: function(response, options) {
|
||||||
|
var upid = response.result.data;
|
||||||
|
|
||||||
|
var win = Ext.create('PVE.window.TaskViewer', {
|
||||||
|
upid: upid
|
||||||
|
});
|
||||||
|
win.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user