Resolve "No tracks appear on library tracks page"
This commit is contained in:
parent
9a0a14c096
commit
62154bcd44
|
@ -0,0 +1 @@
|
||||||
|
Fix an issue where the tracks tab in a library doesn't show any tracks (#1683)
|
|
@ -123,11 +123,6 @@ export default {
|
||||||
artist: this.$pgettext('*/*/*/Noun', 'Artist')
|
artist: this.$pgettext('*/*/*/Noun', 'Artist')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
updatePage: function (page) {
|
|
||||||
this.$emit('page-changed', page)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
v-if="search"
|
v-if="search"
|
||||||
v-model="query"
|
v-model="query"
|
||||||
@search="
|
@search="
|
||||||
|
currentPage = 1;
|
||||||
additionalTracks = [];
|
additionalTracks = [];
|
||||||
fetchData();
|
fetchData('tracks/');
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -106,10 +107,10 @@
|
||||||
class="ui center aligned basic segment desktop-and-up"
|
class="ui center aligned basic segment desktop-and-up"
|
||||||
>
|
>
|
||||||
<pagination
|
<pagination
|
||||||
:total="total"
|
:total="totalTracks"
|
||||||
:current="page"
|
:current=" tracks.length > 0 ? page : {currentPage}"
|
||||||
:paginate-by="paginateBy"
|
:paginate-by="paginateBy"
|
||||||
v-on="$listeners"
|
@page-changed="updatePage"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -140,15 +141,16 @@
|
||||||
:is-podcast="isPodcast"
|
:is-podcast="isPodcast"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="paginateResults"
|
v-if="paginateResults && totalTracks > paginateBy"
|
||||||
class="ui center aligned basic segment tablet-and-below"
|
class="ui center aligned basic segment tablet-and-below"
|
||||||
>
|
>
|
||||||
<pagination
|
<pagination
|
||||||
v-if="paginateResults"
|
v-if="paginateResults && totalTracks > paginateBy"
|
||||||
:total="total"
|
:paginate-by="paginateBy"
|
||||||
:current="page"
|
:total="totalTracks"
|
||||||
|
:current="tracks.length > 0 ? page : {currentPage}"
|
||||||
:compact="true"
|
:compact="true"
|
||||||
v-on="$listeners"
|
@page-changed="updatePage"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -194,10 +196,11 @@ export default {
|
||||||
fetchDataUrl: this.nextUrl,
|
fetchDataUrl: this.nextUrl,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
additionalTracks: [],
|
additionalTracks: [],
|
||||||
query: ''
|
query: '',
|
||||||
|
totalTracks: this.total,
|
||||||
|
currentPage: this.page,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
allTracks () {
|
allTracks () {
|
||||||
return (this.tracks || []).concat(this.additionalTracks)
|
return (this.tracks || []).concat(this.additionalTracks)
|
||||||
|
@ -212,7 +215,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
if (!this.tracks) {
|
if (this.tracks.length === 0) {
|
||||||
this.fetchData('tracks/')
|
this.fetchData('tracks/')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -224,15 +227,15 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
const self = this
|
const self = this
|
||||||
const params = _.clone(this.filters)
|
const params = _.clone(this.filters)
|
||||||
const tracksPromise = axios.get(url, { params: params })
|
params.page_size = this.paginateBy
|
||||||
params.page_size = this.limit
|
params.page = this.currentPage
|
||||||
params.page = this.page
|
|
||||||
params.include_channels = true
|
params.include_channels = true
|
||||||
|
params.q = this.query
|
||||||
|
const tracksPromise = await axios.get(url, { params: params })
|
||||||
try {
|
try {
|
||||||
await tracksPromise
|
self.fetchDataUrl = tracksPromise.data.next
|
||||||
self.nextPage = tracksPromise.data.next
|
self.additionalTracks = tracksPromise.data.results
|
||||||
self.objects = tracksPromise.data.results
|
self.totalTracks = tracksPromise.data.count
|
||||||
self.count = tracksPromise.data.count
|
|
||||||
self.$emit('fetched', tracksPromise.data)
|
self.$emit('fetched', tracksPromise.data)
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -241,7 +244,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updatePage: function (page) {
|
updatePage: function (page) {
|
||||||
this.$emit('page-changed', page)
|
if (this.tracks.length === 0) {
|
||||||
|
this.currentPage = page
|
||||||
|
this.fetchData('tracks/')
|
||||||
|
} else {
|
||||||
|
this.$emit('page-changed', page)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
TrackTable
|
TrackTable
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: { type: String, required: true },
|
object: { type: [Object, String], required: true },
|
||||||
isOwner: { type: Boolean, required: true }
|
isOwner: { type: Boolean, required: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue