diff --git a/ui/app/helpers/format-date.js b/ui/app/helpers/format-date.js new file mode 100644 index 000000000..3668d6aa6 --- /dev/null +++ b/ui/app/helpers/format-date.js @@ -0,0 +1,9 @@ +import moment from 'moment'; +import Helper from '@ember/component/helper'; + +export function formatTs([date]) { + const format = 'MMMM D, YYYY'; + return moment(date).format(format); +} + +export default Helper.helper(formatTs); diff --git a/ui/app/helpers/format-month-ts.js b/ui/app/helpers/format-month-ts.js new file mode 100644 index 000000000..a787d6b5e --- /dev/null +++ b/ui/app/helpers/format-month-ts.js @@ -0,0 +1,9 @@ +import moment from 'moment'; +import Helper from '@ember/component/helper'; + +export function formatMonthTs([date]) { + const format = 'MMM DD HH:mm:ss ZZ'; + return moment(date).format(format); +} + +export default Helper.helper(formatMonthTs); diff --git a/ui/app/helpers/format-ts.js b/ui/app/helpers/format-ts.js new file mode 100644 index 000000000..10e1bb809 --- /dev/null +++ b/ui/app/helpers/format-ts.js @@ -0,0 +1,9 @@ +import moment from 'moment'; +import Helper from '@ember/component/helper'; + +export function formatTs([date]) { + const format = "MMM DD, 'YY HH:mm:ss ZZ"; + return moment(date).format(format); +} + +export default Helper.helper(formatTs); diff --git a/ui/app/templates/allocations/allocation/task/index.hbs b/ui/app/templates/allocations/allocation/task/index.hbs index ae6523c01..a5496391a 100644 --- a/ui/app/templates/allocations/allocation/task/index.hbs +++ b/ui/app/templates/allocations/allocation/task/index.hbs @@ -10,12 +10,12 @@ Task Details Started At - {{moment-format model.startedAt "MM/DD/YY HH:mm:ss"}} + {{format-ts model.startedAt}} {{#if model.finishedAt}} Finished At - {{moment-format model.finishedAt "MM/DD/YY HH:mm:ss"}} + {{format-ts model.finishedAt}} {{/if}} @@ -89,7 +89,7 @@ {{/t.head}} {{#t.body as |row|}} - {{moment-format row.model.time "MM/DD/YY HH:mm:ss"}} + {{format-ts row.model.time}} {{row.model.type}} {{#if row.model.message}} diff --git a/ui/app/templates/clients/client.hbs b/ui/app/templates/clients/client.hbs index cb63f84cc..99e36f697 100644 --- a/ui/app/templates/clients/client.hbs +++ b/ui/app/templates/clients/client.hbs @@ -65,7 +65,7 @@ {{#if model.drainStrategy.forceDeadline}} Forced Deadline - {{moment-format model.drainStrategy.forceDeadline "MM/DD/YY HH:mm:ss"}} + {{format-ts model.drainStrategy.forceDeadline}} ({{moment-from-now model.drainStrategy.forceDeadline interval=1000}}) {{/if}} @@ -159,7 +159,7 @@ {{/t.head}} {{#t.body as |row|}} - {{moment-format row.model.time "MM/DD/YY HH:mm:ss"}} + {{format-ts row.model.time}} {{row.model.subsystem}} {{#if row.model.message}} @@ -204,7 +204,9 @@ Last Updated - {{moment-from-now a.item.updateTime interval=1000}} + + {{moment-from-now a.item.updateTime interval=1000}} + diff --git a/ui/app/templates/components/allocation-row.hbs b/ui/app/templates/components/allocation-row.hbs index ffdfb9a5e..1bd6c4ec3 100644 --- a/ui/app/templates/components/allocation-row.hbs +++ b/ui/app/templates/components/allocation-row.hbs @@ -22,8 +22,12 @@ {{/link-to}} {{/if}} -{{moment-format allocation.createTime "MM/DD HH:mm:ss"}} -{{moment-from-now allocation.modifyTime}} +{{format-month-ts allocation.createTime}} + + + {{moment-from-now allocation.modifyTime}} + + {{allocation.clientStatus}} diff --git a/ui/app/templates/components/freestyle/sg-inline-definitions.hbs b/ui/app/templates/components/freestyle/sg-inline-definitions.hbs index efca1ec81..ca51f9c01 100644 --- a/ui/app/templates/components/freestyle/sg-inline-definitions.hbs +++ b/ui/app/templates/components/freestyle/sg-inline-definitions.hbs @@ -12,7 +12,7 @@ Last Updated - {{moment-format (now)}} + {{format-ts (now)}} @@ -31,7 +31,7 @@ Last Updated - {{moment-format (now)}} + {{format-ts (now)}} @@ -44,7 +44,7 @@ Last Updated - {{moment-format (now)}} + {{format-ts (now)}} @@ -57,7 +57,7 @@ Last Updated - {{moment-format (now)}} + {{format-ts (now)}} @@ -70,7 +70,7 @@ Last Updated - {{moment-format (now)}} + {{format-ts (now)}} diff --git a/ui/app/templates/components/freestyle/sg-timeline.hbs b/ui/app/templates/components/freestyle/sg-timeline.hbs index 21b6c9675..aa340515c 100644 --- a/ui/app/templates/components/freestyle/sg-timeline.hbs +++ b/ui/app/templates/components/freestyle/sg-timeline.hbs @@ -1,7 +1,7 @@ {{#freestyle-usage 'timeline' title="Simple Timeline"}}
  1. - {{moment-format yesterday "MMMM D, YYYY"}} + {{format-date yesterday}}
  2. @@ -18,7 +18,7 @@
  3. - {{moment-format today "MMMM D, YYYY"}} + {{format-date today}}
  4. @@ -38,7 +38,7 @@ {{#freestyle-usage 'timeline-intricate' title="Detailed Timeline"}}
    1. - {{moment-format today "MMMM D, YYYY"}} + {{format-date today}}
    2. @@ -50,7 +50,7 @@ Submitted - {{moment-from-now (now)}} + {{moment-from-now (now)}}
    @@ -65,13 +65,13 @@ Submitted - {{moment-format yesterday}} + {{format-month-ts yesterday}}
  5. - {{moment-format yesterday "MMMM D, YYYY"}} + {{format-date yesterday}}
  6. @@ -83,7 +83,7 @@ Submitted - {{moment-format yesterday}} + {{format-month-ts yesterday}}
    @@ -94,7 +94,7 @@ {{#freestyle-usage 'timeline-toggles' title='Toggling Timeline Objects'}}
    1. - {{moment-format today "MMMM D, YYYY"}} + {{format-date today}}
    2. @@ -118,7 +118,7 @@
    3. - {{moment-format yesterday "MMMM D, YYYY"}} + {{format-date yesterday}}
    4. @@ -147,7 +147,7 @@ {{#freestyle-usage 'timeline-emphasis' title='Emphasizing a Timeline Object'}}
      1. - {{moment-format today "MMMM D, YYYY"}} + {{format-date today}}
      2. @@ -158,7 +158,7 @@ Submitted - {{moment-from-now (now)}} + {{moment-from-now (now)}}
      @@ -175,13 +175,13 @@ Submitted - {{moment-format yesterday}} + {{format-ts yesterday}}
    5. - {{moment-format yesterday "MMMM D, YYYY"}} + {{format-date yesterday}}
    6. @@ -192,7 +192,7 @@ Submitted - {{moment-format yesterday}} + {{format-ts yesterday}}
      diff --git a/ui/app/templates/components/job-deployment.hbs b/ui/app/templates/components/job-deployment.hbs index ad24f628f..e67c0b0e9 100644 --- a/ui/app/templates/components/job-deployment.hbs +++ b/ui/app/templates/components/job-deployment.hbs @@ -8,7 +8,11 @@ Version #{{deployment.version.number}} - | {{moment-from-now deployment.version.submitTime}} + | + + {{moment-from-now deployment.version.submitTime}} + + diff --git a/ui/app/templates/components/job-deployment/task-groups.hbs b/ui/app/templates/components/job-deployment/task-groups.hbs index 9657b95f1..bc59f1080 100644 --- a/ui/app/templates/components/job-deployment/task-groups.hbs +++ b/ui/app/templates/components/job-deployment/task-groups.hbs @@ -32,7 +32,7 @@ {{row.model.healthyAllocs}} {{row.model.unhealthyAllocs}} - {{moment-format row.model.requireProgressBy "MM/DD/YY HH:mm:ss"}} + {{format-ts row.model.requireProgressBy}} {{/t.body}} diff --git a/ui/app/templates/components/job-deployments-stream.hbs b/ui/app/templates/components/job-deployments-stream.hbs index 347987787..f0e6ee290 100644 --- a/ui/app/templates/components/job-deployments-stream.hbs +++ b/ui/app/templates/components/job-deployments-stream.hbs @@ -2,7 +2,7 @@ {{#if record.meta.showDate}}
    7. {{#if record.deployment.version.submitTime}} - {{moment-format record.deployment.version.submitTime "MMMM D, YYYY"}} + {{format-date record.deployment.version.submitTime}} {{else}} Unknown time {{/if}} diff --git a/ui/app/templates/components/job-page/parts/latest-deployment.hbs b/ui/app/templates/components/job-page/parts/latest-deployment.hbs index a2a3aef3e..ffaef7112 100644 --- a/ui/app/templates/components/job-page/parts/latest-deployment.hbs +++ b/ui/app/templates/components/job-page/parts/latest-deployment.hbs @@ -5,7 +5,9 @@ {{if job.latestDeployment.isRunning "Active" "Latest"}} Deployment {{job.latestDeployment.shortId}} {{#if job.latestDeployment.version.submitTime}} - {{moment-from-now job.latestDeployment.version.submitTime}} + + {{moment-from-now job.latestDeployment.version.submitTime}} + {{/if}}
      diff --git a/ui/app/templates/components/job-version.hbs b/ui/app/templates/components/job-version.hbs index 45912ecd4..1ea2970e5 100644 --- a/ui/app/templates/components/job-version.hbs +++ b/ui/app/templates/components/job-version.hbs @@ -6,7 +6,7 @@ Submitted - {{moment-format version.submitTime "MM/DD/YY HH:mm:ss"}} + {{format-ts version.submitTime}} {{#if version.diff}} diff --git a/ui/app/templates/components/job-versions-stream.hbs b/ui/app/templates/components/job-versions-stream.hbs index 052b6a30b..ac346a65d 100644 --- a/ui/app/templates/components/job-versions-stream.hbs +++ b/ui/app/templates/components/job-versions-stream.hbs @@ -1,7 +1,7 @@ {{#each annotatedVersions key="version.id" as |record|}} {{#if record.meta.showDate}}
    8. - {{moment-format record.version.submitTime "MMMM D, YYYY"}} + {{format-date record.version.submitTime}}
    9. {{/if}}
    10. diff --git a/ui/app/templates/components/reschedule-event-row.hbs b/ui/app/templates/components/reschedule-event-row.hbs index 733358b3d..f1c9c3f91 100644 --- a/ui/app/templates/components/reschedule-event-row.hbs +++ b/ui/app/templates/components/reschedule-event-row.hbs @@ -2,7 +2,7 @@ {{#if label}} {{label}} {{/if}} - {{moment-format time "MMMM D, YYYY HH:mm:ss"}} + {{format-ts time}}
    11. diff --git a/ui/app/templates/components/reschedule-event-timeline.hbs b/ui/app/templates/components/reschedule-event-timeline.hbs index 1f2f5385c..fcbecbb34 100644 --- a/ui/app/templates/components/reschedule-event-timeline.hbs +++ b/ui/app/templates/components/reschedule-event-timeline.hbs @@ -13,7 +13,9 @@ {{#if (and allocation.followUpEvaluation.waitUntil (not allocation.nextAllocation))}}
    12. {{x-icon "clock" class="is-info is-text"}} Nomad will attempt to reschedule - {{moment-from-now allocation.followUpEvaluation.waitUntil interval=1000}} + + {{moment-from-now allocation.followUpEvaluation.waitUntil interval=1000}} +
    13. {{/if}} {{reschedule-event-row diff --git a/ui/app/templates/components/task-row.hbs b/ui/app/templates/components/task-row.hbs index 55961a778..03d83201c 100644 --- a/ui/app/templates/components/task-row.hbs +++ b/ui/app/templates/components/task-row.hbs @@ -18,7 +18,7 @@ No message {{/if}} -{{moment-format task.events.lastObject.time "MM/DD/YY HH:mm:ss"}} +{{format-ts task.events.lastObject.time}}
        {{#with task.resources.networks.firstObject as |network|}} diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index dba89d9b5..5569ae531 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -95,7 +95,7 @@ test('each task row should list high-level information for the task', function(a assert.equal(taskRow.message, event.displayMessage, 'Event Message'); assert.equal( taskRow.time, - moment(event.time / 1000000).format('MM/DD/YY HH:mm:ss'), + moment(event.time / 1000000).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Event Time' ); diff --git a/ui/tests/acceptance/client-detail-test.js b/ui/tests/acceptance/client-detail-test.js index 28e960ad2..edcd133c2 100644 --- a/ui/tests/acceptance/client-detail-test.js +++ b/ui/tests/acceptance/client-detail-test.js @@ -141,7 +141,7 @@ test('each allocation should have high-level details for the allocation', functi assert.equal(allocationRow.shortId, allocation.id.split('-')[0], 'Allocation short ID'); assert.equal( allocationRow.createTime, - moment(allocation.createTime / 1000000).format('MM/DD HH:mm:ss'), + moment(allocation.createTime / 1000000).format('MMM DD HH:mm:ss ZZ'), 'Allocation create time' ); assert.equal( @@ -319,7 +319,11 @@ test('each node event shows basic node event information', function(assert) { andThen(() => { const eventRow = ClientDetail.events.objectAt(0); - assert.equal(eventRow.time, moment(event.time).format('MM/DD/YY HH:mm:ss'), 'Event timestamp'); + assert.equal( + eventRow.time, + moment(event.time).format("MMM DD, 'YY HH:mm:ss ZZ"), + 'Event timestamp' + ); assert.equal(eventRow.subsystem, event.subsystem, 'Event subsystem'); assert.equal(eventRow.message, event.message, 'Event message'); }); @@ -452,7 +456,7 @@ test('when the node has a drain strategy with a positive deadline, the drain sta ); assert.ok( - ClientDetail.drain.forcedDeadline.includes(forceDeadline.format('MM/DD/YY HH:mm:ss')), + ClientDetail.drain.forcedDeadline.includes(forceDeadline.format("MMM DD, 'YY HH:mm:ss ZZ")), 'Force deadline is shown as an absolute date' ); diff --git a/ui/tests/acceptance/job-deployments-test.js b/ui/tests/acceptance/job-deployments-test.js index ba334ebba..b3395dfcc 100644 --- a/ui/tests/acceptance/job-deployments-test.js +++ b/ui/tests/acceptance/job-deployments-test.js @@ -204,7 +204,7 @@ test('when open, a deployment shows a list of all task groups and their respecti assert.equal(taskGroupRow.unhealthy, taskGroup.unhealthyAllocs, 'Unhealthy Allocs'); assert.equal( taskGroupRow.progress, - moment(taskGroup.requireProgressBy).format('MM/DD/YY HH:mm:ss'), + moment(taskGroup.requireProgressBy).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Progress By' ); }); diff --git a/ui/tests/acceptance/job-versions-test.js b/ui/tests/acceptance/job-versions-test.js index 067787c48..2fb505e46 100644 --- a/ui/tests/acceptance/job-versions-test.js +++ b/ui/tests/acceptance/job-versions-test.js @@ -21,7 +21,9 @@ test('/jobs/:id/versions should list all job versions', function(assert) { test('each version mentions the version number, the stability, and the submitted time', function(assert) { const version = versions.sortBy('submitTime').reverse()[0]; - const formattedSubmitTime = moment(version.submitTime / 1000000).format('MM/DD/YY HH:mm:ss'); + const formattedSubmitTime = moment(version.submitTime / 1000000).format( + "MMM DD, 'YY HH:mm:ss ZZ" + ); const versionRow = Versions.versions.objectAt(0); assert.ok(versionRow.text.includes(`Version #${version.version}`), 'Version #'); diff --git a/ui/tests/acceptance/task-detail-test.js b/ui/tests/acceptance/task-detail-test.js index aab5c954c..4dbef254e 100644 --- a/ui/tests/acceptance/task-detail-test.js +++ b/ui/tests/acceptance/task-detail-test.js @@ -24,7 +24,7 @@ test('/allocation/:id/:task_name should name the task and list high-level task i assert.ok(Task.state.includes(task.state), 'Task state'); assert.ok( - Task.startedAt.includes(moment(task.startedAt).format('MM/DD/YY HH:mm:ss')), + Task.startedAt.includes(moment(task.startedAt).format("MMM DD, 'YY HH:mm:ss ZZ")), 'Task started at' ); }); @@ -142,7 +142,7 @@ test('each recent event should list the time, type, and description of the event assert.equal( recentEvent.time, - moment(event.time / 1000000).format('MM/DD/YY HH:mm:ss'), + moment(event.time / 1000000).format("MMM DD, 'YY HH:mm:ss ZZ"), 'Event timestamp' ); assert.equal(recentEvent.type, event.type, 'Event type'); diff --git a/ui/tests/acceptance/task-group-detail-test.js b/ui/tests/acceptance/task-group-detail-test.js index 5f2efaab2..957a3b113 100644 --- a/ui/tests/acceptance/task-group-detail-test.js +++ b/ui/tests/acceptance/task-group-detail-test.js @@ -148,7 +148,7 @@ test('each allocation should show basic information about the allocation', funct assert.equal(allocationRow.shortId, allocation.id.split('-')[0], 'Allocation short id'); assert.equal( allocationRow.createTime, - moment(allocation.createTime / 1000000).format('MM/DD HH:mm:ss'), + moment(allocation.createTime / 1000000).format('MMM DD HH:mm:ss ZZ'), 'Allocation create time' ); assert.equal( diff --git a/ui/tests/integration/job-page/parts/latest-deployment-test.js b/ui/tests/integration/job-page/parts/latest-deployment-test.js index 7365dba30..f1d11038d 100644 --- a/ui/tests/integration/job-page/parts/latest-deployment-test.js +++ b/ui/tests/integration/job-page/parts/latest-deployment-test.js @@ -194,7 +194,7 @@ test('each task group in the expanded task group section shows task group detail assert.equal(findForTaskGroup('name').textContent.trim(), task.get('name')); assert.equal( findForTaskGroup('progress-deadline').textContent.trim(), - moment(task.get('requireProgressBy')).format('MM/DD/YY HH:mm:ss') + moment(task.get('requireProgressBy')).format("MMM DD, 'YY HH:mm:ss ZZ") ); }); });