diff --git a/ui/app/models/allocation.js b/ui/app/models/allocation.js
index 7d3a680a23a..6cf164a41e8 100644
--- a/ui/app/models/allocation.js
+++ b/ui/app/models/allocation.js
@@ -27,6 +27,7 @@ export default Model.extend({
taskGroupName: attr('string'),
resources: fragment('resources'),
modifyIndex: attr('number'),
+ modifyTime: attr('date'),
jobVersion: attr('number'),
// TEMPORARY: https://github.com/emberjs/data/issues/5209
diff --git a/ui/app/serializers/allocation.js b/ui/app/serializers/allocation.js
index 32722fc5059..33cb3ebf5ad 100644
--- a/ui/app/serializers/allocation.js
+++ b/ui/app/serializers/allocation.js
@@ -35,6 +35,9 @@ export default ApplicationSerializer.extend({
// TEMPORARY: https://github.com/emberjs/data/issues/5209
hash.OriginalJobId = hash.JobID;
+ hash.ModifyTimeNanos = hash.ModifyTime % 1000000;
+ hash.ModifyTime = Math.floor(hash.ModifyTime / 1000000);
+
return this._super(typeHash, hash);
},
});
diff --git a/ui/app/serializers/task-event.js b/ui/app/serializers/task-event.js
index d4d30ded621..b5b7b0ce679 100644
--- a/ui/app/serializers/task-event.js
+++ b/ui/app/serializers/task-event.js
@@ -6,8 +6,8 @@ export default ApplicationSerializer.extend({
// only understand time to the millisecond precision. So store
// the time (precise to ms) as a date, and store the remaining ns
// as a number to deal with when it comes up.
- hash.Time = Math.floor(hash.Time / 1000000);
hash.TimeNanos = hash.Time % 1000000;
+ hash.Time = Math.floor(hash.Time / 1000000);
return this._super(typeHash, hash);
},
diff --git a/ui/app/templates/components/allocation-row.hbs b/ui/app/templates/components/allocation-row.hbs
index d61032cc3de..0820dfeb55e 100644
--- a/ui/app/templates/components/allocation-row.hbs
+++ b/ui/app/templates/components/allocation-row.hbs
@@ -3,7 +3,7 @@
{{allocation.shortId}}
{{/link-to}}
-
{{allocation.modifyIndex}} |
+{{moment-format allocation.modifyTime "MM/DD HH:mm:ss"}} |
{{allocation.name}} |
{{allocation.clientStatus}}
diff --git a/ui/mirage/factories/allocation.js b/ui/mirage/factories/allocation.js
index 1a19e4637ab..161f138e6ea 100644
--- a/ui/mirage/factories/allocation.js
+++ b/ui/mirage/factories/allocation.js
@@ -5,6 +5,7 @@ import { provide, pickOne } from '../utils';
const UUIDS = provide(100, faker.random.uuid.bind(faker.random));
const CLIENT_STATUSES = ['pending', 'running', 'complete', 'failed', 'lost'];
const DESIRED_STATUSES = ['run', 'stop', 'evict'];
+const REF_TIME = new Date();
export default Factory.extend({
id: i => (i >= 100 ? `${UUIDS[i % 100]}-${i}` : UUIDS[i]),
@@ -12,6 +13,8 @@ export default Factory.extend({
modifyIndex: () => faker.random.number({ min: 10, max: 2000 }),
jobVersion: () => faker.random.number(10),
+ modifyTime: () => faker.date.past(2 / 365, REF_TIME) * 1000000,
+
clientStatus: faker.list.random(...CLIENT_STATUSES),
desiredStatus: faker.list.random(...DESIRED_STATUSES),
diff --git a/ui/tests/acceptance/client-detail-test.js b/ui/tests/acceptance/client-detail-test.js
index 993277b8e1b..6cc1743ea02 100644
--- a/ui/tests/acceptance/client-detail-test.js
+++ b/ui/tests/acceptance/client-detail-test.js
@@ -3,6 +3,7 @@ import { click, find, findAll, currentURL, visit } from 'ember-native-dom-helper
import { test } from 'qunit';
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
+import moment from 'moment';
const { $ } = Ember;
@@ -127,8 +128,8 @@ test('each allocation should have high-level details for the allocation', functi
.find('td:eq(1)')
.text()
.trim(),
- allocation.modifyIndex,
- 'Allocation modify index'
+ moment(allocation.modifyTime / 1000000).format('MM/DD HH:mm:ss'),
+ 'Allocation modify time'
);
assert.equal(
allocationRow
diff --git a/ui/tests/acceptance/task-group-detail-test.js b/ui/tests/acceptance/task-group-detail-test.js
index 46de34968cb..e729e130035 100644
--- a/ui/tests/acceptance/task-group-detail-test.js
+++ b/ui/tests/acceptance/task-group-detail-test.js
@@ -3,6 +3,7 @@ import { click, find, findAll, fillIn, currentURL, visit } from 'ember-native-do
import { test } from 'qunit';
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
+import moment from 'moment';
const { $ } = Ember;
@@ -157,8 +158,8 @@ test('each allocation should show basic information about the allocation', funct
.find('td:eq(1)')
.text()
.trim(),
- allocation.modifyIndex,
- 'Allocation modify index'
+ moment(allocation.modifyTime / 1000000).format('MM/DD HH:mm:ss'),
+ 'Allocation modify time'
);
assert.equal(
allocationRow
|