Initialise the selected provider to the default for the library when the batch quick match is first opened or if the user has switched libraries.

This commit is contained in:
Nick Thomson 2022-09-24 18:23:33 +01:00
parent 9983fe7d66
commit 11e3cf4f19

View File

@ -54,8 +54,10 @@ export default {
data() {
return {
processing: false,
isScrollable: false,
lastUsedLibrary: undefined,
options: {
provider: 'google',
provider: undefined,
overrideDetails: true,
overrideCover: true,
overrideDefaults: true
@ -66,6 +68,13 @@ export default {
}
}
},
watch: {
show: {
handler(newVal) {
this.init()
}
}
},
computed: {
show: {
get() {
@ -90,9 +99,20 @@ export default {
providers() {
if (this.isPodcast) return this.$store.state.scanners.podcastProviders
return this.$store.state.scanners.providers
}
},
libraryProvider() {
return this.$store.getters['libraries/getLibraryProvider'](this.currentLibraryId) || 'google'
},
},
methods: {
init() {
// If we don't have a set provider (first open of dialog) or we've switched library, set
// the selected provider to the current library default provider
if (!this.options.provider || (this.options.lastUsedLibrary != this.currentLibraryId)) {
this.options.lastUsedLibrary = this.currentLibraryId
this.options.provider = this.libraryProvider;
}
},
doBatchQuickMatch() {
if (!this.selectedBookIds.length) return
if (this.processing) return