[pve-devel] [PATCH manager v2 10/29] lxc/Options: cleanup & use a few new features from ObjectGrid

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Dec 19 08:55:02 CET 2017


Use also same store update interval as qemu/Options

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/lxc/Options.js | 52 +++++++++++----------------------------------
 1 file changed, 12 insertions(+), 40 deletions(-)

diff --git a/www/manager6/lxc/Options.js b/www/manager6/lxc/Options.js
index 5e66147a..9752d98c 100644
--- a/www/manager6/lxc/Options.js
+++ b/www/manager6/lxc/Options.js
@@ -148,44 +148,8 @@ Ext.define('PVE.lxc.Options', {
 
 	var baseurl = 'nodes/' + nodename + '/lxc/' + vmid + '/config';
 
-	var reload = function() {
-	    me.rstore.load();
-	};
-
 	var sm = Ext.create('Ext.selection.RowModel', {});
 
-	var run_editor = function() {
-	    var rec = sm.getSelection()[0];
-	    if (!rec) {
-		return;
-	    }
-
-	    var rowdef = rows[rec.data.key];
-	    if (!rowdef.editor) {
-		return;
-	    }
-
-	    var win;
-	    if (Ext.isString(rowdef.editor)) {
-		win = Ext.create(rowdef.editor, {
-		    pveSelNode: me.pveSelNode,
-		    confid: rec.data.key,
-		    url: '/api2/extjs/' + baseurl
-		});
-	    } else {
-		var config = Ext.apply({
-		    pveSelNode: me.pveSelNode,
-		    confid: rec.data.key,
-		    url: '/api2/extjs/' + baseurl
-		}, rowdef.editor);
-		win = Ext.createWidget(rowdef.editor.xtype, config);
-		win.load();
-	    }
-
-	    win.show();
-	    win.on('destroy', reload);
-	};
-
 	var edit_btn = new PVE.button.Button({
 	    text: gettext('Edit'),
 	    disabled: true,
@@ -194,21 +158,29 @@ Ext.define('PVE.lxc.Options', {
 		var rowdef = rows[rec.data.key];
 		return !!rowdef.editor;
 	    },
-	    handler: run_editor
+	    handler: me.run_editor
 	});
 
 	Ext.apply(me, {
-	    url: "/api2/json/nodes/" + nodename + "/lxc/" + vmid + "/config",
+	    url: "/api2/json/" + baseurl,
 	    selModel: sm,
+	    interval: 5000,
 	    tbar: [ edit_btn ],
 	    rows: rows,
+	    editorConfig: {
+		url: '/api2/extjs/' + baseurl
+	    },
 	    listeners: {
-		itemdblclick: run_editor,
-		activate: reload
+		itemdblclick: me.run_editor
 	    }
 	});
 
 	me.callParent();
+
+	me.on('activate', me.rstore.startUpdate);
+	me.on('destroy', me.rstore.stopUpdate);
+	me.on('deactivate', me.rstore.stopUpdate);
+
     }
 });
 
-- 
2.11.0





More information about the pve-devel mailing list