Use ModifyTime instead of ModifyIndex
This commit is contained in:
parent
2a69339ef8
commit
54cb23c577
|
@ -27,6 +27,7 @@ export default Model.extend({
|
||||||
taskGroupName: attr('string'),
|
taskGroupName: attr('string'),
|
||||||
resources: fragment('resources'),
|
resources: fragment('resources'),
|
||||||
modifyIndex: attr('number'),
|
modifyIndex: attr('number'),
|
||||||
|
modifyTime: attr('date'),
|
||||||
jobVersion: attr('number'),
|
jobVersion: attr('number'),
|
||||||
|
|
||||||
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
||||||
|
|
|
@ -35,6 +35,9 @@ export default ApplicationSerializer.extend({
|
||||||
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
// TEMPORARY: https://github.com/emberjs/data/issues/5209
|
||||||
hash.OriginalJobId = hash.JobID;
|
hash.OriginalJobId = hash.JobID;
|
||||||
|
|
||||||
|
hash.ModifyTimeNanos = hash.ModifyTime % 1000000;
|
||||||
|
hash.ModifyTime = Math.floor(hash.ModifyTime / 1000000);
|
||||||
|
|
||||||
return this._super(typeHash, hash);
|
return this._super(typeHash, hash);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,8 +6,8 @@ export default ApplicationSerializer.extend({
|
||||||
// only understand time to the millisecond precision. So store
|
// only understand time to the millisecond precision. So store
|
||||||
// the time (precise to ms) as a date, and store the remaining ns
|
// the time (precise to ms) as a date, and store the remaining ns
|
||||||
// as a number to deal with when it comes up.
|
// as a number to deal with when it comes up.
|
||||||
hash.Time = Math.floor(hash.Time / 1000000);
|
|
||||||
hash.TimeNanos = hash.Time % 1000000;
|
hash.TimeNanos = hash.Time % 1000000;
|
||||||
|
hash.Time = Math.floor(hash.Time / 1000000);
|
||||||
|
|
||||||
return this._super(typeHash, hash);
|
return this._super(typeHash, hash);
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{{allocation.shortId}}
|
{{allocation.shortId}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{allocation.modifyIndex}}</td>
|
<td>{{moment-format allocation.modifyTime "MM/DD HH:mm:ss"}}</td>
|
||||||
<td>{{allocation.name}}</td>
|
<td>{{allocation.name}}</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="color-swatch {{allocation.clientStatus}}" /> {{allocation.clientStatus}}
|
<span class="color-swatch {{allocation.clientStatus}}" /> {{allocation.clientStatus}}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { provide, pickOne } from '../utils';
|
||||||
const UUIDS = provide(100, faker.random.uuid.bind(faker.random));
|
const UUIDS = provide(100, faker.random.uuid.bind(faker.random));
|
||||||
const CLIENT_STATUSES = ['pending', 'running', 'complete', 'failed', 'lost'];
|
const CLIENT_STATUSES = ['pending', 'running', 'complete', 'failed', 'lost'];
|
||||||
const DESIRED_STATUSES = ['run', 'stop', 'evict'];
|
const DESIRED_STATUSES = ['run', 'stop', 'evict'];
|
||||||
|
const REF_TIME = new Date();
|
||||||
|
|
||||||
export default Factory.extend({
|
export default Factory.extend({
|
||||||
id: i => (i >= 100 ? `${UUIDS[i % 100]}-${i}` : UUIDS[i]),
|
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 }),
|
modifyIndex: () => faker.random.number({ min: 10, max: 2000 }),
|
||||||
jobVersion: () => faker.random.number(10),
|
jobVersion: () => faker.random.number(10),
|
||||||
|
|
||||||
|
modifyTime: () => faker.date.past(2 / 365, REF_TIME) * 1000000,
|
||||||
|
|
||||||
clientStatus: faker.list.random(...CLIENT_STATUSES),
|
clientStatus: faker.list.random(...CLIENT_STATUSES),
|
||||||
desiredStatus: faker.list.random(...DESIRED_STATUSES),
|
desiredStatus: faker.list.random(...DESIRED_STATUSES),
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { click, find, findAll, currentURL, visit } from 'ember-native-dom-helper
|
||||||
import { test } from 'qunit';
|
import { test } from 'qunit';
|
||||||
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
||||||
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
const { $ } = Ember;
|
const { $ } = Ember;
|
||||||
|
|
||||||
|
@ -127,8 +128,8 @@ test('each allocation should have high-level details for the allocation', functi
|
||||||
.find('td:eq(1)')
|
.find('td:eq(1)')
|
||||||
.text()
|
.text()
|
||||||
.trim(),
|
.trim(),
|
||||||
allocation.modifyIndex,
|
moment(allocation.modifyTime / 1000000).format('MM/DD HH:mm:ss'),
|
||||||
'Allocation modify index'
|
'Allocation modify time'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
allocationRow
|
allocationRow
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { click, find, findAll, fillIn, currentURL, visit } from 'ember-native-do
|
||||||
import { test } from 'qunit';
|
import { test } from 'qunit';
|
||||||
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'nomad-ui/tests/helpers/module-for-acceptance';
|
||||||
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
import { formatBytes } from 'nomad-ui/helpers/format-bytes';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
const { $ } = Ember;
|
const { $ } = Ember;
|
||||||
|
|
||||||
|
@ -157,8 +158,8 @@ test('each allocation should show basic information about the allocation', funct
|
||||||
.find('td:eq(1)')
|
.find('td:eq(1)')
|
||||||
.text()
|
.text()
|
||||||
.trim(),
|
.trim(),
|
||||||
allocation.modifyIndex,
|
moment(allocation.modifyTime / 1000000).format('MM/DD HH:mm:ss'),
|
||||||
'Allocation modify index'
|
'Allocation modify time'
|
||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
allocationRow
|
allocationRow
|
||||||
|
|
Loading…
Reference in a new issue