Skip to content

Commit 6200ac8

Browse files
author
Hoang Nguyen
authored
ui: Search view - Fixes the color style of the filter icon (#4917)
* fixes the color style of the filter icon * fixes for router leave/enter
1 parent 87d73b9 commit 6200ac8

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

ui/src/components/view/SearchView.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
slot="addonBefore"
4141
trigger="click"
4242
v-model="visibleFilter">
43-
<template slot="content">
43+
<template slot="content" v-if="visibleFilter">
4444
<a-form
4545
style="min-width: 170px"
4646
:form="form"
@@ -104,7 +104,7 @@
104104
class="filter-button"
105105
size="small"
106106
@click="() => { searchQuery = null }">
107-
<a-icon type="filter" :theme="Object.keys(searchParams).length > 0 ? 'twoTone' : 'outlined'" />
107+
<a-icon type="filter" :theme="isFiltered ? 'twoTone' : 'outlined'" />
108108
</a-button>
109109
</a-popover>
110110
</a-input-search>
@@ -140,7 +140,8 @@ export default {
140140
fields: [],
141141
inputKey: null,
142142
inputValue: null,
143-
fieldValues: {}
143+
fieldValues: {},
144+
isFiltered: false
144145
}
145146
},
146147
beforeCreate () {
@@ -157,6 +158,13 @@ export default {
157158
if (to && to.query && 'q' in to.query) {
158159
this.searchQuery = to.query.q
159160
}
161+
this.isFiltered = false
162+
this.searchFilters.some(item => {
163+
if (this.searchParams[item]) {
164+
this.isFiltered = true
165+
return true
166+
}
167+
})
160168
}
161169
},
162170
mounted () {
@@ -417,6 +425,7 @@ export default {
417425
field[item] = undefined
418426
this.form.setFieldsValue(field)
419427
})
428+
this.isFiltered = false
420429
this.inputKey = null
421430
this.inputValue = null
422431
this.searchQuery = null
@@ -430,6 +439,7 @@ export default {
430439
if (err) {
431440
return
432441
}
442+
this.isFiltered = true
433443
for (const key in values) {
434444
const input = values[key]
435445
if (input === '' || input === null || input === undefined) {

0 commit comments

Comments
 (0)