60 lines
1.6 KiB
TypeScript

/** @file
* @author Edouard DUPIN
* @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file)
*/
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ArianeService } from 'app/service/ariane';
import { environment } from 'environments/environment';
@Component({
selector: 'app-playlist',
templateUrl: './playlist.html',
styleUrls: [ './playlist.less' ]
})
export class PlaylistScene implements OnInit {
playlistId = -1;
tracksError = '';
tracks = [];
constructor(private route: ActivatedRoute,
private router: Router,
private arianeService: ArianeService) {
}
ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap);
this.playlistId = this.arianeService.getPlaylistId();
console.log(`get parameter id: ${ this.playlistId}`);
/*
let self = this;
this.playlistService.getTrack(this.universId)
.then(function(response) {
self.tracksError = "";
self.tracks = response
}).catch(function(response) {
self.tracksError = "Can not get the List of track without album";
self.tracks = []
});
*/
}
onSelectTrack(event: any, idSelected: number):void {
if(event.which === 2) {
if(environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === '') {
window.open(`/track/${ idSelected}`);
} else {
window.open(`/${ environment.frontBaseUrl }/track/${ idSelected}`);
}
} else {
this.router.navigate([ `track/${ idSelected}` ]);
this.arianeService.setTrack(idSelected);
}
}
}