diff --git a/api/config/settings/common.py b/api/config/settings/common.py index 87740e818..6a2299bb4 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -54,6 +54,7 @@ THIRD_PARTY_APPS = ( 'rest_auth.registration', 'mptt', 'dynamic_preferences', + 'django_filters', ) # Apps specific for this project go here. @@ -298,7 +299,7 @@ REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), - 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', + 'DEFAULT_PAGINATION_CLASS': 'funkwhale_api.common.pagination.FunkwhalePagination', 'PAGE_SIZE': 25, 'DEFAULT_AUTHENTICATION_CLASSES': ( diff --git a/api/funkwhale_api/common/pagination.py b/api/funkwhale_api/common/pagination.py new file mode 100644 index 000000000..224c470dc --- /dev/null +++ b/api/funkwhale_api/common/pagination.py @@ -0,0 +1,6 @@ +from rest_framework.pagination import PageNumberPagination + + +class FunkwhalePagination(PageNumberPagination): + page_size_query_param = 'page_size' + max_page_size = 25 diff --git a/front/src/components/favorites/List.vue b/front/src/components/favorites/List.vue index 053f62bc6..7e3e23505 100644 --- a/front/src/components/favorites/List.vue +++ b/front/src/components/favorites/List.vue @@ -17,6 +17,7 @@ @@ -48,6 +49,7 @@ export default { nextLink: null, previousLink: null, page: 1, + paginateBy: 25, favoriteTracks } }, @@ -60,7 +62,8 @@ export default { this.isLoading = true let params = { favorites: 'true', - page: this.page + page: this.page, + page_size: this.paginateBy } logger.default.time('Loading user favorites') this.$http.get(url, {params: params}).then((response) => { diff --git a/front/src/components/library/Artists.vue b/front/src/components/library/Artists.vue new file mode 100644 index 000000000..a9890dada --- /dev/null +++ b/front/src/components/library/Artists.vue @@ -0,0 +1,86 @@ + + + + + + diff --git a/front/src/components/library/Library.vue b/front/src/components/library/Library.vue index 56b750a4a..da9ac19b3 100644 --- a/front/src/components/library/Library.vue +++ b/front/src/components/library/Library.vue @@ -2,8 +2,11 @@
diff --git a/front/src/router/index.js b/front/src/router/index.js index cb8f9c1b5..e546172b5 100644 --- a/front/src/router/index.js +++ b/front/src/router/index.js @@ -7,6 +7,7 @@ import Logout from '@/components/auth/Logout' import Library from '@/components/library/Library' import LibraryHome from '@/components/library/Home' import LibraryArtist from '@/components/library/Artist' +import LibraryArtists from '@/components/library/Artists' import LibraryAlbum from '@/components/library/Album' import LibraryTrack from '@/components/library/Track' import LibraryImport from '@/components/library/import/Main' @@ -51,6 +52,7 @@ export default new Router({ component: Library, children: [ { path: '', component: LibraryHome }, + { path: 'artists/', name: 'library.artists.browse', component: LibraryArtists }, { path: 'artists/:id', name: 'library.artists.detail', component: LibraryArtist, props: true }, { path: 'albums/:id', name: 'library.albums.detail', component: LibraryAlbum, props: true }, { path: 'tracks/:id', name: 'library.tracks.detail', component: LibraryTrack, props: true },