Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
9be4b959
Commit
9be4b959
authored
Jul 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy window/Restore.js from manager to manager5
parent
e6adfebb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
136 additions
and
0 deletions
+136
-0
Restore.js
www/manager5/window/Restore.js
+136
-0
No files found.
www/manager5/window/Restore.js
0 → 100644
View file @
9be4b959
Ext
.
define
(
'
PVE.window.Restore
'
,
{
extend
:
'
Ext.window.Window
'
,
// fixme: PVE.window.Edit?
resizable
:
false
,
initComponent
:
function
()
{
var
me
=
this
;
if
(
!
me
.
nodename
)
{
throw
"
no node name specified
"
;
}
if
(
!
me
.
volid
)
{
throw
"
no volume ID specified
"
;
}
if
(
!
me
.
vmtype
)
{
throw
"
no vmtype specified
"
;
}
var
storagesel
=
Ext
.
create
(
'
PVE.form.StorageSelector
'
,
{
nodename
:
me
.
nodename
,
name
:
'
storage
'
,
value
:
''
,
fieldLabel
:
gettext
(
'
Storage
'
),
storageContent
:
(
me
.
vmtype
===
'
openvz
'
)
?
'
rootdir
'
:
'
images
'
,
allowBlank
:
true
});
me
.
formPanel
=
Ext
.
create
(
'
Ext.form.Panel
'
,
{
bodyPadding
:
10
,
border
:
false
,
fieldDefaults
:
{
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
}
]
});
var
form
=
me
.
formPanel
.
getForm
();
var
doRestore
=
function
(
url
,
params
)
{
PVE
.
Utils
.
API2Request
({
url
:
url
,
params
:
params
,
method
:
'
POST
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
gettext
(
'
Error
'
),
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
var
upid
=
response
.
result
.
data
;
var
win
=
Ext
.
create
(
'
PVE.window.TaskViewer
'
,
{
upid
:
upid
});
win
.
show
();
me
.
close
();
}
});
};
var
submitBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
gettext
(
'
Restore
'
),
handler
:
function
(){
var
storage
=
storagesel
.
getValue
();
var
values
=
form
.
getValues
();
var
params
=
{
storage
:
storage
,
vmid
:
me
.
vmid
||
values
.
vmid
,
force
:
me
.
vmid
?
1
:
0
};
var
url
;
if
(
me
.
vmtype
===
'
openvz
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/openvz
'
;
params
.
ostemplate
=
me
.
volid
;
params
.
restore
=
1
;
}
else
if
(
me
.
vmtype
===
'
qemu
'
)
{
url
=
'
/nodes/
'
+
me
.
nodename
+
'
/qemu
'
;
params
.
archive
=
me
.
volid
;
}
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.
'
);
Ext
.
Msg
.
confirm
(
gettext
(
'
Confirm
'
),
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
doRestore
(
url
,
params
);
});
}
else
{
doRestore
(
url
,
params
);
}
}
});
form
.
on
(
'
validitychange
'
,
function
(
f
,
valid
)
{
submitBtn
.
setDisabled
(
!
valid
);
});
var
title
=
(
me
.
vmtype
===
'
openvz
'
)
?
gettext
(
'
Restore CT
'
)
:
gettext
(
'
Restore VM
'
);
Ext
.
apply
(
me
,
{
title
:
title
,
width
:
500
,
modal
:
true
,
layout
:
'
auto
'
,
border
:
false
,
items
:
[
me
.
formPanel
],
buttons
:
[
submitBtn
]
});
me
.
callParent
();
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment