[pve-devel] [PATCH proxmox-widget-toolkit v2 2/3] fix #4546: utils: Highlight accounts in user management that exprie soon

Philipp Hufnagl p.hufnagl at proxmox.com
Tue Oct 10 12:40:31 CEST 2023


When a user account is about to expire in the next 7 days, the date
column will be highlighted with warning color.

Signed-off-by: Philipp Hufnagl <p.hufnagl at proxmox.com>
---
 src/Utils.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/Utils.js b/src/Utils.js
index f269607..f5769a0 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -174,10 +174,14 @@ utilities: {
 	return value ? Proxmox.Utils.enabledText : Proxmox.Utils.disabledText;
     },
 
-    format_expire: function(date) {
+    format_expire: function(date, meta) {
 	if (!date) {
 	    return Proxmox.Utils.neverText;
 	}
+	let expiryWarningThreshold = Ext.Date.add(new Date(), Ext.Date.DAY, 7);
+	if (expiryWarningThreshold >= date) {
+	    meta.tdCls += 'proxmox-warning-row';
+	}
 	return Ext.Date.format(date, "Y-m-d");
     },
 
-- 
2.39.2






More information about the pve-devel mailing list