diff --git a/front/src/components/federation/LibraryTrackTable.vue b/front/src/components/federation/LibraryTrackTable.vue index dc6eb9d21..e5255252e 100644 --- a/front/src/components/federation/LibraryTrackTable.vue +++ b/front/src/components/federation/LibraryTrackTable.vue @@ -6,7 +6,7 @@ - + @@ -34,28 +35,47 @@ + - + + + + + +
+
Artist
Album Published dateLibrary
- {{ track.title }} + {{ track.title|truncate(30) }} - {{ track.artist_name }} + {{ track.artist_name|truncate(30) }} - {{ track.album_title }} + {{ track.album_title|truncate(20) }} + {{ track.library.actor.domain }} +
+ + + + Showing results {{ ((page-1) * paginateBy) + 1 }}-{{ ((page-1) * paginateBy) + result.results.length }} on {{ result.count }}
@@ -66,14 +86,22 @@ import axios from 'axios' import _ from 'lodash' +import Pagination from '@/components/Pagination' + export default { - props: ['filters'], + props: { + filters: {type: Object, required: false}, + showLibrary: {type: Boolean, default: false} + }, + components: { + Pagination + }, data () { return { isLoading: false, result: null, page: 1, - paginateBy: 50, + paginateBy: 25, search: '', checked: {}, isImporting: false @@ -86,7 +114,7 @@ export default { fetchData () { let params = _.merge({ 'page': this.page, - 'paginate_by': this.paginateBy, + 'page_size': this.paginateBy, 'q': this.search }, this.filters) let self = this @@ -107,7 +135,6 @@ export default { library_tracks: this.checked } axios.post('/submit/federation/', payload).then((response) => { - console.log('Triggered import', response.data) self.isImporting = false self.fetchData() }, error => { @@ -120,7 +147,9 @@ export default { // we uncheck this.checked = [] } else { - this.checked = this.result.results.map(t => { return t.id }) + this.checked = this.result.results.filter(t => { + return t.local_track_file === null + }).map(t => { return t.id }) } }, toggleCheck (id) { @@ -130,6 +159,9 @@ export default { } else { this.checked.push(id) } + }, + selectPage: function (page) { + this.page = page } }, watch: { @@ -137,6 +169,9 @@ export default { if (newValue.length > 0) { this.fetchData() } + }, + page () { + this.fetchData() } } } diff --git a/front/src/router/index.js b/front/src/router/index.js index 2b78375c1..0ef3dcf24 100644 --- a/front/src/router/index.js +++ b/front/src/router/index.js @@ -29,6 +29,7 @@ import FederationBase from '@/views/federation/Base' import FederationScan from '@/views/federation/Scan' import FederationLibraryDetail from '@/views/federation/LibraryDetail' import FederationLibraryList from '@/views/federation/LibraryList' +import FederationTrackList from '@/views/federation/LibraryTrackList' Vue.use(Router) @@ -106,6 +107,17 @@ export default new Router({ defaultPage: route.query.page }) }, + { + path: 'tracks', + name: 'federation.tracks.list', + component: FederationTrackList, + props: (route) => ({ + defaultOrdering: route.query.ordering, + defaultQuery: route.query.query, + defaultPaginateBy: route.query.paginateBy, + defaultPage: route.query.page + }) + }, { path: 'libraries/:id', name: 'federation.libraries.detail', component: FederationLibraryDetail, props: true } ] }, @@ -113,7 +125,7 @@ export default new Router({ path: '/library', component: Library, children: [ - { path: 'scan', component: LibraryHome }, + { path: '', component: LibraryHome }, { path: 'artists/', name: 'library.artists.browse', diff --git a/front/src/views/federation/Base.vue b/front/src/views/federation/Base.vue index 1919fd855..b90ba723a 100644 --- a/front/src/views/federation/Base.vue +++ b/front/src/views/federation/Base.vue @@ -4,6 +4,9 @@ Libraries + Tracks diff --git a/front/src/views/federation/LibraryDetail.vue b/front/src/views/federation/LibraryDetail.vue index 6d9ab2eeb..9dfe50755 100644 --- a/front/src/views/federation/LibraryDetail.vue +++ b/front/src/views/federation/LibraryDetail.vue @@ -102,8 +102,6 @@

Tracks available in this library

-
-
diff --git a/front/src/views/federation/LibraryList.vue b/front/src/views/federation/LibraryList.vue index 5c9d413a9..43800a72e 100644 --- a/front/src/views/federation/LibraryList.vue +++ b/front/src/views/federation/LibraryList.vue @@ -1,5 +1,5 @@ + + + + +