diff --git a/dashboard/src/app/artist.component.html b/dashboard/src/app/artist.component.html index 28dbd11..138fa22 100644 --- a/dashboard/src/app/artist.component.html +++ b/dashboard/src/app/artist.component.html @@ -98,11 +98,11 @@ {{song['Track Number'] ? (("0" + song['Track Number']).slice(-2)) : "--"}} - {{song.Name}} - {{song.Artist}} - {{song.Album}} - {{song['Album Artist'] ? song['Album Artist'] : "-" }} - {{song['Play Count']}} + {{song.Name}} + {{song.Artist}} + {{song.Album}} + {{song['Album Artist'] ? song['Album Artist'] : "-" }} + {{song['Play Count']}} @@ -113,11 +113,11 @@ \ No newline at end of file diff --git a/dashboard/src/app/artist.component.ts b/dashboard/src/app/artist.component.ts index 0f0f1a3..e88e969 100644 --- a/dashboard/src/app/artist.component.ts +++ b/dashboard/src/app/artist.component.ts @@ -29,7 +29,7 @@ export class ArtistComponent implements OnInit { atBottom: boolean = false; sortable: boolean = false; - lockLoadData: boolean = true; + lockLoadData: boolean = false; ngOnInit(): void { this.route.params @@ -42,6 +42,12 @@ export class ArtistComponent implements OnInit { // TODO Duplicate code! loadSongs(): void { + if (this.lockLoadData) { + console.debug("Loading data locked"); + return; + } + + this.lockLoadData = true; this.elsService.getArtistSongs(this.artistName, this.songs.length).subscribe( data => { this.moreDataAvailable = data.length == ElsService.DEFAULT_SIZE; @@ -56,6 +62,7 @@ export class ArtistComponent implements OnInit { this.songs.push(song); }); } + console.debug("Unlock load data"); this.lockLoadData = false; } ); @@ -73,9 +80,8 @@ export class ArtistComponent implements OnInit { * @param event scroll event */ onScroll(event: any) { - if (this.moreDataAvailable && !this.lockLoadData && + if (this.moreDataAvailable && (window.innerHeight + window.scrollY) >= document.body.offsetHeight) { - this.lockLoadData = true; this.loadSongs(); } diff --git a/dashboard/src/app/els.service.ts b/dashboard/src/app/els.service.ts index 1875a7d..c0ec601 100644 --- a/dashboard/src/app/els.service.ts +++ b/dashboard/src/app/els.service.ts @@ -173,7 +173,6 @@ export class ElsService { .map((hits: Array) => { // Theorically, my script prevent to found two documents with this query. // But Prevention is better than cure as Shakespeare said - console.log(hits.length); if (hits.length < 1) { console.info('No artist "' + artistName + '" found.'); return undefined;