[pve-devel] [PATCH 2/6] add snapshot selector
Alexandre Derumier
aderumier at odiso.com
Tue Apr 2 08:49:10 CEST 2013
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
www/manager/Makefile | 1 +
www/manager/form/SnapshotSelector.js | 64 ++++++++++++++++++++++++++++++++++
2 files changed, 65 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..15eb65a
--- /dev/null
+++ b/www/manager/form/SnapshotSelector.js
@@ -0,0 +1,64 @@
+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'],
+ filterOnLoad: true,
+ });
+
+ Ext.apply(me, {
+ store: store,
+ valueField: 'name',
+ displayField: 'name',
+ listConfig: {
+ columns: [
+ {
+ header: 'Snapshot',
+ dataIndex: 'name',
+ hideable: false,
+ flex: 1
+ },
+ ]
+ }
+ });
+
+ me.callParent();
+
+ me.loadStore(me.nodename, me.vmid);
+ }
+});
--
1.7.10.4
More information about the pve-devel
mailing list