Skip to content

Commit

Permalink
update all instances of LabeledInput using v-model.number to use v-mo…
Browse files Browse the repository at this point in the history
…del:value.number (#11902)

* update all instances of LabeledInput using v-model.number

* add probe http headers unit test

* add hookoption test

* remove codemirror focus change
  • Loading branch information
mantis-toboggan-md authored Sep 19, 2024
1 parent 3fde3d5 commit 5607114
Show file tree
Hide file tree
Showing 28 changed files with 101 additions and 381 deletions.
1 change: 0 additions & 1 deletion shell/components/CodeMirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export default {
},
methods: {
focus() {
if ( this.$refs.codeMirrorRef ) {
this.$refs.codeMirrorRef.codemirror.focus();
Expand Down
6 changes: 3 additions & 3 deletions shell/components/form/HealthCheck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
:mode="mode"
:label="t('workload.container.healthCheck.readinessProbe')"
:description="t('workload.container.healthCheck.readinessTip')"
@input="update"
@update:value="update"
/>
</div>
</div>
Expand All @@ -66,7 +66,7 @@ export default {
:mode="mode"
:label="t('workload.container.healthCheck.livenessProbe')"
:description="t('workload.container.healthCheck.livenessTip')"
@input="update"
@update:value="update"
/>
</div>
</div>
Expand All @@ -79,7 +79,7 @@ export default {
:mode="mode"
:label="t('workload.container.healthCheck.startupProbe')"
:description="t('workload.container.healthCheck.startupTip')"
@input="update"
@update:value="update"
/>
</div>
</div>
Expand Down
38 changes: 20 additions & 18 deletions shell/components/form/HookOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default {
:mode="mode"
/>
<LabeledInput
v-model.number="value.httpGet.port"
v-model:value.number="value.httpGet.port"
type="number"
:label="t('workload.container.lifecycleHook.httpGet.port.label')"
:placeholder="t('workload.container.lifecycleHook.httpGet.port.placeholder')"
Expand All @@ -186,24 +186,25 @@ export default {
v-for="(header, index) in value.httpGet.httpHeaders"
:key="index"
class="var-row"
data-testid="hookoption-header-row"
>
<template @update:value="update">
<LabeledInput
v-model:value="value.httpGet.httpHeaders[index].name"
:label="t('workload.container.lifecycleHook.httpHeaders.name.label')"
:placeholder="t('workload.container.lifecycleHook.httpHeaders.name.placeholder')"
class="single-value"
:mode="mode"
required
/>
<LabeledInput
v-model:value="value.httpGet.httpHeaders[index].value"
:label="t('workload.container.lifecycleHook.httpHeaders.value.label')"
:placeholder="t('workload.container.lifecycleHook.httpHeaders.value.placeholder')"
class="single-value"
:mode="mode"
/>
</template>
<LabeledInput
v-model:value="value.httpGet.httpHeaders[index].name"
:label="t('workload.container.lifecycleHook.httpHeaders.name.label')"
:placeholder="t('workload.container.lifecycleHook.httpHeaders.name.placeholder')"
class="single-value"
:mode="mode"
required
@update:value="update"
/>
<LabeledInput
v-model:value="value.httpGet.httpHeaders[index].value"
:label="t('workload.container.lifecycleHook.httpHeaders.value.label')"
:placeholder="t('workload.container.lifecycleHook.httpHeaders.value.placeholder')"
class="single-value"
:mode="mode"
@update:value="update"
/>
<div class="remove">
<button
v-if="!isView"
Expand All @@ -223,6 +224,7 @@ export default {
type="button"
class="btn role-link mb-20"
:disabled="mode === 'view'"
data-testid="hookoption-add-header-button"
@click.stop="addHeader"
>
Add Header
Expand Down
3 changes: 2 additions & 1 deletion shell/components/form/NodeAffinity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,15 @@ export default {
class="col span-3"
>
<LabeledInput
v-model.number="props.row.value.weight"
v-model:value.number="props.row.value.weight"
:mode="mode"
type="number"
min="1"
max="100"
:label="t('workload.scheduling.affinity.weight.label')"
:placeholder="t('workload.scheduling.affinity.weight.placeholder')"
:data-testid="`node-affinity-weight-index${props.i}`"
@update:value="update"
/>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion shell/components/form/PodAffinity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,15 @@ export default {
class="col span-3"
>
<LabeledInput
v-model.number="props.row.value.weight"
v-model:value.number="props.row.value.weight"
:mode="mode"
type="number"
min="1"
max="100"
:label="t('workload.scheduling.affinity.weight.label')"
:placeholder="t('workload.scheduling.affinity.weight.placeholder')"
:data-testid="`pod-affinity-weight-index${props.i}`"
@update:value="update"
/>
</div>
</div>
Expand Down
168 changes: 0 additions & 168 deletions shell/components/form/PodSecurity.vue

This file was deleted.

10 changes: 6 additions & 4 deletions shell/components/form/Probe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default {
data-testid="input-probe-port"
>
<LabeledInput
v-model.number="httpGet.port"
v-model:value.number="httpGet.port"
type="number"
min="1"
max="65535"
Expand Down Expand Up @@ -210,7 +210,7 @@ export default {
data-testid="input-probe-socket"
>
<LabeledInput
v-model.number="tcpSocket.port"
v-model:value.number="tcpSocket.port"
type="number"
min="1"
max="65535"
Expand Down Expand Up @@ -305,7 +305,7 @@ export default {
class="col span-6"
>
<LabeledInput
v-model.number="probe.successThreshold"
v-model:value.number="probe.successThreshold"
type="number"
min="1"
:mode="mode"
Expand All @@ -319,7 +319,7 @@ export default {
class="col span-6"
>
<LabeledInput
v-model.number="probe.failureThreshold"
v-model:value.number="probe.failureThreshold"
type="number"
min="1"
:mode="mode"
Expand All @@ -337,6 +337,7 @@ export default {
<div class="col span-12">
<KeyValue
v-model:value="httpGet.httpHeaders"
data-testid="input-probe-http-headers"
key-name="name"
:mode="mode"
:as-map="false"
Expand All @@ -345,6 +346,7 @@ export default {
:key-label="t('generic.name')"
:value-label="t('generic.value')"
:add-label="t('generic.add')"
@update:value="update"
>
<template #title>
<h3>
Expand Down
2 changes: 1 addition & 1 deletion shell/components/form/Security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default {
>
<div class="col span-6">
<LabeledInput
v-model.number="runAsUser"
v-model:value.number="runAsUser"
:label="t('workload.container.security.runAsUser')"
:mode="mode"
@update:value="update"
Expand Down
6 changes: 3 additions & 3 deletions shell/components/form/WorkloadPorts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export default {
<div class="port">
<LabeledInput
v-model.number="row.containerPort"
v-model:value.number="row.containerPort"
:mode="mode"
type="number"
min="1"
Expand Down Expand Up @@ -333,7 +333,7 @@ export default {
>
<LabeledInput
ref="port"
v-model.number="row.hostPort"
v-model:value.number="row.hostPort"
:mode="mode"
type="number"
min="1"
Expand Down Expand Up @@ -375,7 +375,7 @@ export default {
<div v-if="row._serviceType === 'LoadBalancer' || row._serviceType === 'NodePort'">
<LabeledInput
ref="port"
v-model.number="row._listeningPort"
v-model:value.number="row._listeningPort"
type="number"
:mode="mode"
:label="t('workload.container.ports.listeningPort')"
Expand Down
Loading

0 comments on commit 5607114

Please sign in to comment.