From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 336A674872
 for <pbs-devel@lists.proxmox.com>; Mon, 19 Apr 2021 13:02:11 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 2FB9914FCC
 for <pbs-devel@lists.proxmox.com>; Mon, 19 Apr 2021 13:02:11 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 89B8214F66
 for <pbs-devel@lists.proxmox.com>; Mon, 19 Apr 2021 13:02:08 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 52A0742DD3
 for <pbs-devel@lists.proxmox.com>; Mon, 19 Apr 2021 13:02:08 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Mon, 19 Apr 2021 13:02:06 +0200
Message-Id: <20210419110206.28498-7-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210419110206.28498-1-d.csapak@proxmox.com>
References: <20210419110206.28498-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.158 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pbs-devel] [PATCH proxmox-backup 6/6] ui: window/Settings: add
 summarycolumns settings
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 19 Apr 2021 11:02:11 -0000

like in pve

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/Dashboard.js         | 15 +++++++++++++++
 www/ServerStatus.js      | 13 +++++++++++++
 www/datastore/Summary.js | 11 +++++++++++
 www/window/Settings.js   | 26 ++++++++++++++++++++++++++
 4 files changed, 65 insertions(+)

diff --git a/www/Dashboard.js b/www/Dashboard.js
index c4d2dfa9..18f174fe 100644
--- a/www/Dashboard.js
+++ b/www/Dashboard.js
@@ -111,6 +111,13 @@ Ext.define('PBS.Dashboard', {
 	    var sp = Ext.state.Manager.getProvider();
 	    var days = sp.get('dashboard-days') || 30;
 	    me.setDays(days, false);
+
+	    view.mon(sp, 'statechange', function(provider, key, value) {
+		if (key !== 'summarycolumns') {
+		    return;
+		}
+		Proxmox.Utils.updateColumns(view);
+	    });
 	},
     },
 
@@ -162,6 +169,12 @@ Ext.define('PBS.Dashboard', {
 	},
     },
 
+    listeners: {
+	resize: function(panel) {
+	    Proxmox.Utils.updateColumns(panel);
+	},
+    },
+
     title: gettext('Dashboard'),
 
     layout: {
@@ -170,6 +183,8 @@ Ext.define('PBS.Dashboard', {
 
     bodyPadding: '20 0 0 20',
 
+    minWidth: 700,
+
     defaults: {
 	columnWidth: 0.49,
 	xtype: 'panel',
diff --git a/www/ServerStatus.js b/www/ServerStatus.js
index 8cb9f221..d74253d5 100644
--- a/www/ServerStatus.js
+++ b/www/ServerStatus.js
@@ -186,6 +186,11 @@ Ext.define('PBS.ServerStatus', {
 	    itemId: 'itemcontainer',
 	    layout: 'column',
 	    minWidth: 700,
+	    listeners: {
+		resize: function(panel) {
+		    Proxmox.Utils.updateColumns(panel);
+		},
+	    },
 	    defaults: {
 		minHeight: 320,
 		padding: 5,
@@ -267,6 +272,14 @@ Ext.define('PBS.ServerStatus', {
 	};
 
 	me.callParent();
+
+	let sp = Ext.state.Manager.getProvider();
+	me.mon(sp, 'statechange', function(provider, key, value) {
+	    if (key !== 'summarycolumns') {
+		return;
+	    }
+	    Proxmox.Utils.updateColumns(me.getComponent('itemcontainer'));
+	});
     },
 
 });
diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index 25a7b6e5..80f82409 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -244,6 +244,9 @@ Ext.define('PBS.DataStoreSummary', {
 	activate: function() { this.rrdstore.startUpdate(); },
 	deactivate: function() { this.rrdstore.stopUpdate(); },
 	destroy: function() { this.rrdstore.stopUpdate(); },
+	resize: function(panel) {
+	    Proxmox.Utils.updateColumns(panel);
+	},
     },
 
     initComponent: function() {
@@ -256,6 +259,14 @@ Ext.define('PBS.DataStoreSummary', {
 
 	me.callParent();
 
+	let sp = Ext.state.Manager.getProvider();
+	me.mon(sp, 'statechange', function(provider, key, value) {
+	    if (key !== 'summarycolumns') {
+		return;
+	    }
+	    Proxmox.Utils.updateColumns(me);
+	});
+
 	Proxmox.Utils.API2Request({
 	    url: `/config/datastore/${me.datastore}`,
 	    waitMsgTarget: me.down('pbsDataStoreInfo'),
diff --git a/www/window/Settings.js b/www/window/Settings.js
index ee8464be..763cefab 100644
--- a/www/window/Settings.js
+++ b/www/window/Settings.js
@@ -30,6 +30,9 @@ Ext.define('PBS.window.Settings', {
 	    let username = sp.get('login-username') || Proxmox.Utils.noneText;
 	    me.lookupReference('savedUserName').setValue(Ext.String.htmlEncode(username));
 
+	    let summarycolumns = sp.get('summarycolumns', 'auto');
+	    me.lookup('summarycolumns').setValue(summarycolumns);
+
 	    let settings = ['fontSize', 'fontFamily', 'letterSpacing', 'lineHeight'];
 	    settings.forEach(function(setting) {
 		let val = localStorage.getItem('pve-xterm-' + setting);
@@ -114,6 +117,12 @@ Ext.define('PBS.window.Settings', {
 		    sp.clear('login-username');
 		},
 	    },
+	    'field[reference=summarycolumns]': {
+		change: function(el, newValue) {
+		    var sp = Ext.state.Manager.getProvider();
+		    sp.set('summarycolumns', newValue);
+		},
+	    },
 	},
     },
 
@@ -174,6 +183,23 @@ Ext.define('PBS.window.Settings', {
 		    },
 		],
 	    },
+	    {
+		xtype: 'box',
+		autoEl: { tag: 'hr' },
+	    },
+	    {
+		xtype: 'proxmoxKVComboBox',
+		fieldLabel: gettext('Summary/Dashboard columns') + ':',
+		labelWidth: 150,
+		stateId: 'summarycolumns',
+		reference: 'summarycolumns',
+		comboItems: [
+		    ['auto', 'auto'],
+		    ['1', '1'],
+		    ['2', '2'],
+		    ['3', '3'],
+		],
+	    },
 	],
     },
     {
-- 
2.20.1