ui: utils: add render_next_event

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-01-13 16:48:44 +01:00
parent 6a45a9cd69
commit 7ce62ab3ad

View File

@ -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 ||