narrator filter, no series filter, full paths toggle, book landing page details, new sans font, update query string on filter/sort, persist experimental feature flag, batch edit redirect bug, upload file permissions and owner

This commit is contained in:
advplyr 2021-10-06 21:08:52 -05:00
parent 75aede914f
commit f752c19418
36 changed files with 454 additions and 230 deletions

View file

@ -42,14 +42,19 @@ export const getters = {
var settings = rootState.user.settings || {}
var filterBy = settings.filterBy || ''
var searchGroups = ['genres', 'tags', 'series', 'authors', 'progress']
var searchGroups = ['genres', 'tags', 'series', 'authors', 'progress', 'narrators']
var group = searchGroups.find(_group => filterBy.startsWith(_group + '.'))
if (group) {
var filter = decode(filterBy.replace(`${group}.`, ''))
var filterVal = filterBy.replace(`${group}.`, '')
var filter = decode(filterVal)
if (group === 'genres') filtered = filtered.filter(ab => ab.book && ab.book.genres.includes(filter))
else if (group === 'tags') filtered = filtered.filter(ab => ab.tags.includes(filter))
else if (group === 'series') filtered = filtered.filter(ab => ab.book && ab.book.series === filter)
else if (group === 'series') {
if (filter === 'No Series') filtered = filtered.filter(ab => ab.book && !ab.book.series)
else filtered = filtered.filter(ab => ab.book && ab.book.series === filter)
}
else if (group === 'authors') filtered = filtered.filter(ab => ab.book && ab.book.author === filter)
else if (group === 'narrators') filtered = filtered.filter(ab => ab.book && ab.book.narrator === filter)
else if (group === 'progress') {
filtered = filtered.filter(ab => {
var userAudiobook = rootGetters['user/getUserAudiobook'](ab.id)
@ -62,7 +67,7 @@ export const getters = {
}
}
if (state.keywordFilter) {
const keywordFilterKeys = ['title', 'subtitle', 'author', 'series', 'narrarator']
const keywordFilterKeys = ['title', 'subtitle', 'author', 'series', 'narrator']
const keyworkFilter = state.keywordFilter.toLowerCase()
return filtered.filter(ab => {
if (!ab.book) return false
@ -76,6 +81,7 @@ export const getters = {
var direction = settings.orderDesc ? 'desc' : 'asc'
var filtered = getters.getFiltered()
var orderByNumber = settings.orderBy === 'book.volumeNumber'
return sort(filtered)[direction]((ab) => {
// Supports dot notation strings i.e. "book.title"
@ -118,6 +124,10 @@ export const getters = {
var _authors = state.audiobooks.filter(ab => !!(ab.book && ab.book.author)).map(ab => ab.book.author)
return [...new Set(_authors)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
},
getUniqueNarrators: (state) => {
var _narrators = state.audiobooks.filter(ab => !!(ab.book && ab.book.narrator)).map(ab => ab.book.narrator)
return [...new Set(_narrators)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
},
getGenresUsed: (state) => {
var _genres = []
state.audiobooks.filter(ab => !!(ab.book && ab.book.genres)).forEach(ab => _genres = _genres.concat(ab.book.genres))
@ -246,8 +256,8 @@ export const mutations = {
})
},
addUpdate(state, audiobook) {
if (audiobook.libraryId !== state.loadedLibraryId) {
console.warn('Invalid library', audiobook)
if (state.loadedLibraryId && audiobook.libraryId !== state.loadedLibraryId) {
console.warn('Invalid library', audiobook, 'loaded library', state.loadedLibraryId, '"')
return
}

View file

@ -9,10 +9,6 @@ export const state = () => ({
showEditModal: false,
selectedAudiobook: null,
playOnLoad: false,
// isScanning: false,
// isScanningCovers: false,
// scanProgress: null,
// coverScanProgress: null,
developerMode: false,
selectedAudiobooks: [],
processingBatch: false,
@ -114,36 +110,18 @@ export const mutations = {
setShowEditModal(state, val) {
state.showEditModal = val
},
// setIsScanning(state, isScanning) {
// state.isScanning = isScanning
// },
// setScanProgress(state, scanProgress) {
// if (scanProgress && scanProgress.progress > 0) state.isScanning = true
// state.scanProgress = scanProgress
// },
// setIsScanningCovers(state, isScanningCovers) {
// state.isScanningCovers = isScanningCovers
// },
// setCoverScanProgress(state, coverScanProgress) {
// if (coverScanProgress && coverScanProgress.progress > 0) state.isScanningCovers = true
// state.coverScanProgress = coverScanProgress
// },
setDeveloperMode(state, val) {
state.developerMode = val
},
setSelectedAudiobooks(state, audiobooks) {
Vue.set(state, 'selectedAudiobooks', audiobooks)
// state.selectedAudiobooks = audiobooks
},
toggleAudiobookSelected(state, audiobookId) {
if (state.selectedAudiobooks.includes(audiobookId)) {
state.selectedAudiobooks = state.selectedAudiobooks.filter(a => a !== audiobookId)
} else {
var newSel = state.selectedAudiobooks.concat([audiobookId])
// state.selectedAudiobooks = newSel
console.log('Setting toggle on sel', newSel)
Vue.set(state, 'selectedAudiobooks', newSel)
// state.selectedAudiobooks.push(audiobookId)
}
},
setProcessingBatch(state, val) {
@ -151,5 +129,6 @@ export const mutations = {
},
setExperimentalFeatures(state, val) {
state.showExperimentalFeatures = val
localStorage.setItem('experimental', val ? 1 : 0)
}
}

View file

@ -22,9 +22,6 @@ export const getters = {
getUserSetting: (state) => (key) => {
return state.settings ? state.settings[key] || null : null
},
getFilterOrderKey: (state) => {
return Object.values(state.settings).join('-')
},
getUserCanUpdate: (state) => {
return state.user && state.user.permissions ? !!state.user.permissions.update : false
},