public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 3/4] ui: Utils: use updateColumns from widget-toolkit
Date: Mon, 19 Apr 2021 13:00:47 +0200	[thread overview]
Message-ID: <20210419110048.20791-8-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210419110048.20791-1-d.csapak@proxmox.com>

it was moved there

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Utils.js              | 30 ------------------------------
 www/manager6/dc/Summary.js         |  4 ++--
 www/manager6/node/Summary.js       |  4 ++--
 www/manager6/panel/GuestSummary.js |  4 ++--
 4 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 48d94a64..87366842 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1614,36 +1614,6 @@ Ext.define('PVE.Utils', {
 	}
     },
 
-    updateColumns: function(container) {
-	let mode = Ext.state.Manager.get('summarycolumns') || 'auto';
-	let factor;
-	if (mode !== 'auto') {
-	    factor = parseInt(mode, 10);
-	    if (Number.isNaN(factor)) {
-		factor = 1;
-	    }
-	} else {
-	    factor = container.getSize().width < 1400 ? 1 : 2;
-	}
-
-	if (container.oldFactor === factor) {
-	    return;
-	}
-
-	let items = container.query('>'); // direct childs
-	factor = Math.min(factor, items.length);
-	container.oldFactor = factor;
-
-	items.forEach((item) => {
-	    item.columnWidth = 1 / factor;
-	});
-
-	// we have to update the layout twice, since the first layout change
-	// can trigger the scrollbar which reduces the amount of space left
-	container.updateLayout();
-	container.updateLayout();
-    },
-
     forEachCorosyncLink: function(nodeinfo, cb) {
 	let re = /(?:ring|link)(\d+)_addr/;
 	Ext.iterate(nodeinfo, (prop, val) => {
diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index 67d5e95b..e845c261 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -75,7 +75,7 @@ Ext.define('PVE.dc.Summary', {
 
     listeners: {
 	resize: function(panel) {
-	    PVE.Utils.updateColumns(panel);
+	    Proxmox.Utils.updateColumns(panel);
 	},
     },
 
@@ -291,7 +291,7 @@ Ext.define('PVE.dc.Summary', {
 	    if (key !== 'summarycolumns') {
 		return;
 	    }
-	    PVE.Utils.updateColumns(me);
+	    Proxmox.Utils.updateColumns(me);
 	});
 
 	rstore.startUpdate();
diff --git a/www/manager6/node/Summary.js b/www/manager6/node/Summary.js
index ccddd5a0..1c93ef04 100644
--- a/www/manager6/node/Summary.js
+++ b/www/manager6/node/Summary.js
@@ -161,7 +161,7 @@ Ext.define('PVE.node.Summary', {
 		    ],
 		    listeners: {
 			resize: function(panel) {
-			    PVE.Utils.updateColumns(panel);
+			    Proxmox.Utils.updateColumns(panel);
 			},
 		    },
 		},
@@ -186,7 +186,7 @@ Ext.define('PVE.node.Summary', {
 	    if (key !== 'summarycolumns') {
 		return;
 	    }
-	    PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+	    Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
 	});
     },
 });
diff --git a/www/manager6/panel/GuestSummary.js b/www/manager6/panel/GuestSummary.js
index 9dc69913..7061b1a4 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -120,7 +120,7 @@ Ext.define('PVE.qemu.Summary', {
 		    items: items,
 		    listeners: {
 			resize: function(container) {
-			    PVE.Utils.updateColumns(container);
+			    Proxmox.Utils.updateColumns(container);
 			},
 		    },
 		},
@@ -137,7 +137,7 @@ Ext.define('PVE.qemu.Summary', {
 	    if (key !== 'summarycolumns') {
 		return;
 	    }
-	    PVE.Utils.updateColumns(me.getComponent('itemcontainer'));
+	    Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
 	});
     },
 });
-- 
2.20.1





  parent reply	other threads:[~2021-04-19 11:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 11:00 [pve-devel] [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 1/4] Utils: add several render functions from PVE Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 2/4] bring over some icons " Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 3/4] Utils: refactor updateColumns from pve-manager Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH widget-toolkit 4/4] panel: add StatusView from PVE Dominik Csapak
2021-04-22 18:38   ` [pve-devel] applied: " Thomas Lamprecht
2021-04-19 11:00 ` [pve-devel] [PATCH manager 1/4] ui: Utils: use render functions from widget-toolkit Dominik Csapak
2021-04-19 11:00 ` [pve-devel] [PATCH manager 2/4] ui: use some icons " Dominik Csapak
2021-04-19 11:00 ` Dominik Csapak [this message]
2021-04-19 11:00 ` [pve-devel] [PATCH manager 4/4] ui: panel/StatusView: use from widget-toolkit instead Dominik Csapak
2021-04-22 18:41 ` [pve-devel] applied: [PATCH widget-toolkit/pve-manager] move some code to widget-toolkit Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419110048.20791-8-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal