[pmg-devel] [PATCH pmg-gui 2/2] dashboard: hide cluster resources if it's a single node

Fabian Ebner f.ebner at proxmox.com
Tue Jul 13 14:26:10 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Not sure about initially hiding or not. To avoid the component jumping
in (if initially hidden and it is a cluster) or out (if initially
visible and it is not a cluster), we'd need to wait for the cluster
status to load before rendering...

 js/Dashboard.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/js/Dashboard.js b/js/Dashboard.js
index 79817b3..8f08f8c 100644
--- a/js/Dashboard.js
+++ b/js/Dashboard.js
@@ -142,6 +142,9 @@ Ext.define('PMG.Dashboard', {
 
 	    me.lookup('nodeInfo').setSubscriptionStatus(subStatus);
 
+	    // the node info already displays this information in case there is no cluster
+	    me.lookup('clusterResources').setHidden(records.length === 1);
+
 	    cpu = cpu/count;
 	    mem = mem/count;
 	    hd = hd/count;
@@ -412,6 +415,8 @@ Ext.define('PMG.Dashboard', {
 	    height: 250,
 	    iconCls: 'fa fa-tasks',
 	    title: gettext('Cluster Resources (average)'),
+	    reference: 'clusterResources',
+	    hidden: true,
 	    bodyPadding: '0 20 0 20',
 	    layout: {
 		type: 'hbox',
-- 
2.30.2





More information about the pmg-devel mailing list