mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 12:35:30 +02:00
feat(webui): reset filter button
This commit is contained in:
parent
4195ecbb9a
commit
3219dc4bb2
5 changed files with 72 additions and 6 deletions
|
|
@ -7,6 +7,22 @@
|
||||||
disable-route-watcher
|
disable-route-watcher
|
||||||
class="fill-height"
|
class="fill-height"
|
||||||
>
|
>
|
||||||
|
<v-fab-transition>
|
||||||
|
<v-btn
|
||||||
|
v-if="clearButton"
|
||||||
|
absolute
|
||||||
|
top
|
||||||
|
right
|
||||||
|
icon
|
||||||
|
:style="'z-index: 10; background: ' + $vuetify.theme.currentTheme.base"
|
||||||
|
elevation="2"
|
||||||
|
@click="clear"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<v-icon>mdi-filter-variant-remove</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-fab-transition>
|
||||||
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
||||||
<template v-if="$slots.filter">
|
<template v-if="$slots.filter">
|
||||||
|
|
@ -36,15 +52,24 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
|
clearButton: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value (val) {
|
value(val) {
|
||||||
this.display = val
|
this.display = val
|
||||||
},
|
},
|
||||||
display (val) {
|
display(val) {
|
||||||
!val && this.$emit('input', false)
|
!val && this.$emit('input', false)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
clear() {
|
||||||
|
this.$emit('clear')
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,8 @@
|
||||||
"series": "Series",
|
"series": "Series",
|
||||||
"tags": "Tags",
|
"tags": "Tags",
|
||||||
"use_filter_panel_to_change_filter": "Use the filter panel to change the active filter",
|
"use_filter_panel_to_change_filter": "Use the filter panel to change the active filter",
|
||||||
"year": "year"
|
"year": "year",
|
||||||
|
"reset_filters": "Reset filters"
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"keep_reading": "Keep Reading",
|
"keep_reading": "Keep Reading",
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,11 @@
|
||||||
</toolbar-sticky>
|
</toolbar-sticky>
|
||||||
</v-scroll-y-transition>
|
</v-scroll-y-transition>
|
||||||
|
|
||||||
<filter-drawer v-model="drawer">
|
<filter-drawer
|
||||||
|
v-model="drawer"
|
||||||
|
:clear-button="filterActive"
|
||||||
|
@clear="resetFilters"
|
||||||
|
>
|
||||||
<template v-slot:default>
|
<template v-slot:default>
|
||||||
<filter-list
|
<filter-list
|
||||||
:filters-options="filterOptionsList"
|
:filters-options="filterOptionsList"
|
||||||
|
|
@ -89,6 +93,7 @@
|
||||||
icon="mdi-book-multiple"
|
icon="mdi-book-multiple"
|
||||||
icon-color="secondary"
|
icon-color="secondary"
|
||||||
>
|
>
|
||||||
|
<v-btn @click="resetFilters">{{ $t('common.reset_filters') }}</v-btn>
|
||||||
</empty-state>
|
</empty-state>
|
||||||
|
|
||||||
<item-browser
|
<item-browser
|
||||||
|
|
@ -251,6 +256,14 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resetFilters() {
|
||||||
|
this.drawer = false
|
||||||
|
for (const prop in this.filters) {
|
||||||
|
this.$set(this.filters, prop, [])
|
||||||
|
}
|
||||||
|
this.$store.commit('setCollectionFilter', {id: this.collectionId, filter: this.filters})
|
||||||
|
this.updateRouteAndReload()
|
||||||
|
},
|
||||||
async resetParams(route: any, collectionId: string) {
|
async resetParams(route: any, collectionId: string) {
|
||||||
// load dynamic filters
|
// load dynamic filters
|
||||||
this.$set(this.filterOptions, 'library', this.$store.state.komgaLibraries.libraries.map((x: LibraryDto) => ({
|
this.$set(this.filterOptions, 'library', this.$store.state.komgaLibraries.libraries.map((x: LibraryDto) => ({
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,11 @@
|
||||||
|
|
||||||
<library-navigation v-if="$vuetify.breakpoint.name === 'xs'" :libraryId="libraryId" bottom-navigation/>
|
<library-navigation v-if="$vuetify.breakpoint.name === 'xs'" :libraryId="libraryId" bottom-navigation/>
|
||||||
|
|
||||||
<filter-drawer v-model="drawer">
|
<filter-drawer
|
||||||
|
v-model="drawer"
|
||||||
|
:clear-button="sortOrFilterActive"
|
||||||
|
@clear="resetSortAndFilters"
|
||||||
|
>
|
||||||
<template v-slot:default>
|
<template v-slot:default>
|
||||||
<filter-list
|
<filter-list
|
||||||
:filters-options="filterOptionsList"
|
:filters-options="filterOptionsList"
|
||||||
|
|
@ -68,6 +72,7 @@
|
||||||
icon="mdi-book-multiple"
|
icon="mdi-book-multiple"
|
||||||
icon-color="secondary"
|
icon-color="secondary"
|
||||||
>
|
>
|
||||||
|
<v-btn @click="resetSortAndFilters">{{ $t('common.reset_filters') }}</v-btn>
|
||||||
</empty-state>
|
</empty-state>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -283,6 +288,16 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resetSortAndFilters() {
|
||||||
|
this.drawer = false
|
||||||
|
for (const prop in this.filters) {
|
||||||
|
this.$set(this.filters, prop, [])
|
||||||
|
}
|
||||||
|
this.sortActive = this.sortDefault
|
||||||
|
this.$store.commit('setLibraryFilter', {id: this.libraryId, filter: this.filters})
|
||||||
|
this.$store.commit('setLibrarySort', {id: this.libraryId, sort: this.sortActive})
|
||||||
|
this.updateRouteAndReload()
|
||||||
|
},
|
||||||
async resetParams(route: any, libraryId: string) {
|
async resetParams(route: any, libraryId: string) {
|
||||||
this.sortActive = parseQuerySort(route.query.sort, this.sortOptions) ||
|
this.sortActive = parseQuerySort(route.query.sort, this.sortOptions) ||
|
||||||
this.$store.getters.getLibrarySort(route.params.libraryId) ||
|
this.$store.getters.getLibrarySort(route.params.libraryId) ||
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,11 @@
|
||||||
@edit="editMultipleBooks"
|
@edit="editMultipleBooks"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<filter-drawer v-model="drawer">
|
<filter-drawer
|
||||||
|
v-model="drawer"
|
||||||
|
:clear-button="sortOrFilterActive"
|
||||||
|
@clear="resetSortAndFilters"
|
||||||
|
>
|
||||||
<template v-slot:default>
|
<template v-slot:default>
|
||||||
<filter-list
|
<filter-list
|
||||||
:filters-options="filterOptionsList"
|
:filters-options="filterOptionsList"
|
||||||
|
|
@ -569,6 +573,14 @@ export default Vue.extend({
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
resetSortAndFilters() {
|
||||||
|
this.drawer = false
|
||||||
|
for (const prop in this.filters) {
|
||||||
|
this.$set(this.filters, prop, [])
|
||||||
|
}
|
||||||
|
this.sortActive = this.sortDefault
|
||||||
|
this.updateRouteAndReload()
|
||||||
|
},
|
||||||
async resetParams(route: any, seriesId: string) {
|
async resetParams(route: any, seriesId: string) {
|
||||||
this.sortActive = this.parseQuerySortOrDefault(route.query.sort)
|
this.sortActive = this.parseQuerySortOrDefault(route.query.sort)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue