* [pve-devel] [PATCH manager] fix #7191: ui: correctly sort TFA column in DC/Permission/Users
@ 2026-01-09 9:35 Dominik Csapak
2026-03-09 20:35 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2026-01-09 9:35 UTC (permalink / raw)
To: 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 <d.csapak@proxmox.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* applied: [pve-devel] [PATCH manager] fix #7191: ui: correctly sort TFA column in DC/Permission/Users
2026-01-09 9:35 [pve-devel] [PATCH manager] fix #7191: ui: correctly sort TFA column in DC/Permission/Users Dominik Csapak
@ 2026-03-09 20:35 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-03-09 20:35 UTC (permalink / raw)
To: pve-devel, Dominik Csapak
On Fri, 09 Jan 2026 10:35:07 +0100, Dominik Csapak wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] fix #7191: ui: correctly sort TFA column in DC/Permission/Users
commit: e410565e04986649174fa201603089204459131e
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-09 20:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-09 9:35 [pve-devel] [PATCH manager] fix #7191: ui: correctly sort TFA column in DC/Permission/Users Dominik Csapak
2026-03-09 20:35 ` applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox