[pve-devel] [PATCH manager 03/10] make firewall panels/grids stateful

Dominik Csapak d.csapak at proxmox.com
Tue Nov 8 10:50:44 CET 2016


to save the columns/layouts in the browsers local storage

also change width to string (or else jslint complains)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
we have to change the flex to width, because extjs can save the width in the
state, but not the flex value
 www/manager6/dc/SecurityGroups.js    |  8 +++++---
 www/manager6/grid/FirewallAliases.js |  3 +++
 www/manager6/grid/FirewallRules.js   |  3 +++
 www/manager6/panel/IPSet.js          | 11 ++++++++---
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/www/manager6/dc/SecurityGroups.js b/www/manager6/dc/SecurityGroups.js
index d8562e7..62c7ac0 100644
--- a/www/manager6/dc/SecurityGroups.js
+++ b/www/manager6/dc/SecurityGroups.js
@@ -62,6 +62,9 @@ Ext.define('PVE.SecurityGroupList', {
     extend: 'Ext.grid.Panel',
     alias: 'widget.pveSecurityGroupList',
 
+    stateful: true,
+    stateId: 'grid-securitygroups',
+
     rule_panel: undefined,
 
     addBtn: undefined,
@@ -166,7 +169,7 @@ Ext.define('PVE.SecurityGroupList', {
 	    tbar: [ '<b>' + gettext('Group') + ':</b>', me.addBtn, me.removeBtn, me.editBtn ],
 	    selModel: sm,
 	    columns: [
-		{ header: gettext('Group'), dataIndex: 'group', width: 100 },
+		{ header: gettext('Group'), dataIndex: 'group', width: '100' },
 		{ header: gettext('Comment'), dataIndex: 'comment', renderer: Ext.String.htmlEncode, flex: 1 }
 	    ],
 	    listeners: {
@@ -202,14 +205,13 @@ Ext.define('PVE.SecurityGroups', {
 	    allow_groups: false,
 	    list_refs_url: '/cluster/firewall/refs',
 	    tbar_prefix: '<b>' + gettext('Rules') + ':</b>',
-	    flex: 0.75,
 	    border: false
 	});
 
 	var sglist = Ext.createWidget('pveSecurityGroupList', {
 	    region: 'west',
 	    rule_panel: rule_panel,
-	    flex: 0.25,
+	    width: '25%',
 	    border: false,
 	    split: true
 	});
diff --git a/www/manager6/grid/FirewallAliases.js b/www/manager6/grid/FirewallAliases.js
index a9329af..bee6cfb 100644
--- a/www/manager6/grid/FirewallAliases.js
+++ b/www/manager6/grid/FirewallAliases.js
@@ -70,6 +70,9 @@ Ext.define('PVE.FirewallAliases', {
     extend: 'Ext.grid.Panel',
     alias: ['widget.pveFirewallAliases'],
 
+    stateful: true,
+    stateId: 'grid-firewall-aliases',
+
     base_url: undefined,
 
     title: gettext('Alias'),
diff --git a/www/manager6/grid/FirewallRules.js b/www/manager6/grid/FirewallRules.js
index 55342e8..2433d29 100644
--- a/www/manager6/grid/FirewallRules.js
+++ b/www/manager6/grid/FirewallRules.js
@@ -379,6 +379,9 @@ Ext.define('PVE.FirewallRules', {
 
     onlineHelp: 'chapter_pve_firewall',
 
+    stateful: true,
+    stateId: 'grid-firewall-rules',
+
     base_url: undefined,
     list_refs_url: undefined,
 
diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js
index 59a45c4..5e90ec4 100644
--- a/www/manager6/panel/IPSet.js
+++ b/www/manager6/panel/IPSet.js
@@ -2,6 +2,9 @@ Ext.define('PVE.IPSetList', {
     extend: 'Ext.grid.Panel',
     alias: 'widget.pveIPSetList',
 
+    stateful: true,
+    stateId: 'grid-firewall-ipsetlist',
+
     ipset_panel: undefined,
 
     base_url: undefined,
@@ -147,7 +150,7 @@ Ext.define('PVE.IPSetList', {
 	    tbar: [ '<b>IPSet:</b>', me.addBtn, me.removeBtn, me.editBtn ],
 	    selModel: sm,
 	    columns: [
-		{ header: 'IPSet', dataIndex: 'name', width: 100 },
+		{ header: 'IPSet', dataIndex: 'name', width: '100' },
 		{ header: gettext('Comment'), dataIndex: 'comment', renderer: Ext.String.htmlEncode, flex: 1 }
 	    ],
 	    listeners: {
@@ -259,6 +262,9 @@ Ext.define('PVE.IPSetGrid', {
     extend: 'Ext.grid.Panel',
     alias: 'widget.pveIPSetGrid',
 
+    stateful: true,
+    stateId: 'grid-firewall-ipsets',
+
     base_url: undefined,
     list_refs_url: undefined,
 
@@ -446,7 +452,6 @@ Ext.define('PVE.IPSet', {
 	var ipset_panel = Ext.createWidget('pveIPSetGrid', {
 	    region: 'center',
 	    list_refs_url: me.list_refs_url,
-	    flex: 0.5,
 	    border: false
 	});
 
@@ -454,7 +459,7 @@ Ext.define('PVE.IPSet', {
 	    region: 'west',
 	    ipset_panel: ipset_panel,
 	    base_url: me.base_url,
-	    flex: 0.5,
+	    width: '50%',
 	    border: false,
 	    split: true
 	});
-- 
2.1.4





More information about the pve-devel mailing list