From 7ce62ab3ad8ab63731beb5e0b89f14bceccf1ab8 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 13 Jan 2022 16:48:44 +0100 Subject: [PATCH] ui: utils: add render_next_event Signed-off-by: Thomas Lamprecht --- www/manager6/Utils.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 5e9c39ed..aafe359a 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -1099,6 +1099,18 @@ Ext.define('PVE.Utils', { return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s'); }, + // render a timestamp or pending + render_next_event: function(value) { + if (!value) { + return '-'; + } + let now = new Date(), next = new Date(value * 1000); + if (next < now) { + return gettext('pending'); + } + return Proxmox.Utils.render_timestamp(value); + }, + calculate_mem_usage: function(data) { if (!Ext.isNumeric(data.mem) || data.maxmem === 0 ||