ui/lib/shared/addon/components/form-match-expressions-k8s/template.hbs

132 lines
4.1 KiB
Handlebars

<table class="table fixed no-lines mb-20">
<thead>
<tr>
{{#if (not isPod)}}
<th class="acc-label">
{{t "clusterNew.agentConfig.overrideAffinity.nodeAffinity.nodeSelectorTerm.type"}}
</th>
<th width="40"></th>
{{/if}}
<th class="acc-label">
{{t "clusterNew.agentConfig.overrideAffinity.podAffinity.matchExpressions.key"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "clusterNew.agentConfig.overrideAffinity.podAffinity.matchExpressions.operator"}}
</th>
<th width="40"></th>
<th class="acc-label">
{{t "clusterNew.agentConfig.overrideAffinity.podAffinity.matchExpressions.value"}}
</th>
<th width="10">&nbsp;</th>
<th width="40"></th>
</tr>
</thead>
<tbody>
{{#each allMatches as |match|}}
<tr data-testid="match-expression-row">
{{#if (not isPod)}}
<td>
{{#input-or-display
editable=editing
value=match.type
}}
<NewSelect
class="form-control input-sm"
@value={{match.type}}
@content={{typeOpts}}
@optionValuePath="value"
@optionLabelPath="label"
@localizedLabel={{true}}
@action={{action "typeChanged" match}}
@disabled={{not editing}}
data-testid="select-match-expression-type"
/>
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
{{/if}}
<td>
{{#input-or-display
editable=editing
value=match.match.key
}}
{{input
type="text"
class="form-control input-sm"
value=match.match.key
data-testid='input-match-expression-key'
}}
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
<td>
{{#input-or-display
editable=editing
value=match.match.operator
}}
<NewSelect
class="form-control input-sm"
@value={{match.match.operator}}
@content={{operatorOpts}}
optionValuePath="value"
optionLabelPath="label"
@localizedLabel={{true}}
@action={{action "operatorChanged" match}}
data-testid="select-match-expression-operator"
/>
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
<td>
{{#input-or-display
editable=editing
value=match.match.values
}}
{{#if (or (eq match.match.operator "In") (eq match.match.operator "NotIn"))}}
{{input-array-as-string
value=match.match.values
inputClass='form-control input-sm'
data-testid="input-match-expression-values"
}}
{{else if (or (eq match.match.operator "Gt") (eq match.match.operator "Lt"))}}
<InputArrayAsString
type="number"
inputClass="form-control input-sm"
@value={{match.match.values}}
@update={{action "operatorChanged" match}}
data-testid="input-match-expression-values"
/>
{{else}}
{{t "generic.na"}}
{{/if}}
{{/input-or-display}}
</td>
<td>
&nbsp;
</td>
{{#if editing}}
<div class="input-group-btn">
<button data-testid="button-match-expression-remove" class="btn bg-primary btn-sm" type="button" {{action "removeMatchAction" match}}>
<i class="icon icon-minus"/>
</button>
</div>
{{/if }}
</tr>
{{/each}}
</tbody>
</table>
{{#if editing}}
<button data-testid="button-match-expression-add" class="btn bg-link icon-btn" type="button" {{action "addMatch"}}>
<i class="icon icon-plus text-small"/>
<span>
{{t "clusterNew.agentConfig.overrideAffinity.podAffinity.matchExpressions.add"}}
</span>
</button>
{{/if}}