mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Add episode filter on the episodes list
This commit is contained in:
		
							parent
							
								
									6d138ae905
								
							
						
					
					
						commit
						f650ae7f18
					
				| @ -19,7 +19,12 @@ | ||||
|       </template> | ||||
|     </div> | ||||
|     <p v-if="!episodes.length" class="py-4 text-center text-lg">{{ $strings.MessageNoEpisodes }}</p> | ||||
|     <template v-for="episode in episodesSorted"> | ||||
|     <div v-if="episodes.length" class="w-full py-3 mx-auto flex"> | ||||
|       <form @submit.prevent="submit" class="flex flex-grow"> | ||||
|         <ui-text-input v-model="search" @input="inputUpdate" placeholder="Search episode..." class="flex-grow mr-2 text-sm md:text-base" /> | ||||
|       </form> | ||||
|     </div> | ||||
|     <template v-for="episode in episodesList"> | ||||
|       <tables-podcast-episode-table-row ref="episodeRow" :key="episode.id" :episode="episode" :library-item-id="libraryItem.id" :selection-mode="isSelectionMode" class="item" @play="playEpisode" @remove="removeEpisode" @edit="editEpisode" @view="viewEpisode" @selected="episodeSelected" @addToQueue="addEpisodeToQueue" @addToPlaylist="addToPlaylist" /> | ||||
|     </template> | ||||
| 
 | ||||
| @ -46,7 +51,10 @@ export default { | ||||
|       selectedEpisodes: [], | ||||
|       episodesToRemove: [], | ||||
|       processing: false, | ||||
|       quickMatchingEpisodes: false | ||||
|       quickMatchingEpisodes: false, | ||||
|       search: null, | ||||
|       searchTimeout: null, | ||||
|       searchText: null, | ||||
|     } | ||||
|   }, | ||||
|   watch: { | ||||
| @ -137,6 +145,15 @@ export default { | ||||
|           return String(a[this.sortKey]).localeCompare(String(b[this.sortKey]), undefined, { numeric: true, sensitivity: 'base' }) | ||||
|         }) | ||||
|     }, | ||||
|     episodesList() { | ||||
|       return this.episodesSorted.filter((episode) => { | ||||
|         if (!this.searchText) return true | ||||
|         return ( | ||||
|             (episode.title && episode.title.toLowerCase().includes(this.searchText)) || | ||||
|             (episode.subtitle && episode.subtitle.toLowerCase().includes(this.searchText)) | ||||
|         ) | ||||
|       }) | ||||
|     }, | ||||
|     selectedIsFinished() { | ||||
|       // Find an item that is not finished, if none then all items finished | ||||
|       return !this.selectedEpisodes.find((episode) => { | ||||
| @ -146,6 +163,16 @@ export default { | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     inputUpdate() { | ||||
|       clearTimeout(this.searchTimeout) | ||||
|       this.searchTimeout = setTimeout(() => { | ||||
|         if (!this.search || !this.search.trim()) { | ||||
|           this.searchText = '' | ||||
|           return | ||||
|         } | ||||
|         this.searchText = this.search.toLowerCase().trim() | ||||
|       }, 500) | ||||
|     }, | ||||
|     contextMenuAction(action) { | ||||
|       if (action === 'quick-match-episodes') { | ||||
|         if (this.quickMatchingEpisodes) return | ||||
| @ -314,4 +341,4 @@ export default { | ||||
| .episode-leave-active { | ||||
|   position: absolute; | ||||
| } | ||||
| </style> | ||||
| </style> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user