Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
interfect
funkwhale
Commits
5fee42f8
Verified
Commit
5fee42f8
authored
Apr 17, 2018
by
Eliot Berriot
Browse files
Can now filter by import status on library tracks
parent
183bbe3a
Changes
2
Show whitespace changes
Inline
Side-by-side
api/funkwhale_api/federation/filters.py
View file @
5fee42f8
...
...
@@ -24,6 +24,7 @@ class LibraryFilter(django_filters.FilterSet):
class
LibraryTrackFilter
(
django_filters
.
FilterSet
):
library
=
django_filters
.
CharFilter
(
'library__uuid'
)
imported
=
django_filters
.
CharFilter
(
method
=
'filter_imported'
)
q
=
fields
.
SearchFilter
(
search_fields
=
[
'artist_name'
,
'title'
,
...
...
@@ -31,6 +32,13 @@ class LibraryTrackFilter(django_filters.FilterSet):
'library__actor__domain'
,
])
def
filter_imported
(
self
,
queryset
,
field_name
,
value
):
if
value
.
lower
()
in
[
'true'
,
'1'
,
'yes'
]:
queryset
=
queryset
.
filter
(
local_track_file__isnull
=
False
)
elif
value
.
lower
()
in
[
'false'
,
'0'
,
'no'
]:
queryset
=
queryset
.
filter
(
local_track_file__isnull
=
True
)
return
queryset
class
Meta
:
model
=
models
.
LibraryTrack
fields
=
{
...
...
front/src/components/federation/LibraryTrackTable.vue
View file @
5fee42f8
<
template
>
<div>
<div
class=
"ui inline form"
>
<div
class=
"fields"
>
<div
class=
"ui field"
>
<label>
{{
$t
(
'
Search
'
)
}}
</label>
<input
type=
"text"
v-model=
"search"
placeholder=
"Search by title, artist, domain..."
/>
</div>
<div
class=
"ui field"
>
<label>
{{
$t
(
'
Import status
'
)
}}
</label>
<select
class=
"ui dropdown"
v-model=
"importedFilter"
>
<option
:value=
"null"
>
{{
$t
(
'
Any
'
)
}}
</option>
<option
:value=
"true"
>
{{
$t
(
'
Imported
'
)
}}
</option>
<option
:value=
"false"
>
{{
$t
(
'
Not imported
'
)
}}
</option>
</select>
</div>
</div>
</div>
<table
v-if=
"result"
class=
"ui compact very basic single line unstackable table"
>
<thead>
<tr>
...
...
@@ -112,7 +125,8 @@ export default {
search
:
''
,
checked
:
{
}
,
isImporting
:
false
,
importBatch
:
null
importBatch
:
null
,
importedFilter
:
null
}
}
,
created
()
{
...
...
@@ -125,6 +139,9 @@ export default {
'
page_size
'
:
this
.
paginateBy
,
'
q
'
:
this
.
search
}
,
this
.
filters
)
if
(
this
.
importedFilter
!==
null
)
{
params
.
imported
=
this
.
importedFilter
}
let
self
=
this
self
.
isLoading
=
true
self
.
checked
=
[]
...
...
@@ -181,6 +198,9 @@ export default {
}
,
page
()
{
this
.
fetchData
()
}
,
importedFilter
()
{
this
.
fetchData
()
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment