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 781F21FF13F for ; Fri, 09 Jan 2026 10:35:45 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9511711002; Fri, 9 Jan 2026 10:35:44 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Fri, 9 Jan 2026 10:35:07 +0100 Message-ID: <20260109093511.1177868-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.032 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [record.data] Subject: [pve-devel] [PATCH manager] fix #7191: ui: correctly sort TFA column in DC/Permission/Users 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" ExtJS does not sort this column correctly since the field is not defined in our 'pmx-users' model, so it ignores it when sorting. Add the keys field to the model definition. This enables sorting, but does not take into account the additional info we use when rendering the column. To do that, use the rendered values as strings to sort them. Signed-off-by: Dominik Csapak --- www/manager6/Utils.js | 25 +++++++++++++++++++++++++ www/manager6/dc/UserView.js | 28 +++++----------------------- www/manager6/form/UserSelector.js | 1 + 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 0e0751e7..fee252e6 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -1363,6 +1363,31 @@ Ext.define('PVE.Utils', { return retVal.length < 1 ? value : retVal; }, + render_tfa: function (v, _mD, record) { + let tfa_type = PVE.Parser.parseTfaType(v); + if (tfa_type === undefined) { + return Proxmox.Utils.noText; + } + + if (tfa_type !== 1) { + return tfa_type; + } + + let locked_until = record.data['tfa-locked-until']; + if (locked_until !== undefined) { + let now = new Date().getTime() / 1000; + if (locked_until > now) { + return gettext('Locked'); + } + } + + if (record.data['totp-locked']) { + return gettext('TOTP Locked'); + } + + return Proxmox.Utils.yesText; + }, + windowHostname: function () { return window.location.hostname.replace( Proxmox.Utils.IP6_bracket_match, diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js index 9d33a5bf..279ed5fb 100644 --- a/www/manager6/dc/UserView.js +++ b/www/manager6/dc/UserView.js @@ -209,29 +209,11 @@ Ext.define('PVE.dc.UserView', { header: 'TFA', width: 120, sortable: true, - renderer: function (v, metaData, record) { - let tfa_type = PVE.Parser.parseTfaType(v); - if (tfa_type === undefined) { - return Proxmox.Utils.noText; - } - - if (tfa_type !== 1) { - return tfa_type; - } - - let locked_until = record.data['tfa-locked-until']; - if (locked_until !== undefined) { - let now = new Date().getTime() / 1000; - if (locked_until > now) { - return gettext('Locked'); - } - } - - if (record.data['totp-locked']) { - return gettext('TOTP Locked'); - } - - return Proxmox.Utils.yesText; + renderer: PVE.Utils.render_tfa, + sorter: function (a, b) { + let a_text = PVE.Utils.render_tfa(a.data.keys, undefined, a); + let b_text = PVE.Utils.render_tfa(b.data.keys, undefined, b); + return a_text.toString().localeCompare(b_text.toString()); }, dataIndex: 'keys', }, diff --git a/www/manager6/form/UserSelector.js b/www/manager6/form/UserSelector.js index f0bf6579..d49cce03 100644 --- a/www/manager6/form/UserSelector.js +++ b/www/manager6/form/UserSelector.js @@ -8,6 +8,7 @@ Ext.define('pmx-users', { 'comment', { type: 'boolean', name: 'enable' }, { type: 'date', dateFormat: 'timestamp', name: 'expire' }, + { type: 'string', name: 'keys' }, ], proxy: { type: 'proxmox', -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel