diff --git a/ui/app/components/allocation-stat.js b/ui/app/components/allocation-stat.js index 814d43e52..4a048511c 100644 --- a/ui/app/components/allocation-stat.js +++ b/ui/app/components/allocation-stat.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { alias } from '@ember/object/computed'; -import { formatBytes } from 'nomad-ui/helpers/format-bytes'; +import { formatScheduledBytes } from 'nomad-ui/utils/units'; import { tagName } from '@ember-decorators/component'; import classic from 'ember-classic-decorator'; @@ -35,7 +35,7 @@ export default class AllocationStat extends Component { @computed('metric', 'stat.used') get formattedStat() { if (!this.stat) return undefined; - if (this.metric === 'memory') return formatBytes([this.stat.used]); + if (this.metric === 'memory') return formatScheduledBytes(this.stat.used); return this.stat.used; } diff --git a/ui/app/components/primary-metric/allocation.hbs b/ui/app/components/primary-metric/allocation.hbs index 9e884dc33..ea787b9cc 100644 --- a/ui/app/components/primary-metric/allocation.hbs +++ b/ui/app/components/primary-metric/allocation.hbs @@ -20,7 +20,7 @@ {{#if (eq this.metric "cpu")}} {{datum.datum.used}} MHz {{else if (eq this.metric "memory")}} - {{format-bytes datum.datum.used}} + {{format-scheduled-bytes datum.datum.used}} {{else}} {{datum.formatttedY}} {{/if}} @@ -34,7 +34,7 @@ {{#if (eq this.metric "cpu")}} {{this.data.lastObject.used}} MHz / {{this.reservedAmount}} MHz Total {{else if (eq this.metric "memory")}} - {{format-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total + {{format-scheduled-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total {{else}} {{this.data.lastObject.used}} / {{this.reservedAmount}} Total {{/if}} diff --git a/ui/app/components/primary-metric/node.hbs b/ui/app/components/primary-metric/node.hbs index d0718f02a..038b6f9ad 100644 --- a/ui/app/components/primary-metric/node.hbs +++ b/ui/app/components/primary-metric/node.hbs @@ -20,7 +20,7 @@ {{#if (eq this.metric "cpu")}} {{this.data.lastObject.used}} MHz / {{this.reservedAmount}} MHz Total {{else if (eq this.metric "memory")}} - {{format-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total + {{format-scheduled-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total {{else}} {{this.data.lastObject.used}} / {{this.reservedAmount}} Total {{/if}} diff --git a/ui/app/components/primary-metric/task.hbs b/ui/app/components/primary-metric/task.hbs index a2ae83487..48849f2f3 100644 --- a/ui/app/components/primary-metric/task.hbs +++ b/ui/app/components/primary-metric/task.hbs @@ -14,7 +14,7 @@ {{#if (eq this.metric "cpu")}} {{this.data.lastObject.used}} MHz / {{this.reservedAmount}} MHz Total {{else if (eq this.metric "memory")}} - {{format-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total + {{format-scheduled-bytes this.data.lastObject.used}} / {{this.reservedAmount}} MiB Total {{else}} {{this.data.lastObject.used}} / {{this.reservedAmount}} Total {{/if}} diff --git a/ui/app/helpers/format-scheduled-bytes.js b/ui/app/helpers/format-scheduled-bytes.js new file mode 100644 index 000000000..3c18fa0f7 --- /dev/null +++ b/ui/app/helpers/format-scheduled-bytes.js @@ -0,0 +1,16 @@ +import Helper from '@ember/component/helper'; +import { formatScheduledBytes } from 'nomad-ui/utils/units'; + +/** + * Scheduled Bytes Formatter + * + * Usage: {{format-scheduled-bytes bytes}} + * + * Outputs the bytes reduced to the resolution the scheduler + * and job spec operate at. + */ +function formatScheduledBytesHelper([bytes]) { + return formatScheduledBytes(bytes); +} + +export default Helper.helper(formatScheduledBytesHelper); diff --git a/ui/app/templates/components/task-row.hbs b/ui/app/templates/components/task-row.hbs index 7dcebffe7..d3525e1ae 100644 --- a/ui/app/templates/components/task-row.hbs +++ b/ui/app/templates/components/task-row.hbs @@ -67,7 +67,7 @@ {{x-icon "alert-triangle" class="is-warning"}} {{else}} -