Commit 2f5a13a3 authored by Eliot Berriot's avatar Eliot Berriot 💬

Fix #199: unplayable tracks are now properly disabled in the interface

parent 6f79dd47
......@@ -38,6 +38,7 @@ class ImportBatchAdmin(admin.ModelAdmin):
search_fields = [
'import_request__name', 'source', 'batch__pk', 'mbid']
@admin.register(models.ImportJob)
class ImportJobAdmin(admin.ModelAdmin):
list_display = ['source', 'batch', 'track_file', 'status', 'mbid']
......@@ -77,5 +78,10 @@ class TrackFileAdmin(admin.ModelAdmin):
list_select_related = [
'track'
]
search_fields = ['source', 'acoustid_track_id']
search_fields = [
'source',
'acoustid_track_id',
'track__title',
'track__album__title',
'track__artist__name']
list_filter = ['mimetype']
Uplayable tracks are now properly disabled in the interface (#199)
<template>
<div :class="['ui', {'tiny': discrete}, 'buttons']">
<div :title="title" :class="['ui', {'tiny': discrete}, 'buttons']">
<button
:title="$t('Add to current queue')"
@click="addNext(true)"
:disabled="!playable"
:class="['ui', {loading: isLoading}, {'mini': discrete}, {disabled: !playable}, 'button']">
<i class="ui play icon"></i>
<template v-if="!discrete"><slot><i18next path="Play"/></slot></template>
......@@ -10,9 +11,9 @@
<div v-if="!discrete" :class="['ui', {disabled: !playable}, 'floating', 'dropdown', 'icon', 'button']">
<i class="dropdown icon"></i>
<div class="menu">
<div class="item"@click="add"><i class="plus icon"></i><i18next path="Add to queue"/></div>
<div class="item"@click="addNext()"><i class="step forward icon"></i><i18next path="Play next"/></div>
<div class="item"@click="addNext(true)"><i class="arrow down icon"></i><i18next path="Play now"/></div>
<div class="item" :disabled="!playable" @click="add"><i class="plus icon"></i><i18next path="Add to queue"/></div>
<div class="item" :disabled="!playable" @click="addNext()"><i class="step forward icon"></i><i18next path="Play next"/></div>
<div class="item" :disabled="!playable" @click="addNext(true)"><i class="arrow down icon"></i><i18next path="Play now"/></div>
</div>
</div>
</div>
......@@ -45,9 +46,18 @@ export default {
jQuery(this.$el).find('.ui.dropdown').dropdown()
},
computed: {
title () {
if (this.playable) {
return this.$t('Play immediatly')
} else {
if (this.track) {
return this.$t('This track is not imported and cannot be played')
}
}
},
playable () {
if (this.track) {
return true
return this.track.files.length > 0
} else if (this.tracks) {
return this.tracks.length > 0
} else if (this.playlist) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment