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 E04C6696A8 for ; Fri, 13 Nov 2020 14:16:46 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 221511B410 for ; Fri, 13 Nov 2020 14:16:46 +0100 (CET) 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 76EAF1B19C for ; Fri, 13 Nov 2020 14:16:40 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C5D3A42D3E for ; Fri, 13 Nov 2020 14:16:39 +0100 (CET) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Fri, 13 Nov 2020 14:16:30 +0100 Message-Id: <20201113131633.21915-18-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201113131633.21915-1-f.ebner@proxmox.com> References: <20201113131633.21915-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.023 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [me.store, sencha.com] Subject: [pve-devel] [PATCH v3 manager 17/20] group backups by backup groups in backup 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: Fri, 13 Nov 2020 13:16:46 -0000 It was necessary to make the component not stateful, because of an ExtJS bug where groupFn is not being preserved when the state is restored, see: https://forum.sencha.com/forum/showthread.php?469145-Uncaught-TypeError-me-_groupFn-is-not-a-function Signed-off-by: Fabian Ebner --- www/manager6/storage/BackupView.js | 26 ++++++++++++++++++++++++-- www/manager6/storage/ContentView.js | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/www/manager6/storage/BackupView.js b/www/manager6/storage/BackupView.js index 2669d2ca..9ced7947 100644 --- a/www/manager6/storage/BackupView.js +++ b/www/manager6/storage/BackupView.js @@ -3,8 +3,12 @@ Ext.define('PVE.storage.BackupView', { alias: 'widget.pveStorageBackupView', - stateful: true, - stateId: 'grid-storage-content-backup', + features: [ + { + ftype: 'grouping', + groupHeaderTpl: '{name} ({rows.length} Backup{[values.rows.length > 1 ? "s" : ""]})', + }, + ], initComponent: function() { var me = this; @@ -69,6 +73,24 @@ Ext.define('PVE.storage.BackupView', { }, ]; + me.grouper = Ext.create('Ext.util.Grouper', { + groupFn: function(val) { + let name = val.data.text; + let vmid = val.data.vmid; + let format = val.data.format; + + if (!vmid) { + return 'other'; + } + if (name.startsWith('vzdump-lxc-') || format === "pbs-ct") { + return 'CT/' + vmid; + } else if (name.startsWith('vzdump-qemu-') || format === "pbs-vm") { + return 'VM/' + vmid; + } + return 'other'; + }, + }); + me.callParent(); }, }); diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js index 38dd5cab..1cd13c0e 100644 --- a/www/manager6/storage/ContentView.js +++ b/www/manager6/storage/ContentView.js @@ -232,6 +232,7 @@ Ext.define('PVE.storage.ContentView', { var baseurl = "/nodes/" + nodename + "/storage/" + storage + "/content"; var store = me.store = Ext.create('Ext.data.Store', { model: 'pve-storage-content', + grouper: me.grouper, proxy: { type: 'proxmox', url: '/api2/json' + baseurl, -- 2.20.1