ARTEMIS-3632 add absolute timestamp for expiry times (after the relative timestamp, only in the details panel)

This commit is contained in:
Erwin Dondorp 2021-12-23 17:41:04 +01:00 committed by Justin Bertram
parent 303eeb75bf
commit 4179de9e36
No known key found for this signature in database
GPG Key ID: F41830B875BB8633
1 changed files with 12 additions and 6 deletions

View File

@ -303,7 +303,7 @@ var Artemis;
itemField: 'expiration', itemField: 'expiration',
header: 'Expires', header: 'Expires',
templateFn: function(value) { templateFn: function(value) {
return formatExpires(value); return formatExpires(value, false);
} }
}, },
{ {
@ -464,7 +464,7 @@ var Artemis;
return (value < 10 ? '0' : '') + value; return (value < 10 ? '0' : '') + value;
} }
function formatExpires(timestamp) { function formatExpires(timestamp, addTimestamp) {
if (isNaN(timestamp) || typeof timestamp !== "number") { if (isNaN(timestamp) || typeof timestamp !== "number") {
return timestamp; return timestamp;
} }
@ -477,12 +477,18 @@ var Artemis;
var hours = pad2(Math.floor((duration / MS_PER_HOUR) % 24)); var hours = pad2(Math.floor((duration / MS_PER_HOUR) % 24));
var mins = pad2(Math.floor((duration / MS_PER_MIN) % 60)); var mins = pad2(Math.floor((duration / MS_PER_MIN) % 60));
var secs = pad2(Math.floor((duration / MS_PER_SEC) % 60)); var secs = pad2(Math.floor((duration / MS_PER_SEC) % 60));
var ret;
if (expiresIn < 0) { if (expiresIn < 0) {
// "HH:mm:ss ago" // "HH:mm:ss ago"
return hours + ":" + mins + ":" + secs + " ago"; ret = hours + ":" + mins + ":" + secs + " ago";
} else {
// "in HH:mm:ss"
ret = "in " + hours + ":" + mins + ":" + secs;
} }
// "in HH:mm:ss" if (addTimestamp) {
return "in " + hours + ":" + mins + ":" + secs; ret += ", at " + formatTimestamp(timestamp);
}
return ret;
} }
return formatTimestamp(timestamp); return formatTimestamp(timestamp);
} }
@ -804,7 +810,7 @@ var Artemis;
angular.forEach(message, function (value, key) { angular.forEach(message, function (value, key) {
if (!_.some(ignoreColumns, function (k) { return k === key; }) && !_.some(flattenColumns, function (k) { return k === key; })) { if (!_.some(ignoreColumns, function (k) { return k === key; }) && !_.some(flattenColumns, function (k) { return k === key; })) {
if(key === "expiration") { if(key === "expiration") {
value += " (" + formatExpires(value) + ")"; value += " (" + formatExpires(value, true) + ")";
} else if(key === "persistentSize") { } else if(key === "persistentSize") {
value += " (" + formatPersistentSize(value) + ")"; value += " (" + formatPersistentSize(value) + ")";
} else if(key === "timestamp") { } else if(key === "timestamp") {