Merge pull request #464 from selfhost-alt/include-filter-name-in-ui

Include the type of filter being applied in the UI
This commit is contained in:
advplyr 2022-04-19 04:59:35 -05:00 committed by GitHub
commit 6a43672973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 || []