Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions ui/src/components/view/SearchView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
slot="addonBefore"
trigger="click"
v-model="visibleFilter">
<template slot="content">
<template slot="content" v-if="visibleFilter">
<a-form
style="min-width: 170px"
:form="form"
Expand Down Expand Up @@ -104,7 +104,7 @@
class="filter-button"
size="small"
@click="() => { searchQuery = null }">
<a-icon type="filter" :theme="Object.keys(searchParams).length > 0 ? 'twoTone' : 'outlined'" />
<a-icon type="filter" :theme="isFiltered ? 'twoTone' : 'outlined'" />
</a-button>
</a-popover>
</a-input-search>
Expand Down Expand Up @@ -140,7 +140,8 @@ export default {
fields: [],
inputKey: null,
inputValue: null,
fieldValues: {}
fieldValues: {},
isFiltered: false
}
},
beforeCreate () {
Expand All @@ -157,6 +158,13 @@ export default {
if (to && to.query && 'q' in to.query) {
this.searchQuery = to.query.q
}
this.isFiltered = false
this.searchFilters.some(item => {
if (this.searchParams[item]) {
this.isFiltered = true
return true
}
})
}
},
mounted () {
Expand Down Expand Up @@ -417,6 +425,7 @@ export default {
field[item] = undefined
this.form.setFieldsValue(field)
})
this.isFiltered = false
this.inputKey = null
this.inputValue = null
this.searchQuery = null
Expand All @@ -430,6 +439,7 @@ export default {
if (err) {
return
}
this.isFiltered = true
for (const key in values) {
const input = values[key]
if (input === '' || input === null || input === undefined) {
Expand Down