Include the type of filter being applied in the UI

This commit is contained in:
Selfhost Alt 2022-04-18 21:06:58 -07:00
parent 7ef44eb75b
commit f0615c2971
2 changed files with 17 additions and 11 deletions

View File

@ -91,7 +91,7 @@ export default {
emptyMessage() {
if (this.page === 'series') return `You have no series`
if (this.page === 'collections') return "You haven't made any collections yet"
if (this.hasFilter) return `No Results for filter "${this.filterValue}"`
if (this.hasFilter) return `No Results for filter "${this.filterName}: ${this.filterValue}"`
return 'No results'
},
entityName() {

View File

@ -161,23 +161,29 @@ export default {
selectedText() {
if (!this.selected) return ''
var parts = this.selected.split('.')
var filterName = this.selectItems.find((i) => i.value === parts[0]);
var filterValue = null;
if (parts.length > 1) {
var decoded = this.$decode(parts[1])
if (decoded.startsWith('aut_')) {
var author = this.authors.find((au) => au.id == decoded)
if (author) return author.name
return ''
}
if (decoded.startsWith('ser_')) {
if (author) filterValue = author.name;
} else if (decoded.startsWith('ser_')) {
var series = this.series.find((se) => se.id == decoded)
if (series) return series.name
return ''
if (series) filterValue = series.name
} else {
filterValue = decoded;
}
return decoded
}
var _sel = this.selectItems.find((i) => i.value === this.selected)
if (!_sel) return ''
return _sel.text
if (filterName && filterValue) {
return `${filterName.text}: ${filterValue}`;
} else if (filterName) {
return filterName.text;
} else if (filterValue) {
return filterValue;
} else {
return ''
}
},
genres() {
return this.filterData.genres || []