[pve-devel] [PATCH 08/10] add snapshot selector
Alexandre Derumier
aderumier at odiso.com
Tue Jan 22 10:14:10 CET 2013
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
www/manager/Makefile | 1 +
www/manager/form/SnapshotSelector.js | 69 ++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
create mode 100644 www/manager/form/SnapshotSelector.js
diff --git a/www/manager/Makefile b/www/manager/Makefile
index 9e84ef1..7da2234 100644
--- a/www/manager/Makefile
+++ b/www/manager/Makefile
@@ -45,6 +45,7 @@ JSSRC= \
form/LanguageSelector.js \
form/DisplaySelector.js \
form/CacheTypeSelector.js \
+ form/SnapshotSelector.js \
form/ContentTypeSelector.js \
form/DayOfWeekSelector.js \
form/BackupModeSelector.js \
diff --git a/www/manager/form/SnapshotSelector.js b/www/manager/form/SnapshotSelector.js
new file mode 100644
index 0000000..3edb1ba
--- /dev/null
+++ b/www/manager/form/SnapshotSelector.js
@@ -0,0 +1,69 @@
+Ext.define('PVE.form.SnapshotSelector', {
+ extend: 'PVE.form.ComboGrid',
+ alias: ['widget.PVE.form.SnapshotSelector'],
+
+ loadStore: function(nodename, vmid) {
+ var me = this;
+
+ if (!nodename) {
+ return;
+ }
+
+ me.nodename = nodename;
+
+ if (!vmid) {
+ return
+ }
+
+ me.vmid = vmid;
+
+ me.store.setProxy({
+ type: 'pve',
+ url: '/api2/json/nodes/' + me.nodename + '/qemu/' + me.vmid +'/snapshot'
+ });
+
+ me.store.load();
+ },
+
+ initComponent: function() {
+ var me = this;
+
+ if (!me.nodename) {
+ throw "no node name specified";
+ }
+
+ if (!me.vmid) {
+ throw "no VM ID specified";
+ }
+
+ var store = Ext.create('Ext.data.Store', {
+ fields: [ 'name', 'template'],
+ filterOnLoad: true,
+ });
+
+ Ext.apply(me, {
+ store: store,
+ valueField: 'name',
+ displayField: 'name',
+ listConfig: {
+ columns: [
+ {
+ header: 'Snapshot',
+ dataIndex: 'name',
+ hideable: false,
+ flex: 1
+ },
+ {
+ header: 'Template',
+ dataIndex: 'template',
+ renderer: PVE.Utils.format_boolean
+ }
+ ]
+ }
+ });
+
+ me.callParent();
+
+ me.loadStore(me.nodename, me.vmid);
+ }
+});
--
1.7.10.4
More information about the pve-devel
mailing list