mirror of https://github.com/apache/cloudstack.git
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:
parent
a82a2429f4
commit
8a2c0f3f73
|
|
@ -39,7 +39,7 @@
|
||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
class="detail-input"
|
class="detail-input"
|
||||||
ref="keyElm"
|
ref="keyElm"
|
||||||
:filterOption="filterOption"
|
:filterOption="(input, option) => filterOption(input, option, 'key')"
|
||||||
v-model:value="newKey"
|
v-model:value="newKey"
|
||||||
:options="detailKeys"
|
:options="detailKeys"
|
||||||
:placeholder="$t('label.name')"
|
:placeholder="$t('label.name')"
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
disabled />
|
disabled />
|
||||||
<a-auto-complete
|
<a-auto-complete
|
||||||
class="detail-input"
|
class="detail-input"
|
||||||
:filterOption="filterOption"
|
:filterOption="(input, option) => filterOption(input, option, 'value')"
|
||||||
v-model:value="newValue"
|
v-model:value="newValue"
|
||||||
:options="detailValues"
|
:options="detailValues"
|
||||||
:placeholder="$t('label.value')"
|
:placeholder="$t('label.value')"
|
||||||
|
|
@ -176,7 +176,7 @@ export default {
|
||||||
if (this.detailOptions[this.newKey]) {
|
if (this.detailOptions[this.newKey]) {
|
||||||
return { value: this.detailOptions[this.newKey] }
|
return { value: this.detailOptions[this.newKey] }
|
||||||
} else {
|
} else {
|
||||||
return ''
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.detailOptions[this.newKey].map(value => {
|
return this.detailOptions[this.newKey].map(value => {
|
||||||
|
|
@ -188,7 +188,12 @@ export default {
|
||||||
this.updateResource(this.resource)
|
this.updateResource(this.resource)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
filterOption (input, option) {
|
filterOption (input, option, filterType) {
|
||||||
|
if ((filterType === 'key' && !this.newKey) ||
|
||||||
|
(filterType === 'value' && !this.newValue)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0
|
option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue