[pve-devel] [PATCH manager 1/3] make containerviewport stateful

Dominik Csapak d.csapak at proxmox.com
Thu Jun 16 12:26:03 CEST 2016


with this patch, the split view saves its state
in the local storage, so that users don't lose this
after a refresh or even a new browser session
(only when they change browser/workstation)

if the window resizes (or refreshes),
the left/bottom panel gets resized to a sane width/height
in case this would be bigger than the viewport
to avoid an unusable interface

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Workspace.js | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index fb6ce58..674fe6e 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -422,30 +422,56 @@ Ext.define('PVE.StdWorkspace', {
 		},
 		{
 		    region: 'center',
+		    stateful: true,
+		    stateId: 'pvecenter',
+		    minWidth: 100,
+		    minHeight: 100,
 		    id: 'content',
 		    xtype: 'container',
 		    layout: { type: 'card' },
 		    border: false,
-		    stateful: false,
 		    margin: '0 5 0 0',
 		    items: []
 		},
 		{
 		    region: 'west',
+		    stateful: true,
+		    stateId: 'pvewest',
+		    itemId: 'west',
 		    xtype: 'container',
 		    border: false,
 		    layout: { type: 'vbox', align: 'stretch' },
 		    margin: '0 0 0 5',
 		    split: true,
 		    width: 200,
-		    items: [ selview, rtree ]
+		    items: [ selview, rtree ],
+		    listeners: {
+			resize: function(panel, width, height) {
+			    var viewWidth = me.getSize().width;
+			    if (width > viewWidth - 100) {
+				panel.setWidth(viewWidth - 100);
+			    }
+			}
+		    }
 		},
 		{
 		    xtype: 'pveStatusPanel',
+		    stateful: true,
+		    stateId: 'pvesouth',
+		    itemId: 'south',
 		    region: 'south',
 		    margin:'0 5 5 5',
-		    height: 200,       
-		    split:true
+		    height: 200,
+		    split:true,
+		    listeners: {
+			resize: function(panel, width, height) {
+			    console.log('test');
+			    var viewHeight = me.getSize().height;
+			    if (height > (viewHeight - 150)) {
+				panel.setHeight(viewHeight - 150);
+			    }
+			}
+		    }
 		}
 	    ]
 	});
-- 
2.1.4




More information about the pve-devel mailing list