Commit 284188c6 authored by Alexandre Derumier's avatar Alexandre Derumier Committed by Dietmar Maurer

enable snapshot button only if vm has snapshot feature

Signed-off-by: 's avatarAlexandre Derumier <aderumier@odiso.com>
parent 396b1289
...@@ -71,6 +71,20 @@ Ext.define('PVE.qemu.SnapshotTree', { ...@@ -71,6 +71,20 @@ Ext.define('PVE.qemu.SnapshotTree', {
me.load_task.delay(me.load_delay); me.load_task.delay(me.load_delay);
} }
}); });
PVE.Utils.API2Request({
url: '/nodes/' + me.nodename + '/qemu/' + me.vmid + '/feature',
params: { feature: 'snapshot' },
method: 'GET',
success: function(response, options) {
var res = response.result.data;
if (res === 1) {
Ext.getCmp('snapshotBtn').enable();
}
}
});
}, },
initComponent: function() { initComponent: function() {
...@@ -94,6 +108,7 @@ Ext.define('PVE.qemu.SnapshotTree', { ...@@ -94,6 +108,7 @@ Ext.define('PVE.qemu.SnapshotTree', {
return record && record.data && record.data.name && return record && record.data && record.data.name &&
record.data.name !== 'current'; record.data.name !== 'current';
}; };
var valid_snapshot_rollback = function(record) { var valid_snapshot_rollback = function(record) {
return record && record.data && record.data.name && return record && record.data && record.data.name &&
record.data.name !== 'current' && !record.data.snapstate; record.data.name !== 'current' && !record.data.snapstate;
...@@ -193,7 +208,9 @@ Ext.define('PVE.qemu.SnapshotTree', { ...@@ -193,7 +208,9 @@ Ext.define('PVE.qemu.SnapshotTree', {
}); });
var snapshotBtn = Ext.create('Ext.Button', { var snapshotBtn = Ext.create('Ext.Button', {
id: 'snapshotBtn',
text: gettext('Take Snapshot'), text: gettext('Take Snapshot'),
disabled: true,
handler: function() { handler: function() {
var win = Ext.create('PVE.window.Snapshot', { var win = Ext.create('PVE.window.Snapshot', {
nodename: me.nodename, nodename: me.nodename,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment