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
This commit is contained in:
Bernardo De Marco Gonçalves 2024-11-19 08:36:22 -03:00 committed by GitHub
parent a82a2429f4
commit 8a2c0f3f73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 4 deletions

View File

@ -39,7 +39,7 @@
<a-auto-complete
class="detail-input"
ref="keyElm"
:filterOption="filterOption"
:filterOption="(input, option) => filterOption(input, option, 'key')"
v-model:value="newKey"
:options="detailKeys"
:placeholder="$t('label.name')"
@ -51,7 +51,7 @@
disabled />
<a-auto-complete
class="detail-input"
:filterOption="filterOption"
:filterOption="(input, option) => filterOption(input, option, 'value')"
v-model:value="newValue"
:options="detailValues"
:placeholder="$t('label.value')"
@ -176,7 +176,7 @@ export default {
if (this.detailOptions[this.newKey]) {
return { value: this.detailOptions[this.newKey] }
} else {
return ''
return []
}
}
return this.detailOptions[this.newKey].map(value => {
@ -188,7 +188,12 @@ export default {
this.updateResource(this.resource)
},
methods: {
filterOption (input, option) {
filterOption (input, option, filterType) {
if ((filterType === 'key' && !this.newKey) ||
(filterType === 'value' && !this.newValue)) {
return true
}
return (
option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0
)