better interface
This commit is contained in:
parent
7a24b688c0
commit
d330d623d9
@ -35,7 +35,7 @@ public class AlbumResource {
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Album put(String jsonRequest) throws Exception {
|
||||
public Album post(String jsonRequest) throws Exception {
|
||||
return SqlWrapper.insertWithJson(Album.class, jsonRequest);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div class="bottom" *ngIf="mediaSource">
|
||||
<div class="media" >
|
||||
<div class="media-elem">
|
||||
<video width="1" height="1" src="{{mediaSource}}"
|
||||
<audio width="1" height="1" src="{{mediaSource}}"
|
||||
#mediaPlayer
|
||||
preload
|
||||
(play)="changeStateToPlay()"
|
||||
@ -13,11 +13,14 @@
|
||||
(ended)="onAudioEnded()"
|
||||
><!-- controls > --> <!--preload="none"-->
|
||||
<!--<p>Your browser does not support HTML5 media player. download media: <a href="{{mediaSource}}>link here</a>.</p>-->
|
||||
</video>
|
||||
</audio>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="timer">
|
||||
<div>
|
||||
<div class="timer-title">
|
||||
<label class="unselectable label">{{nameData}}</label>
|
||||
</div>
|
||||
<div class="timer-lines">
|
||||
<input type="range" min="0" class="slider"
|
||||
[value]="currentTime"
|
||||
[max]="duration"
|
||||
@ -37,20 +40,7 @@
|
||||
<button (click)="onPlayMode()"><i class="material-icons">{{playMode}}</i></button>
|
||||
<!--<button (click)="onMore()" ><i class="material-icons">more_vert</i></button>-->
|
||||
<!--<button (click)="onTakeScreenShoot()"><i class="material-icons">add_a_photo</i></button>-->
|
||||
<button (click)="onVolumeMenu()" ><i class="material-icons">volume_up</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="volume" *ngIf="volume_displayMenu">
|
||||
<div class="volume-menu">
|
||||
<div class="slidecontainer">
|
||||
<input type="range" min="0" max="100" class="slider"
|
||||
[value]="volumeValue"
|
||||
(input)="onVolume($event.target)">
|
||||
</div>
|
||||
<button (click)="onVolumeMute()" *ngIf="!mediaPlayer.muted"><i class="material-icons">volume_mute</i></button>
|
||||
<button (click)="onVolumeUnMute()" *ngIf="mediaPlayer.muted"><i class="material-icons">volume_off</i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,32 +1,8 @@
|
||||
|
||||
.bottom {
|
||||
/*
|
||||
position: fixed;
|
||||
|
||||
bottom:0px;
|
||||
left:0px;
|
||||
|
||||
display: block;
|
||||
overflow: visible;
|
||||
|
||||
box-shadow: none;
|
||||
min-height: 56px;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0 12px 0 12px;
|
||||
border: none;
|
||||
max-height: 1000px;
|
||||
z-index: 3;
|
||||
box-shadow: 0 -4px 4px rgba(0, 0, 0, 0.6);
|
||||
*/
|
||||
.controls {
|
||||
//visibility: hidden;
|
||||
opacity: 0.5;
|
||||
opacity: 0.85;
|
||||
width: 96%;
|
||||
height: 150px;
|
||||
border-radius: 10px;
|
||||
@ -55,60 +31,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.bigPause {
|
||||
position: fixed;
|
||||
top: 120px;
|
||||
left: 40%;
|
||||
width: 20%;
|
||||
height: calc(90% - 120px*2);
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
cursor: pointer;
|
||||
.material-icons {
|
||||
color: #FFF;
|
||||
font-size: 120px;
|
||||
color: green;
|
||||
}
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
opacity: 95%;
|
||||
}
|
||||
.bigRewind {
|
||||
position: fixed;
|
||||
top: 120px;
|
||||
left: 20%;
|
||||
width: 20%;
|
||||
height: calc(90% - 120px*2);
|
||||
border: none;
|
||||
.material-icons {
|
||||
color: #FFF;
|
||||
font-size: 120px;
|
||||
color: red;
|
||||
}
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
opacity: 95%;
|
||||
}
|
||||
.bigForward {
|
||||
position: fixed;
|
||||
top: 120px;
|
||||
left: 60%;
|
||||
width: 20%;
|
||||
height: calc(90% - 120px*2);
|
||||
border: none;
|
||||
.material-icons {
|
||||
color: #FFF;
|
||||
font-size: 120px;
|
||||
color: blue;
|
||||
}
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
opacity: 95%;
|
||||
}
|
||||
|
||||
.slidecontainer {
|
||||
line-height: 38px;
|
||||
font-size: 10px;
|
||||
@ -121,7 +43,8 @@
|
||||
.slider {
|
||||
position: relative;
|
||||
-webkit-appearance: none;
|
||||
width: 100%;
|
||||
//width: calc(100% - 60px);
|
||||
width: 95%;
|
||||
height: 10px;
|
||||
top: 5px;
|
||||
border-radius: 5px;
|
||||
@ -150,15 +73,30 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.timer-title {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
width: 100%;
|
||||
font-size: 20px;
|
||||
font-weight:bold;
|
||||
bottom: 104px;
|
||||
}
|
||||
.timer-lines {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
//width: calc(100%-60px);
|
||||
font-size: 20px;
|
||||
font-weight:bold;
|
||||
bottom: 82px;
|
||||
}
|
||||
.timer-text {
|
||||
position: absolute;
|
||||
//top: 25px;
|
||||
left: 30px;
|
||||
width: 100%;
|
||||
//line-height: 38px;
|
||||
font-size: 20px;
|
||||
font-weight:bold;
|
||||
}
|
||||
left: 30px;
|
||||
width: 100%;
|
||||
font-size: 20px;
|
||||
font-weight:bold;
|
||||
bottom: 40px;
|
||||
}
|
||||
.timer-control {
|
||||
position: absolute;
|
||||
//top: 25px;
|
||||
@ -167,7 +105,7 @@
|
||||
//line-height: 38px;
|
||||
font-size: 30px;
|
||||
font-weight:bold;
|
||||
bottom: 20px;
|
||||
bottom: 0px;
|
||||
}
|
||||
.label {
|
||||
//transform: translate(-12px,-12px);
|
||||
@ -218,89 +156,4 @@
|
||||
}
|
||||
|
||||
|
||||
.volume-menu {
|
||||
font-size: 40px;
|
||||
opacity: 0.5;
|
||||
width: 300px;
|
||||
height: 60px;
|
||||
border-radius: 10px;
|
||||
position: absolute;
|
||||
bottom: 90px;
|
||||
right: 2%;
|
||||
//margin-left: -200px;
|
||||
background-color: black;
|
||||
box-shadow: 3px 3px 5px black;
|
||||
transition: 1s all;
|
||||
display: flex;
|
||||
|
||||
.material-icons {
|
||||
vertical-align: middle;
|
||||
color: #FFF;
|
||||
font-size: 40px;
|
||||
}
|
||||
/* Create an Arraw on the top ob the box ... */
|
||||
&:after, &:before {
|
||||
bottom: 100%;
|
||||
right: 13px;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:after {
|
||||
border-color: rgba(136, 183, 213, 0);
|
||||
border-bottom-color: #263238;
|
||||
border-width: 15px;
|
||||
margin-left: -15px;
|
||||
}
|
||||
button {
|
||||
border: none;
|
||||
background: none;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.slidecontainer {
|
||||
line-height: 38px;
|
||||
font-size: 10px;
|
||||
font-family: monospace;
|
||||
text-shadow: 1px 1px 0px black;
|
||||
color: white;
|
||||
flex: 5;
|
||||
position: relative;
|
||||
}
|
||||
.slider {
|
||||
position: relative;
|
||||
-webkit-appearance: none;
|
||||
width: 98%;
|
||||
height: 10px;
|
||||
top: 15px;
|
||||
border-radius: 5px;
|
||||
background: #d3d3d3;
|
||||
outline: none;
|
||||
opacity: 0.7;
|
||||
-webkit-transition: .2s;
|
||||
transition: opacity .2s;
|
||||
flex: 5;
|
||||
}
|
||||
.slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 50%;
|
||||
background: #4CAF50;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.slider::-moz-range-thumb {
|
||||
width: 25px;
|
||||
height: 25px;
|
||||
border-radius: 50%;
|
||||
background: #4CAF50;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
|
||||
import { isArrayOf, isNullOrUndefined, isNumberFinite } from 'common/utils';
|
||||
import { isArray, isArrayOf, isNullOrUndefined, isNumberFinite } from 'common/utils';
|
||||
import { NodeData } from 'common/model';
|
||||
|
||||
import { GenderService, DataService, PlayerService, TrackService } from 'app/service';
|
||||
import { GenderService, DataService, PlayerService, TrackService, AlbumService, ArtistService } from 'app/service';
|
||||
import { PlaylistCurrent } from 'app/service/player';
|
||||
import { Media } from 'app/model';
|
||||
import { HttpWrapperService } from 'common/service';
|
||||
@ -27,7 +27,7 @@ export enum PlayMode {
|
||||
styleUrls: [ './element-player-audio.less' ]
|
||||
})
|
||||
export class ElementPlayerAudioComponent implements OnInit {
|
||||
mediaPlayer: HTMLVideoElement;
|
||||
mediaPlayer: HTMLAudioElement;
|
||||
duration: number;
|
||||
durationDisplay: string;
|
||||
@ViewChild('mediaPlayer')
|
||||
@ -48,6 +48,7 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
public volume_value: number = 100;
|
||||
public volume_displayMenu: boolean = false;
|
||||
|
||||
nameData: string;
|
||||
playStream: boolean;
|
||||
isPlaying: boolean;
|
||||
currentTime: any;
|
||||
@ -69,12 +70,14 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
constructor(
|
||||
private playerService: PlayerService,
|
||||
private trackService: TrackService,
|
||||
private albumService: AlbumService,
|
||||
private artistService: ArtistService,
|
||||
private httpService: HttpWrapperService,
|
||||
private dataService: DataService) {
|
||||
// nothing to do...
|
||||
}
|
||||
private currentLMedia: Media = undefined;
|
||||
private localIdStreaming: number = undefined;
|
||||
private currentLMedia: Media;
|
||||
private localIdStreaming: number;
|
||||
private localListStreaming: number[] = [];
|
||||
ngOnInit() {
|
||||
/*
|
||||
@ -101,7 +104,22 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
this.trackService.get(this.localListStreaming[this.localIdStreaming])
|
||||
.then((response: Media) => {
|
||||
//console.log(`get response of video : ${ JSON.stringify(response, null, 2)}`);
|
||||
this.currentLMedia = response;
|
||||
self.currentLMedia = response;
|
||||
self.nameData = response.name;
|
||||
if (!isNullOrUndefined(response.albumId)) {
|
||||
this.albumService.get(response.albumId)
|
||||
.then((response2: NodeData) => {
|
||||
self.nameData = response2.name + " - " + self.nameData;
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
if (!isNullOrUndefined(response.artists) && isArray(response.artists) && response.artists.length > 0) {
|
||||
this.artistService.get(response.artists[0])
|
||||
.then((response2: NodeData) => {
|
||||
self.nameData = self.nameData + " (" + response2.name + ")";
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
if (isNullOrUndefined(self.currentLMedia)) {
|
||||
console.log("Can not retreive the media ...")
|
||||
return;
|
||||
@ -304,9 +322,6 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
this.onNext();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
changeStateToPlay() {
|
||||
@ -355,23 +370,21 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
onPlay() {
|
||||
console.log('play');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
this.lockPlayerEnable();
|
||||
this.mediaPlayer.play();
|
||||
}
|
||||
|
||||
onPause() {
|
||||
console.log('pause');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
this.unlockPlayerEnable();
|
||||
this.mediaPlayer.pause();
|
||||
}
|
||||
|
||||
@ -386,12 +399,11 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
onStop() {
|
||||
console.log('stop');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
this.unlockPlayerEnable();
|
||||
this.mediaPlayer.pause();
|
||||
this.mediaPlayer.currentTime = 0;
|
||||
}
|
||||
@ -420,9 +432,7 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
seek(newValue:any) {
|
||||
console.log(`seek ${ newValue.value}`);
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
@ -431,9 +441,7 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
onRewind() {
|
||||
console.log('rewind');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
@ -442,9 +450,7 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
onForward() {
|
||||
console.log('forward');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
@ -453,50 +459,38 @@ export class ElementPlayerAudioComponent implements OnInit {
|
||||
|
||||
onMore() {
|
||||
console.log('more');
|
||||
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
if(isNullOrUndefined(this.mediaPlayer)) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onVolumeMenu() {
|
||||
this.volume_displayMenu = !this.volume_displayMenu;
|
||||
//this.startHideTimer();
|
||||
}
|
||||
|
||||
onVolume(newValue:any) {
|
||||
console.log(`onVolume ${ newValue.value}`);
|
||||
//this.startHideTimer();
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
// these element is to permit to not stop music when sceen is off !!
|
||||
wakeLock = null;
|
||||
unlockPlayerEnable() {
|
||||
let tmppp = this.wakeLock;
|
||||
this.wakeLock = null;
|
||||
if (!isNullOrUndefined(tmppp)) {
|
||||
tmppp.release();
|
||||
}
|
||||
this.volume_value = newValue.value;
|
||||
this.mediaPlayer.volume = this.volume_value / 100;
|
||||
this.mediaPlayer.muted = false;
|
||||
try {
|
||||
let tmp = navigator as any;
|
||||
this.wakeLock = tmp.wakeLock.request('screen');
|
||||
} catch (err) {
|
||||
// The Wake Lock request has failed - usually system related, such as battery.
|
||||
console.log(`Can not lock screen element: ${err.name}, ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
onVolumeMute() {
|
||||
//this.startHideTimer();
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
lockPlayerEnable() {
|
||||
if ('wakeLock' in navigator) {
|
||||
try {
|
||||
let tmp = navigator as any;
|
||||
this.wakeLock = tmp.wakeLock.request('screen');
|
||||
} catch (err) {
|
||||
// The Wake Lock request has failed - usually system related, such as battery.
|
||||
console.log(`Can not lock screen element: ${err.name}, ${err.message}`);
|
||||
}
|
||||
}
|
||||
this.mediaPlayer.muted = true;
|
||||
}
|
||||
|
||||
onVolumeUnMute() {
|
||||
//this.startHideTimer();
|
||||
if(this.mediaPlayer === null ||
|
||||
this.mediaPlayer === undefined) {
|
||||
console.log(`error element: ${ this.mediaPlayer}`);
|
||||
return;
|
||||
}
|
||||
this.mediaPlayer.muted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ export class TopMenuComponent implements OnInit {
|
||||
|
||||
onArianeArtist(event: any): void {
|
||||
console.log(`onArianeArtist(${ this.arianeArtistId })`);
|
||||
//this.arianeService.navigateArtist(this.arianeArtistId, event.which === 2);
|
||||
this.arianeService.navigateArtist( {artistId: this.arianeArtistId, newWindows: event.which === 2 } );
|
||||
}
|
||||
|
||||
onArianeAlbum(event: any): void {
|
||||
|
@ -1,17 +1,16 @@
|
||||
import { isNumberFinite, isString, isOptionalOf } from "common/utils";
|
||||
import { isNumberFinite, isString, isOptionalOf, isArray } from "common/utils";
|
||||
import { isNodeData, NodeData } from "common/model/node";
|
||||
|
||||
|
||||
export interface Media extends NodeData {
|
||||
dataId?: number;
|
||||
typeId?: number;
|
||||
playlistId?: number;
|
||||
artistId?: number;
|
||||
genderId?: number;
|
||||
artists?: number[];
|
||||
albumId?: number;
|
||||
episode?: number;
|
||||
track?: number;
|
||||
date?: number;
|
||||
time?: number;
|
||||
ageLimit?: string;
|
||||
};
|
||||
|
||||
|
||||
@ -26,15 +25,15 @@ export function isMedia(data: any): data is Media {
|
||||
if (!isOptionalOf(data.typeId, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.playlistId, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.artistId, isNumberFinite)) {
|
||||
if (!isOptionalOf(data.artists, isArray)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.albumId, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.track, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.episode, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
@ -44,8 +43,5 @@ export function isMedia(data: any): data is Media {
|
||||
if (!isOptionalOf(data.time, isNumberFinite)) {
|
||||
return false;
|
||||
}
|
||||
if (!isOptionalOf(data.ageLimit, isString)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -27,16 +27,30 @@
|
||||
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Number:
|
||||
name:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
placeholder="Id of the album"
|
||||
[value]="numberVal"
|
||||
(input)="onNumber($event.target.value)"
|
||||
<input type="text"
|
||||
placeholder="Name of the album"
|
||||
[value]="nameAlbum"
|
||||
(input)="onName($event.target.value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
<i class="material-icons">date_range</i> Date:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="2112"
|
||||
[value]="data.time"
|
||||
(input)="onDate($event.target)"/>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Description:
|
||||
|
@ -26,14 +26,14 @@ export interface ElementList {
|
||||
})
|
||||
|
||||
export class AlbumEditScene implements OnInit {
|
||||
idAlbum:number = -1;
|
||||
idAlbum: number = -1;
|
||||
itemIsRemoved:boolean = false;
|
||||
itemIsNotFound:boolean = false;
|
||||
itemIsLoading:boolean = true;
|
||||
|
||||
error:string = '';
|
||||
|
||||
numberVal: number = null;
|
||||
nameAlbum:string;
|
||||
description: string = '';
|
||||
coverFile: File;
|
||||
uploadFileValue: string = '';
|
||||
@ -83,15 +83,13 @@ export class AlbumEditScene implements OnInit {
|
||||
this.albumService.get(this.idAlbum)
|
||||
.then((response: NodeData) => {
|
||||
console.log(`get response of album : ${ JSON.stringify(response, null, 2)}`);
|
||||
if (isNumberFinite(response.name)) {
|
||||
self.numberVal = response.name;
|
||||
}
|
||||
self.nameAlbum = response.name;
|
||||
self.description = response.description;
|
||||
self.updateCoverList(response.covers);
|
||||
self.itemIsLoading = false;
|
||||
}).catch((response) => {
|
||||
self.error = 'Can not get the data';
|
||||
self.numberVal = null;
|
||||
self.nameAlbum = null;
|
||||
self.description = '';
|
||||
self.coversDisplay = [];
|
||||
self.itemIsNotFound = true;
|
||||
@ -118,8 +116,8 @@ export class AlbumEditScene implements OnInit {
|
||||
this.coversDisplay = [];
|
||||
}
|
||||
}
|
||||
onNumber(value:any):void {
|
||||
this.numberVal = value;
|
||||
onName(value:any):void {
|
||||
this.nameAlbum = value;
|
||||
}
|
||||
|
||||
onDescription(value:any):void {
|
||||
@ -129,7 +127,7 @@ export class AlbumEditScene implements OnInit {
|
||||
sendValues():void {
|
||||
console.log('send new values....');
|
||||
let data = {
|
||||
name: this.numberVal,
|
||||
name: this.nameAlbum,
|
||||
description: this.description
|
||||
};
|
||||
if(this.description === undefined) {
|
||||
|
@ -12,6 +12,12 @@
|
||||
<div class="description" *ngIf="description">
|
||||
{{description}}
|
||||
</div>
|
||||
<button class="button color-button color-shadow-black" (click)="playAll($event)" type="submit">
|
||||
<i class="material-icons">play_arrow</i> Play All
|
||||
</button>
|
||||
<button class="button color-button color-shadow-black" style="margin-left:10px;" (click)="playShuffe($event)" type="submit">
|
||||
<i class="material-icons">shuffle</i> Shuffle
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fill-content colomn_mutiple" *ngIf="albums">
|
||||
|
@ -7,7 +7,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { ArtistService, DataService, ArianeService, AlbumService } from 'app/service';
|
||||
import { ArtistService, DataService, ArianeService, AlbumService, PlayerService, TrackService } from 'app/service';
|
||||
import { NodeData } from 'common/model';
|
||||
import { isNullOrUndefined } from 'common/utils';
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
private albumService: AlbumService,
|
||||
private artistService: ArtistService,
|
||||
private arianeService: ArianeService,
|
||||
private trackService: TrackService,
|
||||
private playerService: PlayerService,
|
||||
private dataService: DataService) {
|
||||
|
||||
}
|
||||
@ -88,6 +90,36 @@
|
||||
this.arianeService.navigateTrack({trackId: idSelected, newWindows:event.which === 2} );
|
||||
}
|
||||
}
|
||||
playAll(event: any):void {
|
||||
this.playerService.clear();
|
||||
let self = this;
|
||||
this.trackService.getData()
|
||||
.then((response: NodeData[]) => {
|
||||
let ids = [];
|
||||
response.forEach(element => {
|
||||
ids.push(element.id);
|
||||
});
|
||||
self.playerService.setNewPlaylist(ids);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(`error to get list o ftrack ...`)
|
||||
});
|
||||
}
|
||||
playShuffe(event: any):void {
|
||||
this.playerService.clear();
|
||||
let self = this;
|
||||
this.trackService.getData()
|
||||
.then((response: NodeData[]) => {
|
||||
let ids = [];
|
||||
response.forEach(element => {
|
||||
ids.push(element.id);
|
||||
});
|
||||
self.playerService.setNewPlaylistShuffle(ids);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(`error to get list o ftrack ...`)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
<div class="description" *ngIf="albumDescription">
|
||||
{{albumDescription}}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<button class="button color-button color-shadow-black" (click)="playAll($event)" type="submit">
|
||||
<i class="material-icons">play_arrow</i> Play All
|
||||
</button>
|
||||
|
@ -1,4 +1,25 @@
|
||||
<div class="generic-page">
|
||||
<div class="fill-title colomn_mutiple">
|
||||
<div class="cover-area">
|
||||
<div class="cover" *ngIf="covers" >
|
||||
<img src="{{covers[0]}}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div [className]="covers ? 'description-area description-area-cover' : 'description-area description-area-no-cover'">
|
||||
<div class="title">
|
||||
{{name}}
|
||||
</div>
|
||||
<div class="description" *ngIf="description">
|
||||
{{description}}
|
||||
</div>
|
||||
<button class="button color-button color-shadow-black" (click)="playAll($event)" type="submit">
|
||||
<i class="material-icons">play_arrow</i> Play All
|
||||
</button>
|
||||
<button class="button color-button color-shadow-black" style="margin-left:10px;" (click)="playShuffe($event)" type="submit">
|
||||
<i class="material-icons">shuffle</i> Shuffle
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fill-content colomn_mutiple" *ngIf="artists">
|
||||
<div class="clear"></div>
|
||||
<div class="title" *ngIf="artists.length > 1">Artists:</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { ArtistService, DataService, ArianeService, AlbumService } from 'app/service';
|
||||
import { ArtistService, DataService, ArianeService, AlbumService, TrackService, PlayerService } from 'app/service';
|
||||
import { NodeData } from 'common/model';
|
||||
import { isNullOrUndefined } from 'common/utils';
|
||||
|
||||
@ -19,6 +19,8 @@ import { isNullOrUndefined } from 'common/utils';
|
||||
export class ArtistsScene implements OnInit {
|
||||
cover: string = '';
|
||||
covers: Array<string> = [];
|
||||
name: string = "Artists";
|
||||
description: string = "All available artists";
|
||||
artists: NodeData[];
|
||||
countTrack: (id: number) => Promise<Number>;
|
||||
countAlbum: (id: number) => Promise<Number>;
|
||||
@ -27,6 +29,8 @@ export class ArtistsScene implements OnInit {
|
||||
private route: ActivatedRoute,
|
||||
private artistService: ArtistService,
|
||||
private albumService: AlbumService,
|
||||
private trackService: TrackService,
|
||||
private playerService: PlayerService,
|
||||
private arianeService: ArianeService) {
|
||||
|
||||
}
|
||||
@ -60,5 +64,35 @@ export class ArtistsScene implements OnInit {
|
||||
countAlbumCallback(artistId: number) : Promise<Number> {
|
||||
return this.artistService.countAlbum(artistId);
|
||||
}
|
||||
playAll(event: any):void {
|
||||
this.playerService.clear();
|
||||
let self = this;
|
||||
this.trackService.getData()
|
||||
.then((response: NodeData[]) => {
|
||||
let ids = [];
|
||||
response.forEach(element => {
|
||||
ids.push(element.id);
|
||||
});
|
||||
self.playerService.setNewPlaylist(ids);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(`error to get list o ftrack ...`)
|
||||
});
|
||||
}
|
||||
playShuffe(event: any):void {
|
||||
this.playerService.clear();
|
||||
let self = this;
|
||||
this.trackService.getData()
|
||||
.then((response: NodeData[]) => {
|
||||
let ids = [];
|
||||
response.forEach(element => {
|
||||
ids.push(element.id);
|
||||
});
|
||||
self.playerService.setNewPlaylistShuffle(ids);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(`error to get list o ftrack ...`)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,44 +52,16 @@
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
<i class="material-icons">date_range</i> Date:
|
||||
Gender:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="2112"
|
||||
[value]="data.time"
|
||||
(input)="onDate($event.target)"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Type:
|
||||
</div>
|
||||
<div class="input">
|
||||
<select [ngModel]="data.typeId"
|
||||
(ngModelChange)="onChangeType($event)">
|
||||
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||
<select [ngModel]="data.genderId"
|
||||
(ngModelChange)="onChangeGender($event)">
|
||||
<option *ngFor="let element of listGender" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input_add">
|
||||
<button class="button color-button-normal color-shadow-black" (click)="newType()" type="submit">
|
||||
<i class="material-icons">add_circle_outline</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Playlist:
|
||||
</div>
|
||||
<div class="input">
|
||||
<select [ngModel]="data.playlistId"
|
||||
(ngModelChange)="onChangePlaylist($event)">
|
||||
<option *ngFor="let element of listPlaylist" [ngValue]="element.value">{{element.label}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input_add">
|
||||
<button class="button color-button-normal color-shadow-black" (click)="newPlaylist()" type="submit">
|
||||
<button class="button color-button-normal color-shadow-black" (click)="newGender()" type="submit">
|
||||
<i class="material-icons">add_circle_outline</i>
|
||||
</button>
|
||||
</div>
|
||||
@ -128,55 +100,21 @@
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="label">
|
||||
Episode:
|
||||
Track n°:
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="number"
|
||||
pattern="[0-9]{0-4}"
|
||||
placeholder="5"
|
||||
[value]="data.episode"
|
||||
(input)="onEpisode($event.target)"/>
|
||||
[value]="data.track"
|
||||
(input)="onTrack($event.target)"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="send_value">
|
||||
<button class="button fill-x color-button-validate color-shadow-black" [disabled]="!needSend" (click)="sendValues()" type="submit"><i class="material-icons">save_alt</i> Save</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<!-- ------------------------- Cover section --------------------------------- -->
|
||||
<div class="title" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
|
||||
Covers
|
||||
</div>
|
||||
<div class="fill-all" *ngIf="!itemIsRemoved && !itemIsNotFound && !itemIsLoading">
|
||||
<div class="hide-element">
|
||||
<input type="file"
|
||||
#fileInput
|
||||
(change)="onChangeCover($event.target)"
|
||||
placeholder="Select a cover file"
|
||||
accept=".png,.jpg,.jpeg,.webp"/>
|
||||
</div>
|
||||
<div class="request_raw">
|
||||
<div class="input">
|
||||
<div class="cover" *ngFor="let element of coversDisplay">
|
||||
<div class="cover-image">
|
||||
<img src="{{element.url}}"/>
|
||||
</div>
|
||||
<div class="cover-button">
|
||||
<button (click)="removeCover(element.id)">
|
||||
<i class="material-icons button-remove">highlight_off</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cover">
|
||||
<div class="cover-no-image">
|
||||
</div>
|
||||
<div class="cover-button">
|
||||
<button (click)="fileInput.click()">
|
||||
<i class="material-icons button-add">add_circle_outline</i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="button fill-x color-button-validate color-shadow-black"
|
||||
[disabled]="!needSend"
|
||||
(click)="sendValues()"
|
||||
type="submit"><i class="material-icons">save_alt</i> Save</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
@ -228,7 +166,8 @@
|
||||
validateTitle="Create"
|
||||
(callback)="eventPopUpAlbum($event[0])">
|
||||
<p>
|
||||
Name: <!-- <input type="text" [(ngModel)]="bodyText" /> -->
|
||||
Name: <input type="text"
|
||||
(input)="onNewAlbumInput($event.target.value)" />
|
||||
</p>
|
||||
</app-popin>
|
||||
|
||||
@ -240,20 +179,22 @@
|
||||
validateTitle="Create"
|
||||
(callback)="eventPopUpArtist($event[0])">
|
||||
<p>
|
||||
Name: <!-- <input type="text" [(ngModel)]="bodyText" /> -->
|
||||
Name: <input type="text"
|
||||
(input)="onNewArtistInput($event.target.value)" />
|
||||
</p>
|
||||
</app-popin>
|
||||
|
||||
|
||||
<app-popin id="popin-new-playlist"
|
||||
<app-popin id="popin-new-gender"
|
||||
popSize="big"
|
||||
popTitle="Create a new playlist"
|
||||
popTitle="Create a new Gender"
|
||||
closeTopRight="true"
|
||||
closeTitle="Cancel"
|
||||
validateTitle="Create"
|
||||
(callback)="eventPopUpPlaylist($event[0])">
|
||||
(callback)="eventPopUpGender($event[0])">
|
||||
<p>
|
||||
Name: <!-- <input type="text" [(ngModel)]="bodyText" /> -->
|
||||
Name: <input type="text"
|
||||
(input)="onNewGenderInput($event.target.value)" />
|
||||
</p>
|
||||
</app-popin>
|
||||
|
||||
|
@ -8,11 +8,12 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
|
||||
import { DataService, GenderService, PlaylistService, ArtistService, TrackService, ArianeService } from 'app/service';
|
||||
import { DataService, GenderService, ArtistService, TrackService, ArianeService, AlbumService } from 'app/service';
|
||||
import { UploadProgress } from 'common/popin/upload-progress/upload-progress';
|
||||
import { NodeData } from 'common/model';
|
||||
import { PopInService } from 'common/service';
|
||||
import { Media } from 'app/model';
|
||||
import { isNullOrUndefined } from 'common/utils';
|
||||
|
||||
export interface ElementList {
|
||||
value?: number;
|
||||
@ -23,27 +24,21 @@ export interface ElementList {
|
||||
class DataToSend {
|
||||
name:string = '';
|
||||
description:string = '';
|
||||
episode?:number;
|
||||
playlistId:number = null;
|
||||
track?:number;
|
||||
artistId:number = null;
|
||||
albumId:number = null;
|
||||
dataId:number = -1;
|
||||
time?:number;
|
||||
typeId:number = null;
|
||||
covers:number[] = [];
|
||||
genderId:number = null;
|
||||
generatedName:string = '';
|
||||
clone() {
|
||||
let tmp = new DataToSend();
|
||||
tmp.name = this.name;
|
||||
tmp.description = this.description;
|
||||
tmp.episode = this.episode;
|
||||
tmp.playlistId = this.playlistId;
|
||||
tmp.track = this.track;
|
||||
tmp.artistId = this.artistId;
|
||||
tmp.albumId = this.albumId;
|
||||
tmp.dataId = this.dataId;
|
||||
tmp.time = this.time;
|
||||
tmp.typeId = this.typeId;
|
||||
tmp.covers = this.covers;
|
||||
tmp.genderId = this.genderId;
|
||||
tmp.generatedName = this.generatedName;
|
||||
return tmp;
|
||||
}
|
||||
@ -51,8 +46,7 @@ class DataToSend {
|
||||
|
||||
@Component({
|
||||
selector: 'app-track-edit',
|
||||
templateUrl: './track-edit.html',
|
||||
styleUrls: [ './track-edit.less' ]
|
||||
templateUrl: './track-edit.html'
|
||||
})
|
||||
|
||||
export class TrackEditScene implements OnInit {
|
||||
@ -65,9 +59,6 @@ export class TrackEditScene implements OnInit {
|
||||
|
||||
data:DataToSend = new DataToSend();
|
||||
dataOri:DataToSend = new DataToSend();
|
||||
coverFile:File;
|
||||
uploadFileValue:string = '';
|
||||
selectedFiles:FileList;
|
||||
needSend:boolean = false;
|
||||
|
||||
|
||||
@ -78,11 +69,14 @@ export class TrackEditScene implements OnInit {
|
||||
public confirmDeleteImageUrl:string = null;
|
||||
private deleteCoverId:number = null;
|
||||
private deleteMediaId:number = null;
|
||||
|
||||
// to create new album/artist/gender:
|
||||
private albumInputNew: string;
|
||||
private artistInputNew: string;
|
||||
private genderInputNew: string;
|
||||
|
||||
|
||||
deleteConfirmed() {
|
||||
if(this.deleteCoverId !== null) {
|
||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
if(this.deleteMediaId !== null) {
|
||||
this.removeItemAfterConfirm(this.deleteMediaId);
|
||||
this.cleanConfirm();
|
||||
@ -95,15 +89,9 @@ export class TrackEditScene implements OnInit {
|
||||
this.deleteMediaId = null;
|
||||
}
|
||||
|
||||
coversDisplay:Array<any> = [];
|
||||
|
||||
listType: ElementList[] = [
|
||||
listGender: ElementList[] = [
|
||||
{ value: undefined, label: '---' },
|
||||
];
|
||||
listPlaylist: ElementList[] = [
|
||||
{ value: undefined, label: '---' },
|
||||
{ value: null, label: '---' },
|
||||
];
|
||||
listArtist: ElementList[] = [
|
||||
{ value: undefined, label: '---' },
|
||||
];
|
||||
@ -112,8 +100,8 @@ export class TrackEditScene implements OnInit {
|
||||
];
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private typeService: GenderService,
|
||||
private playlistService: PlaylistService,
|
||||
private genderService: GenderService,
|
||||
private albumService: AlbumService,
|
||||
private artistService: ArtistService,
|
||||
private trackService: TrackService,
|
||||
private arianeService: ArianeService,
|
||||
@ -130,16 +118,10 @@ export class TrackEditScene implements OnInit {
|
||||
if(this.data.description !== this.dataOri.description) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.episode !== this.dataOri.episode) {
|
||||
if(this.data.track !== this.dataOri.track) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.time !== this.dataOri.time) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.typeId !== this.dataOri.typeId) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.playlistId !== this.dataOri.playlistId) {
|
||||
if(this.data.genderId !== this.dataOri.genderId) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.artistId !== this.dataOri.artistId) {
|
||||
@ -151,47 +133,23 @@ export class TrackEditScene implements OnInit {
|
||||
return this.needSend;
|
||||
}
|
||||
|
||||
updateCoverList(covers: any) {
|
||||
this.coversDisplay = [];
|
||||
this.data.covers = [];
|
||||
if(covers !== undefined && covers !== null) {
|
||||
for(let iii = 0; iii < covers.length; iii++) {
|
||||
this.data.covers.push(covers[iii]);
|
||||
this.coversDisplay.push({
|
||||
id:covers[iii],
|
||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.coversDisplay = [];
|
||||
}
|
||||
}
|
||||
ngOnInit() {
|
||||
this.arianeService.updateManual(this.route.snapshot.paramMap);
|
||||
this.idTrack = this.arianeService.getTrackId();
|
||||
let self = this;
|
||||
this.listType = [ { value: null, label: '---' } ];
|
||||
this.listPlaylist = [ { value: null, label: '---' } ];
|
||||
this.listGender = [ { value: null, label: '---' } ];
|
||||
this.listArtist = [ { value: null, label: '---' } ];
|
||||
this.listAlbum = [ { value: null, label: '---' } ];
|
||||
this.playlistService.getData()
|
||||
this.genderService.getOrder()
|
||||
.then((response2) => {
|
||||
for(let iii = 0; iii < response2.length; iii++) {
|
||||
self.listPlaylist.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
}
|
||||
}).catch((response2) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
||||
});
|
||||
this.typeService.getData()
|
||||
.then((response2) => {
|
||||
for(let iii = 0; iii < response2.length; iii++) {
|
||||
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
self.listGender.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
}
|
||||
}).catch((response2) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
||||
});
|
||||
// this.artistService.getOrder()
|
||||
this.artistService.getData()
|
||||
this.artistService.getOrder()
|
||||
.then((response3) => {
|
||||
for(let iii = 0; iii < response3.length; iii++) {
|
||||
self.listArtist.push({ value: response3[iii].id, label: response3[iii].name });
|
||||
@ -200,34 +158,37 @@ export class TrackEditScene implements OnInit {
|
||||
}).catch((response3) => {
|
||||
console.log(`get response3 : ${ JSON.stringify(response3, null, 2)}`);
|
||||
});
|
||||
this.albumService.getOrder()
|
||||
.then((response3) => {
|
||||
for(let iii = 0; iii < response3.length; iii++) {
|
||||
self.listAlbum.push({ value: response3[iii].id, label: response3[iii].name });
|
||||
console.log(`[${ self.data.dataId }] Get artist: ${ response3[iii].id }, label:${ response3[iii].name}`);
|
||||
}
|
||||
}).catch((response3) => {
|
||||
console.log(`get response3 : ${ JSON.stringify(response3, null, 2)}`);
|
||||
});
|
||||
this.trackService.get(this.idTrack)
|
||||
.then((response: Media) => {
|
||||
console.log(`get response of track : ${ JSON.stringify(response, null, 2)}`);
|
||||
self.data.name = response.name;
|
||||
self.data.description = response.description;
|
||||
self.data.episode = response.episode;
|
||||
self.data.playlistId = response.playlistId;
|
||||
if(self.data.playlistId === undefined) {
|
||||
self.data.playlistId = null;
|
||||
}
|
||||
self.data.track = response.track;
|
||||
self.data.dataId = response.dataId;
|
||||
self.data.time = response.time;
|
||||
self.data.generatedName = "????????? TODO ????????? "; // response.generatedName;
|
||||
self.onChangeType(response.typeId);
|
||||
self.onChangeArtist(response.artistId);
|
||||
self.onChangeGender(response.genderId);
|
||||
if (response?.artists.length != 0) {
|
||||
self.onChangeArtist(response.artists[0]);
|
||||
}
|
||||
self.data.albumId = response.albumId;
|
||||
if(self.data.albumId === undefined) {
|
||||
self.data.albumId = null;
|
||||
}
|
||||
self.dataOri = self.data.clone();
|
||||
self.updateCoverList(response.covers);
|
||||
self.updateNeedSend();
|
||||
console.log(`coversList : ${ JSON.stringify(self.coversDisplay, null, 2)}`);
|
||||
self.itemIsLoading = false;
|
||||
}).catch((response) => {
|
||||
self.error = 'Can not get the data';
|
||||
self.data = new DataToSend();
|
||||
self.coversDisplay = [];
|
||||
self.dataOri = self.data.clone();
|
||||
self.updateNeedSend();
|
||||
self.itemIsNotFound = true;
|
||||
@ -235,32 +196,12 @@ export class TrackEditScene implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onChangeType(value:any):void {
|
||||
console.log(`Change requested of type ... ${value}`);
|
||||
this.data.typeId = value;
|
||||
if(this.data.typeId === undefined) {
|
||||
this.data.typeId = null;
|
||||
onChangeGender(value:any):void {
|
||||
console.log(`Change requested of gender ... ${value}`);
|
||||
this.data.genderId = value;
|
||||
if(this.data.genderId === undefined) {
|
||||
this.data.genderId = null;
|
||||
}
|
||||
this.data.artistId = null;
|
||||
this.data.albumId = null;
|
||||
this.listArtist = [ { value: undefined, label: '---' } ];
|
||||
this.listAlbum = [ { value: undefined, label: '---' } ];
|
||||
let self = this;
|
||||
this.updateNeedSend();
|
||||
if(this.data.typeId !== undefined) {
|
||||
self.typeService.getSubArtist(this.data.typeId)
|
||||
.then((response2: NodeData[]) => {
|
||||
for(let iii = 0; iii < response2.length; iii++) {
|
||||
self.listArtist.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
}
|
||||
}).catch((response2) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onChangePlaylist(value:any):void {
|
||||
this.data.playlistId = value;
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
@ -269,23 +210,13 @@ export class TrackEditScene implements OnInit {
|
||||
if(this.data.artistId === undefined) {
|
||||
this.data.artistId = null;
|
||||
}
|
||||
this.data.albumId = null;
|
||||
this.listAlbum = [ { value: undefined, label: '---' } ];
|
||||
let self = this;
|
||||
if(this.data.artistId !== undefined) {
|
||||
self.artistService.getAlbum(this.data.artistId)
|
||||
.then((response3: NodeData[]) => {
|
||||
for(let iii = 0; iii < response3.length; iii++) {
|
||||
self.listAlbum.push({ value: response3[iii].id, label: `album ${ response3[iii].name}` });
|
||||
}
|
||||
}).catch((response3) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response3, null, 2)}`);
|
||||
});
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
onChangeAlbum(value:any):void {
|
||||
this.data.albumId = value;
|
||||
if(this.data.albumId === undefined) {
|
||||
this.data.albumId = null;
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
@ -302,23 +233,12 @@ export class TrackEditScene implements OnInit {
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
onDate(value:any):void {
|
||||
if(value.value.length > 4) {
|
||||
value.value = this.data.time;
|
||||
} else {
|
||||
this.data.time = value.value;
|
||||
}
|
||||
if(this.data.time < 10) {
|
||||
this.data.time = null;
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onEpisode(value:any):void {
|
||||
onTrack(value:any):void {
|
||||
if(value.value.length > 4) {
|
||||
value.value = this.data.episode;
|
||||
value.value = this.data.track;
|
||||
} else {
|
||||
this.data.episode = parseInt(value.value, 10);
|
||||
this.data.track = parseInt(value.value, 10);
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
@ -336,31 +256,21 @@ export class TrackEditScene implements OnInit {
|
||||
data.description = this.data.description;
|
||||
}
|
||||
}
|
||||
if(this.data.episode !== this.dataOri.episode) {
|
||||
data.episode = this.data.episode;
|
||||
if(this.data.track !== this.dataOri.track) {
|
||||
data.track = this.data.track;
|
||||
}
|
||||
if(this.data.time !== this.dataOri.time) {
|
||||
data.time = this.data.time;
|
||||
}
|
||||
if(this.data.typeId !== this.dataOri.typeId) {
|
||||
if(this.data.typeId === undefined) {
|
||||
data.typeId = null;
|
||||
if(this.data.genderId !== this.dataOri.genderId) {
|
||||
if(this.data.genderId === undefined) {
|
||||
data.genderId = null;
|
||||
} else {
|
||||
data.typeId = this.data.typeId;
|
||||
}
|
||||
}
|
||||
if(this.data.playlistId !== this.dataOri.playlistId) {
|
||||
if(this.data.playlistId === undefined) {
|
||||
data.playlistId = null;
|
||||
} else {
|
||||
data.playlistId = this.data.playlistId;
|
||||
data.genderId = this.data.genderId;
|
||||
}
|
||||
}
|
||||
if(this.data.artistId !== this.dataOri.artistId) {
|
||||
if(this.data.artistId === undefined) {
|
||||
data.artistId = null;
|
||||
data.artists = null;
|
||||
} else {
|
||||
data.artistId = this.data.artistId;
|
||||
data.artists = [ this.data.artistId ];
|
||||
}
|
||||
}
|
||||
if(this.data.albumId !== this.dataOri.albumId) {
|
||||
@ -381,80 +291,6 @@ export class TrackEditScene implements OnInit {
|
||||
self.updateNeedSend();
|
||||
});
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
// (drop)="onDropFile($event)"
|
||||
onDropFile(event: DragEvent) {
|
||||
event.preventDefault();
|
||||
// this.uploadFile(event.dataTransfer.files[0]);
|
||||
console.log('error in drag & drop ...');
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
// (dragover)="onDragOverFile($event)"
|
||||
onDragOverFile(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// At the file input element
|
||||
// (change)="selectFile($event)"
|
||||
onChangeCover(value:any):void {
|
||||
this.selectedFiles = value.files;
|
||||
this.coverFile = this.selectedFiles[0];
|
||||
console.log(`select file ${ this.coverFile.name}`);
|
||||
this.uploadCover(this.coverFile);
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
uploadCover(file?:File) {
|
||||
if(file === undefined) {
|
||||
console.log('No file selected!');
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
// clean upload labels*
|
||||
this.upload.clear();
|
||||
// display the upload pop-in
|
||||
this.popInService.open('popin-upload-progress');
|
||||
this.trackService.uploadCover(file, this.idTrack, (count, total) => {
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then((response:any) => {
|
||||
console.log(`get response of cover : ${ JSON.stringify(response, null, 2)}`);
|
||||
self.upload.result = 'Cover added done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not add the cover in the track...');
|
||||
self.upload.error = `Error in the upload of the cover...${ JSON.stringify(response, null, 2)}`;
|
||||
});
|
||||
}
|
||||
|
||||
removeCover(id:number) {
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
||||
this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
|
||||
this.deleteCoverId = id;
|
||||
this.popInService.open('popin-delete-confirm');
|
||||
}
|
||||
removeCoverAfterConfirm(id:number) {
|
||||
console.log(`Request remove cover: ${ id}`);
|
||||
let self = this;
|
||||
this.trackService.deleteCover(this.idTrack, id)
|
||||
.then((response:any) => {
|
||||
console.log(`get response of remove cover : ${ JSON.stringify(response, null, 2)}`);
|
||||
self.upload.result = 'Cover remove done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not remove the cover of the track...');
|
||||
self.upload.error = `Error in the upload of the cover...${ JSON.stringify(response, null, 2)}`;
|
||||
});
|
||||
}
|
||||
removeItem() {
|
||||
console.log('Request remove Media...');
|
||||
this.cleanConfirm();
|
||||
@ -477,18 +313,29 @@ export class TrackEditScene implements OnInit {
|
||||
eventPopUpAlbum(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
this.popInService.close('popin-new-album');
|
||||
if (event === "validate" && !isNullOrUndefined(this.albumInputNew)) {
|
||||
this.albumService.insert({
|
||||
name:this.albumInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
eventPopUpArtist(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
this.popInService.close('popin-new-artist');
|
||||
if (event === "validate" && !isNullOrUndefined(this.artistInputNew)) {
|
||||
this.artistService.insert({
|
||||
name:this.artistInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
eventPopUpType(event: string): void {
|
||||
eventPopUpGender(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
this.popInService.close('popin-new-type');
|
||||
}
|
||||
eventPopUpPlaylist(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
this.popInService.close('popin-new-playlist');
|
||||
this.popInService.close('popin-new-gender');
|
||||
if (event === "validate" && !isNullOrUndefined(this.genderInputNew)) {
|
||||
this.genderService.insert({
|
||||
name:this.genderInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
newAlbum(): void {
|
||||
@ -499,13 +346,22 @@ export class TrackEditScene implements OnInit {
|
||||
console.log('Request new Artist...');
|
||||
this.popInService.open('popin-new-artist');
|
||||
}
|
||||
newType(): void {
|
||||
console.log('Request new Type...');
|
||||
this.popInService.open('popin-create-type');
|
||||
newGender(): void {
|
||||
console.log('Request new Gender...');
|
||||
this.popInService.open('popin-new-gender');
|
||||
}
|
||||
newPlaylist() {
|
||||
console.log('Request new Playlist...');
|
||||
this.popInService.open('popin-new-playlist');
|
||||
|
||||
onNewGenderInput(value) {
|
||||
console.log(`Request new Gender...${value}`);
|
||||
this.genderInputNew = value;
|
||||
}
|
||||
onNewArtistInput(value) {
|
||||
console.log(`Request new Gender...${value}`);
|
||||
this.artistInputNew = value;
|
||||
}
|
||||
onNewAlbumInput(value) {
|
||||
console.log(`Request new Gender...${value}`);
|
||||
this.albumInputNew = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ export class TrackScene implements OnInit {
|
||||
name:string = '';
|
||||
description:string = '';
|
||||
episode:number = undefined;
|
||||
artistId:number = undefined;
|
||||
artists:number[] = undefined;
|
||||
artistName:string = undefined;
|
||||
albumId:number = undefined;
|
||||
albumName:string = undefined;
|
||||
@ -210,7 +210,7 @@ export class TrackScene implements OnInit {
|
||||
self.name = response.name;
|
||||
self.description = response.description;
|
||||
self.episode = response.episode;
|
||||
self.artistId = response.artistId;
|
||||
self.artists = response.artists;
|
||||
self.albumId = response.albumId;
|
||||
self.dataId = response.dataId;
|
||||
self.time = response.time;
|
||||
@ -226,8 +226,8 @@ export class TrackScene implements OnInit {
|
||||
self.covers = self.dataService.getCoverListUrl(response.covers);
|
||||
|
||||
self.generateName();
|
||||
if(self.artistId !== undefined && self.artistId !== null) {
|
||||
self.artistService.get(self.artistId)
|
||||
if(!isNullOrUndefined(self.artists) && self.artists.length !== 0) {
|
||||
self.artistService.get(self.artists[0])
|
||||
.then((response2) => {
|
||||
self.artistName = response2.name;
|
||||
self.generateName();
|
||||
@ -235,7 +235,7 @@ export class TrackScene implements OnInit {
|
||||
// nothing to do ...
|
||||
});
|
||||
}
|
||||
if(self.albumId !== undefined && self.albumId !== null) {
|
||||
if(!isNullOrUndefined(self.albumId)) {
|
||||
self.albumService.get(self.albumId)
|
||||
.then((response4) => {
|
||||
self.albumName = response4.name;
|
||||
@ -279,7 +279,7 @@ export class TrackScene implements OnInit {
|
||||
self.name = '';
|
||||
self.description = '';
|
||||
self.episode = undefined;
|
||||
self.artistId = undefined;
|
||||
self.artists = undefined;
|
||||
self.albumId = undefined;
|
||||
self.dataId = -1;
|
||||
self.time = undefined;
|
||||
|
@ -11,6 +11,7 @@ export class GenericInterfaceModelDB {
|
||||
// nothing to do ...
|
||||
}
|
||||
|
||||
|
||||
gets(): Promise<NodeData[]> {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -122,6 +123,11 @@ export class GenericInterfaceModelDB {
|
||||
});
|
||||
}
|
||||
|
||||
insert(data: any): any {
|
||||
let ret = this.http.postSpecific([this.serviceName], data);
|
||||
return this.bdd.addAfterPost(this.serviceName, ret);
|
||||
|
||||
}
|
||||
put(id:number, data:any):any {
|
||||
let ret = this.http.putSpecific([this.serviceName, id], data);
|
||||
return this.bdd.setAfterPut(this.serviceName, id, ret);
|
||||
|
@ -19,6 +19,7 @@ export interface MessageLogIn {
|
||||
|
||||
@Injectable()
|
||||
export class GenderService extends GenericInterfaceModelDB {
|
||||
|
||||
|
||||
constructor(http: HttpWrapperService,
|
||||
bdd: BddService) {
|
||||
|
@ -21,6 +21,24 @@ export class BddService {
|
||||
console.log('Start BddService');
|
||||
}
|
||||
|
||||
addAfterPost(name: string, ret: any) {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.get(name)
|
||||
.then((response:DataInterface) => {
|
||||
let responseTmp = response;
|
||||
ret.then((response2) => {
|
||||
responseTmp.add(response2);
|
||||
resolve(response2);
|
||||
}).catch((response2) => {
|
||||
reject(response2);
|
||||
});
|
||||
}).catch((response) => {
|
||||
reject(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
setAfterPut(name: string, id: number, ret: any) {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -124,6 +124,10 @@ export class DataInterface {
|
||||
}
|
||||
}
|
||||
}
|
||||
public add(value: NodeData): void {
|
||||
console.log(`[I] Set ${ this.name }`);
|
||||
this.bdd.push(value);
|
||||
}
|
||||
|
||||
public delete(id: number): void {
|
||||
console.log(`[I] delete ${ this.name } ${ id}`);
|
||||
|
Loading…
Reference in New Issue
Block a user