Commit 67407c11 authored by Dietmar Maurer's avatar Dietmar Maurer

display full vm settings for snapshots

parent f9bc8d19
Ext.define('PVE.window.Snapshot', { Ext.define('PVE.window.Snapshot', {
extend: 'Ext.window.Window', extend: 'Ext.window.Window',
resizable: false,
take_snapshot: function(snapname, descr, vmstate) { take_snapshot: function(snapname, descr, vmstate) {
var me = this; var me = this;
var params = { snapname: snapname, vmstate: vmstate ? 1 : 0 }; var params = { snapname: snapname, vmstate: vmstate ? 1 : 0 };
...@@ -56,12 +54,23 @@ Ext.define('PVE.window.Snapshot', { ...@@ -56,12 +54,23 @@ Ext.define('PVE.window.Snapshot', {
throw "no VM ID specified"; throw "no VM ID specified";
} }
var summarystore = Ext.create('Ext.data.Store', {
model: 'KeyValue',
sorters: [
{
property : 'key',
direction: 'ASC'
}
]
});
var items = [ var items = [
{ {
xtype: me.snapname ? 'displayfield' : 'textfield', xtype: me.snapname ? 'displayfield' : 'textfield',
name: 'snapname', name: 'snapname',
value: me.snapname, value: me.snapname,
fieldLabel: 'Snapshot Name', fieldLabel: 'Snapshot Name',
vtype: 'StorageId',
allowBlank: false allowBlank: false
} }
]; ];
...@@ -70,7 +79,6 @@ Ext.define('PVE.window.Snapshot', { ...@@ -70,7 +79,6 @@ Ext.define('PVE.window.Snapshot', {
items.push({ items.push({
xtype: 'displayfield', xtype: 'displayfield',
name: 'snaptime', name: 'snaptime',
value: new Date(me.snaptime),
fieldLabel: 'Timestamp' fieldLabel: 'Timestamp'
}); });
} else { } else {
...@@ -88,13 +96,13 @@ Ext.define('PVE.window.Snapshot', { ...@@ -88,13 +96,13 @@ Ext.define('PVE.window.Snapshot', {
xtype: 'textareafield', xtype: 'textareafield',
grow: true, grow: true,
name: 'description', name: 'description',
value: me.description,
fieldLabel: 'Description' fieldLabel: 'Description'
}); });
me.formPanel = Ext.create('Ext.form.Panel', { me.formPanel = Ext.create('Ext.form.Panel', {
bodyPadding: 10, bodyPadding: 10,
border: false, border: false,
region: 'north',
fieldDefaults: { fieldDefaults: {
labelWidth: 100, labelWidth: 100,
anchor: '100%' anchor: '100%'
...@@ -130,12 +138,40 @@ Ext.define('PVE.window.Snapshot', { ...@@ -130,12 +138,40 @@ Ext.define('PVE.window.Snapshot', {
}); });
} }
if (me.snapname) {
Ext.apply(me, {
layout: 'border',
border: false,
width: 620,
height: 400,
items: [
me.formPanel,
{
title: gettext('Settings'),
xtype: 'grid',
region: 'center',
layout: 'fit',
autoScroll: true,
height: 200,
store: summarystore,
columns: [
{header: 'Key', width: 150, dataIndex: 'key'},
{header: 'Value', flex: 1, dataIndex: 'value'}
]
}
]
});
} else {
Ext.apply(me, { Ext.apply(me, {
width: 450, width: 450,
modal: true,
layout: 'auto', layout: 'auto',
border: false, border: false,
items: [ me.formPanel ], items: [ me.formPanel ]
});
}
Ext.apply(me, {
modal: true,
buttons: [ submitBtn ] buttons: [ submitBtn ]
}); });
...@@ -146,7 +182,6 @@ Ext.define('PVE.window.Snapshot', { ...@@ -146,7 +182,6 @@ Ext.define('PVE.window.Snapshot', {
} }
// else load data // else load data
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + me.nodename + '/qemu/' + me.vmid + "/snapshot/" + url: '/nodes/' + me.nodename + '/qemu/' + me.vmid + "/snapshot/" +
me.snapname + '/config', me.snapname + '/config',
...@@ -158,9 +193,21 @@ Ext.define('PVE.window.Snapshot', { ...@@ -158,9 +193,21 @@ Ext.define('PVE.window.Snapshot', {
}, },
success: function(response, options) { success: function(response, options) {
var data = response.result.data; var data = response.result.data;
var kvarray = [];
console.dir(data); Ext.Object.each(data, function(key, value) {
if (key === 'description' || key === 'snaptime') {
return;
}
kvarray.push({ key: key, value: value });
});
summarystore.suspendEvents();
summarystore.add(kvarray);
summarystore.sort();
summarystore.resumeEvents();
summarystore.fireEvent('datachanged', summarystore);
form.findField('snaptime').setValue(new Date(data.snaptime));
form.findField('description').setValue(data.description);
} }
}); });
} }
......
...@@ -103,8 +103,6 @@ Ext.define('PVE.qemu.SnapshotTree', { ...@@ -103,8 +103,6 @@ Ext.define('PVE.qemu.SnapshotTree', {
if (valid_snapshot(rec)) { if (valid_snapshot(rec)) {
var win = Ext.create('PVE.window.Snapshot', { var win = Ext.create('PVE.window.Snapshot', {
snapname: rec.data.name, snapname: rec.data.name,
snaptime: rec.data.snaptime,
description: rec.data.description,
nodename: me.nodename, nodename: me.nodename,
vmid: me.vmid vmid: me.vmid
}); });
......
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