From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 F006CA125C for ; Wed, 14 Jun 2023 11:51:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D803D1A0B1 for ; Wed, 14 Jun 2023 11:50:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Wed, 14 Jun 2023 11:50:48 +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 8745D45525 for ; Wed, 14 Jun 2023 11:50:48 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Wed, 14 Jun 2023 11:50:47 +0200 Message-Id: <20230614095047.2132289-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230614095047.2132289-1-d.csapak@proxmox.com> References: <20230614095047.2132289-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH manager 2/2] ui: group storages in folder view X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2023 09:51:20 -0000 so if there are many storages and/or nodes, it makes the list of storages a bit clearer to do that we have to add a virtual field to group by that is not the same as the 'type' of the individual entries (otherwise the grouping logic does insert them wrong) to not pollute the column list in the search grids, we only include the ones with 'header' or 'text' property (without those, the columsn would show up with an empty string) Signed-off-by: Dominik Csapak --- www/manager6/data/ResourceStore.js | 10 +++++++++- www/manager6/form/ViewSelector.js | 2 +- www/manager6/tree/ResourceTree.js | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/www/manager6/data/ResourceStore.js b/www/manager6/data/ResourceStore.js index 871d5145..a4f16b87 100644 --- a/www/manager6/data/ResourceStore.js +++ b/www/manager6/data/ResourceStore.js @@ -256,6 +256,12 @@ Ext.define('PVE.data.ResourceStore', { sortable: true, width: 110, }, + // to group them, we need a field that is not named like the type + storageGroup: { + type: 'string', + hidden: true, + calculate: (data) => data.storage, + }, pool: { header: gettext('Pool'), type: 'string', @@ -354,7 +360,9 @@ Ext.define('PVE.data.ResourceStore', { let res = []; Ext.Object.each(field_defaults, function(field, info) { let fieldInfo = Ext.apply({ dataIndex: field }, info); - res.push(fieldInfo); + if (fieldInfo.header || fieldInfo.text) { + res.push(fieldInfo); + } }); return res; }, diff --git a/www/manager6/form/ViewSelector.js b/www/manager6/form/ViewSelector.js index e25547c4..222d80e7 100644 --- a/www/manager6/form/ViewSelector.js +++ b/www/manager6/form/ViewSelector.js @@ -24,7 +24,7 @@ Ext.define('PVE.form.ViewSelector', { }, folder: { text: gettext('Folder View'), - groups: ['type'], + groups: ['type', 'storageGroup'], }, pool: { text: gettext('Pool View'), diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js index 54c6403d..d9f17be3 100644 --- a/www/manager6/tree/ResourceTree.js +++ b/www/manager6/tree/ResourceTree.js @@ -21,6 +21,9 @@ Ext.define('PVE.tree.ResourceTree', { iconCls: 'fa fa-database', text: gettext('Storage'), }, + storageGroup: { + iconCls: 'fa fa-database', + }, sdn: { iconCls: 'fa fa-th', text: gettext('SDN'), -- 2.30.2