[pve-devel] [PATCH manager 32/49] lxc/Options: cleanup & use a few new features from ObjectGrid
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Jan 23 11:05:49 CET 2018
Use also same store update interval as qemu/Options
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak 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 0871fc92..b19b3419 100644
--- a/www/manager6/lxc/Options.js
+++ b/www/manager6/lxc/Options.js
@@ -139,44 +139,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 Proxmox.button.Button({
text: gettext('Edit'),
disabled: true,
@@ -185,21 +149,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.14.2
More information about the pve-devel
mailing list