diff --git a/front/src/app/component/element-player-audio/element-player-audio.less b/front/src/app/component/element-player-audio/element-player-audio.less index 1b6dee3..9eae344 100644 --- a/front/src/app/component/element-player-audio/element-player-audio.less +++ b/front/src/app/component/element-player-audio/element-player-audio.less @@ -82,6 +82,7 @@ } .title { + width: 100%; font-size: 24px; font-weight: bold; } diff --git a/front/src/app/scene/album/album.html b/front/src/app/scene/album/album.html index b8fc6f0..9b2da3f 100644 --- a/front/src/app/scene/album/album.html +++ b/front/src/app/scene/album/album.html @@ -19,9 +19,14 @@ -
-
- +
+
+ +
+
+
+
+
diff --git a/front/src/app/scene/album/album.ts b/front/src/app/scene/album/album.ts index 89ac5f6..4127642 100644 --- a/front/src/app/scene/album/album.ts +++ b/front/src/app/scene/album/album.ts @@ -8,6 +8,7 @@ import { Component, OnInit } from '@angular/core'; import { Media } from 'app/model'; import { ArtistService, DataService, ArianeService, AlbumService, TrackService, PlayerService } from 'app/service'; +import { arrayUnique } from 'common/utils/arrayTools'; @Component({ selector: 'app-album', @@ -15,11 +16,11 @@ import { ArtistService, DataService, ArianeService, AlbumService, TrackService, }) export class AlbumScene implements OnInit { - public idArtist = -1; - public idAlbum = -1; - public name: string = ''; + public artistIds: number[] = []; + public idAlbum: number = -1; + public name: string = '???'; public description: string = undefined; - public covers: Array = undefined; + public artistCovers: Array = undefined; public albumName: string = ''; public albumDescription: string = undefined; public albumCovers: string[] = undefined; @@ -34,26 +35,12 @@ export class AlbumScene implements OnInit { private arianeService: ArianeService, private playerService: PlayerService, private dataService: DataService) { - } ngOnInit() { - // this.idPlaylist = parseInt(this.route.snapshot.paramMap.get('universId')); - // this.idType = parseInt(this.route.snapshot.paramMap.get('typeId')); - this.idArtist = this.arianeService.getArtistId(); + //this.artistIds = [this.arianeService.getArtistId()]; this.idAlbum = this.arianeService.getAlbumId(); let self = this; - this.artistService.get(this.idArtist) - .then((response) => { - self.name = response.name; - self.description = response.description; - self.covers = this.dataService.getCoverListUrl(response.covers); - }).catch((response) => { - self.description = undefined; - self.name = '???'; - self.covers = undefined; - // no check just ==> an error occured on album - }); this.albumService.get(this.idAlbum) .then((response) => { self.albumName = response.name; @@ -70,6 +57,28 @@ export class AlbumScene implements OnInit { this.trackService.getWithAlbum(self.idAlbum) .then((response2: Media[]) => { self.tracks = response2; + self.artistIds = [] + self.tracks.forEach(element => { + self.artistIds = [...self.artistIds, ...element.artists]; + }); + self.artistIds = arrayUnique(self.artistIds); + if (self.artistIds.length === 0) { + console.error("No artist found !!!"); + return; + } else if (self.artistIds.length > 1) { + console.error("More than 1 artist ==> not managed"); + } + // TODO: display more than 1 ... + self.artistService.get(self.artistIds[0]) + .then((response) => { + self.name = response.name; + self.description = response.description; + self.artistCovers = self.dataService.getCoverListUrl(response.covers); + }).catch((response) => { + self.description = undefined; + self.name = '???'; + self.artistCovers = undefined; + }); //console.log(`>>>>BBB get tracks : ${JSON.stringify(response2, null, 2)}`); }).catch((response) => { //console.log(`>>>>BBB plop`); diff --git a/front/src/app/scene/album/albums.html b/front/src/app/scene/album/albums.html index 008e04d..e9ecb7e 100644 --- a/front/src/app/scene/album/albums.html +++ b/front/src/app/scene/album/albums.html @@ -24,15 +24,19 @@
-
Albums:
-
Album:
-
+
Albums:
+
diff --git a/front/src/app/scene/album/albums.ts b/front/src/app/scene/album/albums.ts index 6a8dbd9..72a1afa 100644 --- a/front/src/app/scene/album/albums.ts +++ b/front/src/app/scene/album/albums.ts @@ -8,6 +8,7 @@ import { Component, OnInit } from '@angular/core'; import { ArtistService, DataService, ArianeService, AlbumService, PlayerService, TrackService } from 'app/service'; import { NodeData } from 'common/model'; +import { filter } from 'rxjs'; @Component({ selector: 'app-albums', @@ -19,6 +20,7 @@ export class AlbumsScene implements OnInit { public description: string = undefined; public covers: string[] = undefined; public albums: NodeData[] = undefined; + public albumsSave: NodeData[] = undefined; public tracks: any[] = undefined; public countSubElement: number = undefined; countTrack: (id: number) => Promise; @@ -54,6 +56,7 @@ export class AlbumsScene implements OnInit { .then((response: NodeData[]) => { //console.log(`>>>> get album : ${JSON.stringify(response)}`) self.albums = response; + self.albumsSave = [...response]; }).catch((response) => { self.albums = undefined; }); @@ -69,7 +72,12 @@ export class AlbumsScene implements OnInit { */ } - + onSearch(value: string) { + console.log(`Search value: ${value}`); + this.albums = this.albumsSave.filter(element => { + return element.name.toLowerCase().includes(value.toLowerCase());; + }) + } onSelectAlbum(event: any, idSelected: number): void { if (event.ctrlKey) { diff --git a/front/src/app/scene/artist/artist-album.html b/front/src/app/scene/artist/artist-album.html index 3b72be1..0a464fa 100644 --- a/front/src/app/scene/artist/artist-album.html +++ b/front/src/app/scene/artist/artist-album.html @@ -19,9 +19,14 @@
-
+
- + +
+
+
+
+
diff --git a/front/src/app/scene/artist/artist-album.ts b/front/src/app/scene/artist/artist-album.ts index 3d3102c..6a2425d 100644 --- a/front/src/app/scene/artist/artist-album.ts +++ b/front/src/app/scene/artist/artist-album.ts @@ -19,7 +19,7 @@ export class ArtistAlbumScene implements OnInit { public idAlbum = -1; public name: string = ''; public description: string = undefined; - public covers: Array = undefined; + public artistCovers: Array = undefined; public albumName: string = ''; public albumDescription: string = undefined; public albumCovers: string[] = undefined; @@ -47,11 +47,11 @@ export class ArtistAlbumScene implements OnInit { .then((response) => { self.name = response.name; self.description = response.description; - self.covers = this.dataService.getCoverListUrl(response.covers); + self.artistCovers = this.dataService.getCoverListUrl(response.covers); }).catch((response) => { self.description = undefined; self.name = '???'; - self.covers = undefined; + self.artistCovers = undefined; // no check just ==> an error occured on album }); this.albumService.get(this.idAlbum) diff --git a/front/src/app/scene/artist/artists.html b/front/src/app/scene/artist/artists.html index 0c82d4d..e460d94 100644 --- a/front/src/app/scene/artist/artists.html +++ b/front/src/app/scene/artist/artists.html @@ -24,8 +24,7 @@
-
Artists:
-
Artist:
+
Artists:
Promise; countAlbum: (id: number) => Promise; @@ -41,11 +43,20 @@ export class ArtistsScene implements OnInit { this.artistService.getOrder() .then((response: NodeData[]) => { self.artists = response; + self.artistsSave = [...response]; //console.log("get artists: " + JSON.stringify(self.artists)); }).catch((response) => { self.artists = undefined; }); } + + onSearch(value: string) { + console.log(`Search value: ${value}`); + this.artists = this.artistsSave.filter(element => { + return element.name.toLowerCase().includes(value.toLowerCase());; + }) + } + onSelectArtist(event: any, idSelected: number): void { if (event.ctrlKey) { this.arianeService.navigateArtistEdit({ id: idSelected, newWindows: event.which === 2 });