]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: utils: add render_next_event
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 13 Jan 2022 15:48:44 +0000 (16:48 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 13 Jan 2022 15:55:15 +0000 (16:55 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/Utils.js

index 5e9c39ed18cdd61a30fd7ae3e876ba70fc02aa15..aafe359aee5e50c5b8d7d37af7fa8e7717423fcc 100644 (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 ||