open-nomad/ui/app/templates/components/task-row.hbs
Buck Doyle 244157786a
Add explicit this to templates (#8388)
This is the result of running the no-implicit-this-codemod, some manual fixes,
and the addition of a linting rule to prevent future ambiguity.
2020-07-09 15:19:07 -05:00

93 lines
3 KiB
Handlebars

<td class="is-narrow">
{{#unless this.task.driverStatus.healthy}}
<span data-test-icon="unhealthy-driver" class="tooltip text-center" aria-label="{{this.task.driver}} is unhealthy">
{{x-icon "warning" class="is-warning"}}
</span>
{{/unless}}
</td>
<td data-test-name class="nowrap">
<LinkTo @route="allocations.allocation.task" @models={{array this.task.allocation this.task}} class="is-primary">
{{this.task.name}}
{{#if this.task.isConnectProxy}}
<ProxyTag @class="bumper-left" />
{{/if}}
</LinkTo>
</td>
<td data-test-state>{{this.task.state}}</td>
<td data-test-message>
{{#if this.task.events.lastObject.message}}
{{this.task.events.lastObject.message}}
{{else}}
<em>No message</em>
{{/if}}
</td>
<td data-test-time>{{format-ts this.task.events.lastObject.time}}</td>
<td data-test-volumes>
<ul>
{{#each this.task.task.volumeMounts as |volume|}}
<li data-test-volume>
<strong>{{volume.volume}}:</strong>
{{#if volume.isCSI}}
<LinkTo @route="csi.volumes.volume" @model={{volume.volume}} @query={{hash volumeNamespace=volume.namespace.id}}>
{{volume.source}}
</LinkTo>
{{else}}
{{volume.source}}
{{/if}}
</li>
{{/each}}
</ul>
</td>
<td data-test-ports>
<ul>
{{#let this.task.resources.networks.firstObject as |network|}}
{{#each network.ports as |port|}}
<li data-test-port>
<strong>{{port.name}}:</strong>
<a href="http://{{network.ip}}:{{port.port}}" target="_blank" rel="noopener noreferrer">{{network.ip}}:{{port.port}}</a>
</li>
{{/each}}
{{/let}}
</ul>
</td>
<td data-test-cpu class="is-1 has-text-centered">
{{#if this.task.isRunning}}
{{#if (and (not this.cpu) this.fetchStats.isRunning)}}
...
{{else if this.statsError}}
<span class="tooltip text-center" role="tooltip" aria-label="Couldn't collect stats">
{{x-icon "warning" class="is-warning"}}
</span>
{{else}}
<div class="inline-chart is-small tooltip" role="tooltip" aria-label="{{this.cpu.used}} / {{this.taskStats.reservedCPU}} MHz">
<progress
class="progress is-info is-small"
value="{{this.cpu.percent}}"
max="1">
{{this.cpu.percent}}
</progress>
</div>
{{/if}}
{{/if}}
</td>
<td data-test-mem class="is-1 has-text-centered">
{{#if this.task.isRunning}}
{{#if (and (not this.memory) this.fetchStats.isRunning)}}
...
{{else if this.statsError}}
<span class="tooltip is-small text-center" role="tooltip" aria-label="Couldn't collect stats">
{{x-icon "warning" class="is-warning"}}
</span>
{{else}}
<div class="inline-chart tooltip" role="tooltip" aria-label="{{format-bytes this.memory.used}} / {{this.taskStats.reservedMemory}} MiB">
<progress
class="progress is-danger is-small"
value="{{this.memory.percent}}"
max="1">
{{this.memory.percent}}
</progress>
</div>
{{/if}}
{{/if}}
</td>