mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-03-10 00:17:21 +01:00
add "sort by filename"
This commit is contained in:
parent
19a65dba98
commit
007691ffe5
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="lazy-episodes-table" class="w-full py-6">
|
<div id="lazy-episodes-table" class="w-full py-6">
|
||||||
<div class="flex flex-wrap flex-col md:flex-row md:items-center mb-4">
|
<div class="flex flex-wrap flex-col md:flex-row md:items-center mb-4">
|
||||||
@ -123,6 +124,10 @@ export default {
|
|||||||
{
|
{
|
||||||
text: this.$strings.LabelEpisode,
|
text: this.$strings.LabelEpisode,
|
||||||
value: 'episode'
|
value: 'episode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelFilename,
|
||||||
|
value: 'audioFile.metadata.filename'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -171,8 +176,17 @@ export default {
|
|||||||
return episodeProgress && !episodeProgress.isFinished
|
return episodeProgress && !episodeProgress.isFinished
|
||||||
})
|
})
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
let aValue = a[this.sortKey]
|
let aValue
|
||||||
let bValue = b[this.sortKey]
|
let bValue
|
||||||
|
|
||||||
|
if (this.sortKey.includes('.')) {
|
||||||
|
const getNestedValue = (ob, s) => s.split('.').reduce((o, k) => o?.[k], ob);
|
||||||
|
aValue = getNestedValue(a, this.sortKey)
|
||||||
|
bValue = getNestedValue(b, this.sortKey)
|
||||||
|
} else {
|
||||||
|
aValue = a[this.sortKey]
|
||||||
|
bValue = b[this.sortKey]
|
||||||
|
}
|
||||||
|
|
||||||
// Sort episodes with no pub date as the oldest
|
// Sort episodes with no pub date as the oldest
|
||||||
if (this.sortKey === 'publishedAt') {
|
if (this.sortKey === 'publishedAt') {
|
||||||
|
Loading…
Reference in New Issue
Block a user