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
8bf7e77c
Commit
8bf7e77c
authored
Sep 11, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mprove snapshot GUI
parent
38524f51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
197 additions
and
15 deletions
+197
-15
Makefile
www/manager/Makefile
+1
-0
Snapshot.js
www/manager/qemu/Snapshot.js
+145
-0
SnapshotTree.js
www/manager/qemu/SnapshotTree.js
+51
-15
No files found.
www/manager/Makefile
View file @
8bf7e77c
...
...
@@ -100,6 +100,7 @@ JSSRC= \
qemu/StartupEdit.js
\
qemu/ScsiHwEdit.js
\
qemu/Options.js
\
qemu/Snapshot.js
\
qemu/SnapshotTree.js
\
qemu/Config.js
\
qemu/CreateWizard.js
\
...
...
www/manager/qemu/Snapshot.js
0 → 100644
View file @
8bf7e77c
Ext
.
define
(
'
PVE.window.Snapshot
'
,
{
extend
:
'
Ext.window.Window
'
,
resizable
:
false
,
take_snapshot
:
function
(
snapname
,
descr
,
vmstate
)
{
var
me
=
this
;
var
params
=
{
snapname
:
snapname
,
vmstate
:
vmstate
?
1
:
0
};
if
(
descr
)
{
params
.
description
=
descr
;
}
PVE
.
Utils
.
API2Request
({
params
:
params
,
url
:
'
/nodes/
'
+
me
.
nodename
+
'
/qemu/
'
+
me
.
vmid
+
"
/snapshot
"
,
waitMsgTarget
:
me
,
method
:
'
POST
'
,
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
();
me
.
close
();
}
});
},
update_snapshot
:
function
(
snapname
,
descr
)
{
var
me
=
this
;
PVE
.
Utils
.
API2Request
({
params
:
{
description
:
descr
},
url
:
'
/nodes/
'
+
me
.
nodename
+
'
/qemu/
'
+
me
.
vmid
+
"
/snapshot/
"
+
snapname
+
'
/config
'
,
waitMsgTarget
:
me
,
method
:
'
PUT
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
me
.
close
();
}
});
},
initComponent
:
function
()
{
var
me
=
this
;
if
(
!
me
.
nodename
)
{
throw
"
no node name specified
"
;
}
if
(
!
me
.
vmid
)
{
throw
"
no VM ID specified
"
;
}
var
items
=
[
{
xtype
:
me
.
snapname
?
'
displayfield
'
:
'
textfield
'
,
name
:
'
snapname
'
,
value
:
me
.
snapname
,
fieldLabel
:
'
Snapshot Name
'
,
allowBlank
:
false
}
];
if
(
me
.
snapname
)
{
items
.
push
({
xtype
:
'
displayfield
'
,
name
:
'
snaptime
'
,
value
:
new
Date
(
me
.
snaptime
),
fieldLabel
:
'
Timestamp
'
});
}
else
{
items
.
push
({
xtype
:
'
pvecheckbox
'
,
name
:
'
vmstate
'
,
uncheckedValue
:
0
,
defaultValue
:
0
,
checked
:
1
,
fieldLabel
:
'
Include State
'
});
}
items
.
push
({
xtype
:
'
textareafield
'
,
grow
:
true
,
name
:
'
description
'
,
value
:
me
.
description
,
fieldLabel
:
'
Description
'
});
me
.
formPanel
=
Ext
.
create
(
'
Ext.form.Panel
'
,
{
bodyPadding
:
10
,
border
:
false
,
fieldDefaults
:
{
labelWidth
:
100
,
anchor
:
'
100%
'
},
items
:
items
});
var
form
=
me
.
formPanel
.
getForm
();
var
submitBtn
;
if
(
me
.
snapname
)
{
me
.
title
=
"
Edit Snapshot '
"
+
me
.
snapname
+
"
of VM
"
+
me
.
vmid
;
submitBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
gettext
(
'
Update
'
),
handler
:
function
()
{
if
(
form
.
isValid
())
{
var
values
=
form
.
getValues
();
me
.
update_snapshot
(
me
.
snapname
,
values
.
description
);
}
}
});
}
else
{
me
.
title
=
"
Take Snapshot of VM
"
+
me
.
vmid
;
submitBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
'
Take Snapshot
'
,
handler
:
function
()
{
if
(
form
.
isValid
())
{
var
values
=
form
.
getValues
();
me
.
take_snapshot
(
values
.
snapname
,
values
.
description
,
values
.
vmstate
);
}
}
});
}
Ext
.
apply
(
me
,
{
width
:
450
,
modal
:
true
,
layout
:
'
auto
'
,
border
:
false
,
items
:
[
me
.
formPanel
],
buttons
:
[
submitBtn
]
});
me
.
callParent
();
}
});
www/manager/qemu/SnapshotTree.js
View file @
8bf7e77c
...
...
@@ -58,14 +58,39 @@ Ext.define('PVE.qemu.SnapshotTree', {
var
sm
=
Ext
.
create
(
'
Ext.selection.RowModel
'
,
{});
me
.
rollbackBtn
=
new
PVE
.
button
.
Button
({
var
valid_snapshot
=
function
(
record
)
{
return
record
&&
record
.
data
&&
record
.
data
.
name
&&
record
.
data
.
name
!==
'
__current
'
;
};
var
run_editor
=
function
()
{
var
rec
=
sm
.
getSelection
()[
0
];
if
(
valid_snapshot
(
rec
))
{
var
win
=
Ext
.
create
(
'
PVE.window.Snapshot
'
,
{
snapname
:
rec
.
data
.
name
,
snaptime
:
rec
.
data
.
snaptime
,
description
:
rec
.
data
.
description
,
nodename
:
me
.
nodename
,
vmid
:
me
.
vmid
});
win
.
show
();
me
.
mon
(
win
,
'
close
'
,
me
.
reload
,
me
);
}
};
var
editBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Edit
'
),
disabled
:
true
,
selModel
:
sm
,
enableFn
:
valid_snapshot
,
handler
:
run_editor
});
var
rollbackBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Rollback
'
),
disabled
:
true
,
selModel
:
sm
,
enableFn
:
function
(
record
)
{
return
record
&&
record
.
data
&&
record
.
data
.
name
&&
record
.
data
.
name
!==
'
__current
'
;
},
enableFn
:
valid_snapshot
,
handler
:
function
(
btn
,
event
)
{
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
...
...
@@ -87,15 +112,12 @@ Ext.define('PVE.qemu.SnapshotTree', {
}
});
me
.
delet
eBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Delet
e
'
),
var
remov
eBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Remov
e
'
),
disabled
:
true
,
selModel
:
sm
,
confirmMsg
:
gettext
(
'
Are you sure you want to remove this entry
'
),
enableFn
:
function
(
record
)
{
return
record
&&
record
.
data
&&
record
.
data
.
name
&&
record
.
data
.
name
!==
'
__current
'
;
},
enableFn
:
valid_snapshot
,
handler
:
function
(
btn
,
event
)
{
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
...
...
@@ -117,12 +139,23 @@ Ext.define('PVE.qemu.SnapshotTree', {
}
});
var
snapshotBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
gettext
(
'
Take Snapshot
'
),
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.window.Snapshot
'
,
{
nodename
:
me
.
nodename
,
vmid
:
me
.
vmid
});
win
.
show
();
}
});
Ext
.
apply
(
me
,
{
layout
:
'
fit
'
,
rootVisible
:
false
,
animate
:
false
,
selModel
:
sm
,
tbar
:
[
me
.
rollbackBtn
,
me
.
delete
Btn
],
tbar
:
[
snapshotBtn
,
rollbackBtn
,
removeBtn
,
edit
Btn
],
fields
:
[
'
name
'
,
'
description
'
,
{
name
:
'
snaptime
'
,
type
:
'
date
'
,
dateFormat
:
'
timestamp
'
}
...
...
@@ -160,12 +193,15 @@ Ext.define('PVE.qemu.SnapshotTree', {
}
}
}
]
],
columnLines
:
true
,
// will work in 4.1?
listeners
:
{
show
:
me
.
reload
,
itemdblclick
:
run_editor
}
});
me
.
callParent
();
me
.
on
(
'
show
'
,
me
.
reload
);
}
});
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