kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
Fix #326: Can now order tracks on federated track list
rodzic
75b4a8f652
commit
f156b8791d
|
@ -171,6 +171,7 @@ class LibraryTrackFactory(factory.DjangoModelFactory):
|
||||||
audio_url = factory.Faker("url")
|
audio_url = factory.Faker("url")
|
||||||
audio_mimetype = "audio/ogg"
|
audio_mimetype = "audio/ogg"
|
||||||
metadata = factory.SubFactory(LibraryTrackMetadataFactory)
|
metadata = factory.SubFactory(LibraryTrackMetadataFactory)
|
||||||
|
published_date = factory.LazyFunction(timezone.now)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.LibraryTrack
|
model = models.LibraryTrack
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Can now order tracks on federated track list (#326)
|
|
@ -15,6 +15,21 @@
|
||||||
<option :value="'import_pending'"><translate>Import pending</translate></option>
|
<option :value="'import_pending'"><translate>Import pending</translate></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label><translate>Ordering</translate></label>
|
||||||
|
<select class="ui dropdown" v-model="ordering">
|
||||||
|
<option v-for="option in orderingOptions" :value="option[0]">
|
||||||
|
{{ option[1] }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label><translate>Ordering direction</translate></label>
|
||||||
|
<select class="ui dropdown" v-model="orderingDirection">
|
||||||
|
<option value="+"><translate>Ascending</translate></option>
|
||||||
|
<option value="-"><translate>Descending</translate></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dimmable">
|
<div class="dimmable">
|
||||||
|
@ -96,8 +111,10 @@ import _ from 'lodash'
|
||||||
|
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
import ActionTable from '@/components/common/ActionTable'
|
import ActionTable from '@/components/common/ActionTable'
|
||||||
|
import OrderingMixin from '@/components/mixins/Ordering'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [OrderingMixin],
|
||||||
props: {
|
props: {
|
||||||
filters: {type: Object, required: false},
|
filters: {type: Object, required: false},
|
||||||
showLibrary: {type: Boolean, default: false}
|
showLibrary: {type: Boolean, default: false}
|
||||||
|
@ -113,7 +130,15 @@ export default {
|
||||||
page: 1,
|
page: 1,
|
||||||
paginateBy: 25,
|
paginateBy: 25,
|
||||||
search: '',
|
search: '',
|
||||||
importedFilter: null
|
importedFilter: null,
|
||||||
|
orderingDirection: '-',
|
||||||
|
ordering: 'published_date',
|
||||||
|
orderingOptions: [
|
||||||
|
['published_date', 'Published date'],
|
||||||
|
['title', 'Title'],
|
||||||
|
['album_title', 'Album title'],
|
||||||
|
['artist_name', 'Artist name']
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@ -130,6 +155,7 @@ export default {
|
||||||
let params = _.merge({
|
let params = _.merge({
|
||||||
'page': this.page,
|
'page': this.page,
|
||||||
'page_size': this.paginateBy,
|
'page_size': this.paginateBy,
|
||||||
|
'ordering': this.getOrderingAsString(),
|
||||||
'q': this.search
|
'q': this.search
|
||||||
}, this.filters)
|
}, this.filters)
|
||||||
if (this.importedFilter !== null) {
|
if (this.importedFilter !== null) {
|
||||||
|
@ -178,6 +204,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
orderingDirection: function () {
|
||||||
|
this.page = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
ordering: function () {
|
||||||
|
this.page = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
search (newValue) {
|
search (newValue) {
|
||||||
this.page = 1
|
this.page = 1
|
||||||
this.fetchData()
|
this.fetchData()
|
||||||
|
|
Ładowanie…
Reference in New Issue