Skip to content

Commit 8a2c0f3

Browse files
UI: Improve filtering of VM and template settings (#9683)
* improve VMs and templates settings filtering * fix incorrect prop passed in to the `a-auto-complete` component
1 parent a82a242 commit 8a2c0f3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ui/src/components/view/DetailSettings.vue

+9-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<a-auto-complete
4040
class="detail-input"
4141
ref="keyElm"
42-
:filterOption="filterOption"
42+
:filterOption="(input, option) => filterOption(input, option, 'key')"
4343
v-model:value="newKey"
4444
:options="detailKeys"
4545
:placeholder="$t('label.name')"
@@ -51,7 +51,7 @@
5151
disabled />
5252
<a-auto-complete
5353
class="detail-input"
54-
:filterOption="filterOption"
54+
:filterOption="(input, option) => filterOption(input, option, 'value')"
5555
v-model:value="newValue"
5656
:options="detailValues"
5757
:placeholder="$t('label.value')"
@@ -176,7 +176,7 @@ export default {
176176
if (this.detailOptions[this.newKey]) {
177177
return { value: this.detailOptions[this.newKey] }
178178
} else {
179-
return ''
179+
return []
180180
}
181181
}
182182
return this.detailOptions[this.newKey].map(value => {
@@ -188,7 +188,12 @@ export default {
188188
this.updateResource(this.resource)
189189
},
190190
methods: {
191-
filterOption (input, option) {
191+
filterOption (input, option, filterType) {
192+
if ((filterType === 'key' && !this.newKey) ||
193+
(filterType === 'value' && !this.newValue)) {
194+
return true
195+
}
196+
192197
return (
193198
option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0
194199
)

0 commit comments

Comments
 (0)