ui/lib/shared/addon/components/scheduling-toleration/template.hbs

154 lines
4.2 KiB
Handlebars

<div>
<label class="acc-label">
{{#if title}}
{{title}}
{{else}}
{{t "formScheduling.toleration.title"}}
{{/if}}
</label>
</div>
{{#if tolerationArray.length}}
<table class="table fixed no-lines mb-20">
<thead>
<tr>
<th class="acc-label">
{{t "formScheduling.key"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "formScheduling.operator"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "formScheduling.value"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "formScheduling.effect"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "formScheduling.time"}}
</th>
<th width="10">&nbsp;</th>
<th width="40"></th>
</tr>
</thead>
<tbody>
{{#each tolerationArray as |toleration|}}
<tr>
<td>
{{#input-or-display
editable=editing
value=(if (and (not toleration.key) (eq toleration.operator "Exists")) "*" toleration.key)
}}
{{input
type="text"
class="form-control input-sm"
value=toleration.key
}}
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
<td>
{{#input-or-display
editable=editing
value=(or toleration.operator "Equal")
}}
{{searchable-select
class="form-control input-sm pt-0"
content=operatorChoices
value=toleration.operator
}}
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
<td>
{{#if (or (eq toleration.operator "Equal") (not toleration.operator))}}
{{#input-or-display
editable=editing
value=toleration.value
}}
{{input
type="text"
class="form-control input-sm"
value=toleration.value
}}
{{/input-or-display}}
{{else}}
{{t "generic.na"}}
{{/if}}
</td>
<td>
&nbsp;
</td>
<td>
{{#input-or-display
editable=editing
value=(or toleration.effect "*")
}}
{{searchable-select
class="form-control input-sm pt-0"
allowCustom=true
content=effectChoices
value=toleration.effect
}}
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
<td>
{{#if (eq toleration.effect "NoExecute")}}
{{#input-or-display
editable=editing
value=toleration.tolerationSeconds
}}
<div class="input-group">
{{input-integer
classNames="form-control input-sm"
value=toleration.tolerationSeconds
}}
<span class="input-group-addon bg-default">
{{t "generic.seconds"}}
</span>
</div>
{{/input-or-display}}
{{else}}
{{t "generic.na"}}
{{/if}}
</td>
<td>
&nbsp;
</td>
{{#if editing}}
<div class="input-group-btn">
<button class="btn bg-primary btn-sm" type="button" {{action "removeToleration" toleration}}>
<i class="icon icon-minus"/>
</button>
</div>
{{/if }}
</tr>
{{/each}}
</tbody>
</table>
{{else}}
{{#unless editing}}
<div class="text-muted">
{{t "formScheduling.noToleration"}}
</div>
{{/unless}}
{{/if}}
{{#if editing}}
<button class="btn bg-link icon-btn" type="button" {{action "addToleration"}}>
<i class="icon icon-plus text-small"/>
<span>
{{t "formScheduling.toleration.add"}}
</span>
</button>
{{/if}}