From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/2] ui: group storages in folder view
Date: Wed, 14 Jun 2023 11:50:47 +0200 [thread overview]
Message-ID: <20230614095047.2132289-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20230614095047.2132289-1-d.csapak@proxmox.com>
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 <d.csapak@proxmox.com>
---
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
prev parent reply other threads:[~2023-06-14 9:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 9:50 [pve-devel] [PATCH manager 1/2] ui: config panel: only set onlineHelp if it exists Dominik Csapak
2023-06-14 9:50 ` Dominik Csapak [this message]
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=20230614095047.2132289-2-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