From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 4C1DD1FF168 for ; Tue, 12 Nov 2024 12:45:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D9F221E790; Tue, 12 Nov 2024 12:45:39 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Tue, 12 Nov 2024 12:45:06 +0100 Message-Id: <20241112114506.1970103-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241112114506.1970103-1-d.csapak@proxmox.com> References: <20241112114506.1970103-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 3/3] ui: resource tree: show nodes/storages in pool/tag view by default 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" and make it configurable in the tree browser settings. this makes now use of the new sorting order and the more efficient 'getFilterFn' method of the viewSelector Signed-off-by: Dominik Csapak --- not sure if we should make each option seperate, so either separate options for tag/pool view or separate options for nodes/storages (sdn maybe too?) or both (that would be 4 new options) www/manager6/UIOptions.js | 1 + www/manager6/form/ViewSelector.js | 16 ++++++++++++++-- www/manager6/tree/ResourceTree.js | 2 +- www/manager6/window/TreeSettingsEdit.js | 13 +++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/www/manager6/UIOptions.js b/www/manager6/UIOptions.js index 057c8f03..97b689b0 100644 --- a/www/manager6/UIOptions.js +++ b/www/manager6/UIOptions.js @@ -93,6 +93,7 @@ Ext.define('PVE.UIOptions', { 'sort-field': 'vmid', 'group-templates': true, 'group-guest-types': true, + 'more-types': true, }; return browserValues?.[key] ?? defaults[key]; diff --git a/www/manager6/form/ViewSelector.js b/www/manager6/form/ViewSelector.js index f5de5c8e..8c656fc8 100644 --- a/www/manager6/form/ViewSelector.js +++ b/www/manager6/form/ViewSelector.js @@ -30,12 +30,24 @@ Ext.define('PVE.form.ViewSelector', { text: gettext('Pool View'), groups: ['pool'], // Pool View only lists VMs and Containers - getFilterFn: () => ({ data }) => data.type === 'qemu' || data.type === 'lxc' || data.type === 'pool', + getFilterFn: function() { + let types = ['qemu', 'lxc', 'pool']; + if (PVE.UIOptions.getTreeSortingValue('more-types')) { + types.push('node', 'storage'); + } + return ({data}) => types.indexOf(data.type) !== -1; + }, }, tags: { text: gettext('Tag View'), groups: ['tag'], - getFilterFn: () => ({ data }) => data.type === 'qemu' || data.type === 'lxc', + getFilterFn: function() { + let types = ['qemu', 'lxc']; + if (PVE.UIOptions.getTreeSortingValue('more-types')) { + types.push('node', 'storage'); + } + return ({data}) => types.indexOf(data.type) !== -1; + }, groupRenderer: function(info) { let tag = PVE.Utils.renderTags(info.tag, PVE.UIOptions.tagOverrides); return `${tag}`; diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js index 312f958f..0440d9c2 100644 --- a/www/manager6/tree/ResourceTree.js +++ b/www/manager6/tree/ResourceTree.js @@ -242,7 +242,7 @@ Ext.define('PVE.tree.ResourceTree', { saveSortingOptions: function() { let me = this; let changed = false; - for (const key of ['sort-field', 'group-templates', 'group-guest-types']) { + for (const key of ['sort-field', 'group-templates', 'group-guest-types', 'more-types']) { let newValue = PVE.UIOptions.getTreeSortingValue(key); if (me[key] !== newValue) { me[key] = newValue; diff --git a/www/manager6/window/TreeSettingsEdit.js b/www/manager6/window/TreeSettingsEdit.js index b48415bc..ef2eda4a 100644 --- a/www/manager6/window/TreeSettingsEdit.js +++ b/www/manager6/window/TreeSettingsEdit.js @@ -55,6 +55,19 @@ Ext.define('PVE.window.TreeSettingsEdit', { value: '__default__', deleteEmpty: false, }, + { + xtype: 'proxmoxKVComboBox', + name: 'more-types', + fieldLabel: gettext('Show Nodes/Storages in Pool/Tag View'), + comboItems: [ + ['__default__', `${Proxmox.Utils.defaultText} (${gettext("Yes")})`], + [1, gettext('Yes')], + [0, gettext('No')], + ], + defaultValue: '__default__', + value: '__default__', + deleteEmpty: false, + }, { xtype: 'displayfield', userCls: 'pmx-hint', -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel