Fix #326: Can now order tracks on federated track list

merge-requests/315/head
Eliot Berriot 2018-07-06 21:45:51 +02:00
rodzic 75b4a8f652
commit f156b8791d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
3 zmienionych plików z 37 dodań i 1 usunięć

Wyświetl plik

@ -171,6 +171,7 @@ class LibraryTrackFactory(factory.DjangoModelFactory):
audio_url = factory.Faker("url")
audio_mimetype = "audio/ogg"
metadata = factory.SubFactory(LibraryTrackMetadataFactory)
published_date = factory.LazyFunction(timezone.now)
class Meta:
model = models.LibraryTrack

Wyświetl plik

@ -0,0 +1 @@
Can now order tracks on federated track list (#326)

Wyświetl plik

@ -15,6 +15,21 @@
<option :value="'import_pending'"><translate>Import pending</translate></option>
</select>
</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 class="dimmable">
@ -96,8 +111,10 @@ import _ from 'lodash'
import Pagination from '@/components/Pagination'
import ActionTable from '@/components/common/ActionTable'
import OrderingMixin from '@/components/mixins/Ordering'
export default {
mixins: [OrderingMixin],
props: {
filters: {type: Object, required: false},
showLibrary: {type: Boolean, default: false}
@ -113,7 +130,15 @@ export default {
page: 1,
paginateBy: 25,
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 () {
@ -130,6 +155,7 @@ export default {
let params = _.merge({
'page': this.page,
'page_size': this.paginateBy,
'ordering': this.getOrderingAsString(),
'q': this.search
}, this.filters)
if (this.importedFilter !== null) {
@ -178,6 +204,14 @@ export default {
}
},
watch: {
orderingDirection: function () {
this.page = 1
this.fetchData()
},
ordering: function () {
this.page = 1
this.fetchData()
},
search (newValue) {
this.page = 1
this.fetchData()