[DEV] update to the new model system
This commit is contained in:
parent
511c6d0bc7
commit
516a0bbfa0
@ -6,8 +6,8 @@
|
||||
<properties>
|
||||
|
||||
<maven.compiler.version>3.1</maven.compiler.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<maven.dependency.version>3.1.1</maven.dependency.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
|
@ -6,9 +6,9 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
public class WebLauncherLocal extends WebLauncher {
|
||||
final Logger logger = LoggerFactory.getLogger(WebLauncherLocal.class);
|
||||
|
||||
|
||||
private WebLauncherLocal() {}
|
||||
|
||||
|
||||
public static void main(final String[] args) throws InterruptedException {
|
||||
final WebLauncherLocal launcher = new WebLauncherLocal();
|
||||
launcher.process();
|
||||
@ -16,14 +16,14 @@ public class WebLauncherLocal extends WebLauncher {
|
||||
Thread.currentThread().join();
|
||||
launcher.logger.info("STOP the REST server:");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process() throws InterruptedException {
|
||||
if (true) {
|
||||
// for local test:
|
||||
ConfigBaseVariable.apiAdress = "http://0.0.0.0:19080/karusic/api/";
|
||||
//ConfigBaseVariable.ssoAdress = "https://atria-soft.org/karso/api/";
|
||||
ConfigBaseVariable.dbPort = "3307";
|
||||
ConfigBaseVariable.dbPort = "3906";
|
||||
}
|
||||
try {
|
||||
super.migrateDB();
|
||||
|
@ -14,8 +14,8 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PATCH;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
@ -25,28 +25,28 @@ import jakarta.ws.rs.core.Response;
|
||||
@Path("/album")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class AlbumResource {
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Album getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Album.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Album> get() throws Exception {
|
||||
return DataAccess.gets(Album.class);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Album post(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Album.class, jsonRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@PATCH
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ -54,7 +54,7 @@ public class AlbumResource {
|
||||
DataAccess.updateWithJson(Album.class, id, jsonRequest);
|
||||
return DataAccess.get(Album.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -62,7 +62,7 @@ public class AlbumResource {
|
||||
DataAccess.delete(Album.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class AlbumResource {
|
||||
AddOnManyToMany.removeLink(Album.class, id, "track", trackId);
|
||||
return DataAccess.get(Album.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -79,7 +79,7 @@ public class AlbumResource {
|
||||
AddOnManyToMany.removeLink(Album.class, id, "track", trackId);
|
||||
return DataAccess.get(Album.class, id);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -88,7 +88,7 @@ public class AlbumResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Album.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
|
@ -14,8 +14,8 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PATCH;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
@ -25,28 +25,28 @@ import jakarta.ws.rs.core.Response;
|
||||
@Path("/artist")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class ArtistResource {
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Artist getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Artist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Artist> get() throws Exception {
|
||||
return DataAccess.gets(Artist.class);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Artist put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Artist.class, jsonRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@PATCH
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ -54,7 +54,7 @@ public class ArtistResource {
|
||||
DataAccess.updateWithJson(Artist.class, id, jsonRequest);
|
||||
return DataAccess.get(Artist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -62,7 +62,7 @@ public class ArtistResource {
|
||||
DataAccess.delete(Artist.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class ArtistResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Artist.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
|
@ -14,8 +14,8 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PATCH;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
@ -25,28 +25,28 @@ import jakarta.ws.rs.core.Response;
|
||||
@Path("/gender")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class GenderResource {
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Gender getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Gender.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Gender> get() throws Exception {
|
||||
return DataAccess.gets(Gender.class);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Gender put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Gender.class, jsonRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@PATCH
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ -54,7 +54,7 @@ public class GenderResource {
|
||||
DataAccess.updateWithJson(Gender.class, id, jsonRequest);
|
||||
return DataAccess.get(Gender.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -62,7 +62,7 @@ public class GenderResource {
|
||||
DataAccess.delete(Gender.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class GenderResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Gender.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
|
@ -14,8 +14,8 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PATCH;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
@ -25,28 +25,28 @@ import jakarta.ws.rs.core.Response;
|
||||
@Path("/playlist")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class PlaylistResource {
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Playlist getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Playlist> get() throws Exception {
|
||||
return DataAccess.gets(Playlist.class);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Playlist put(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Playlist.class, jsonRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@PATCH
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ -54,7 +54,7 @@ public class PlaylistResource {
|
||||
DataAccess.updateWithJson(Playlist.class, id, jsonRequest);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -62,7 +62,7 @@ public class PlaylistResource {
|
||||
DataAccess.delete(Playlist.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class PlaylistResource {
|
||||
AddOnManyToMany.removeLink(Playlist.class, id, "track", trackId);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_track/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -79,7 +79,7 @@ public class PlaylistResource {
|
||||
AddOnManyToMany.removeLink(Playlist.class, id, "track", trackId);
|
||||
return DataAccess.get(Playlist.class, id);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -88,7 +88,7 @@ public class PlaylistResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Playlist.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
|
@ -23,8 +23,8 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
import jakarta.ws.rs.Consumes;
|
||||
import jakarta.ws.rs.DELETE;
|
||||
import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.PATCH;
|
||||
import jakarta.ws.rs.POST;
|
||||
import jakarta.ws.rs.PUT;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.PathParam;
|
||||
import jakarta.ws.rs.Produces;
|
||||
@ -34,28 +34,28 @@ import jakarta.ws.rs.core.Response;
|
||||
@Path("/track")
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public class TrackResource {
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@RolesAllowed("USER")
|
||||
public static Track getWithId(@PathParam("id") final Long id) throws Exception {
|
||||
return DataAccess.get(Track.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@RolesAllowed("USER")
|
||||
public List<Track> get() throws Exception {
|
||||
return DataAccess.gets(Track.class);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public Track create(final String jsonRequest) throws Exception {
|
||||
return DataAccess.insertWithJson(Track.class, jsonRequest);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@PATCH
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@ -63,7 +63,7 @@ public class TrackResource {
|
||||
DataAccess.updateWithJson(Track.class, id, jsonRequest);
|
||||
return DataAccess.get(Track.class, id);
|
||||
}
|
||||
|
||||
|
||||
@DELETE
|
||||
@Path("{id}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -71,7 +71,7 @@ public class TrackResource {
|
||||
DataAccess.delete(Track.class, id);
|
||||
return Response.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_artist/{artistId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -80,7 +80,7 @@ public class TrackResource {
|
||||
AddOnManyToMany.removeLink(Track.class, id, "artist", artistId);
|
||||
return DataAccess.get(Track.class, id);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_artist/{trackId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -88,7 +88,7 @@ public class TrackResource {
|
||||
AddOnManyToMany.removeLink(Track.class, id, "artist", artistId);
|
||||
return DataAccess.get(Track.class, id);
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("{id}/add_cover")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -97,7 +97,7 @@ public class TrackResource {
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Track.class, id, fileName, fileInputStream, fileMetaData);
|
||||
}
|
||||
|
||||
|
||||
@GET
|
||||
@Path("{id}/rm_cover/{coverId}")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -105,7 +105,7 @@ public class TrackResource {
|
||||
AddOnManyToMany.removeLink(Track.class, id, "cover", coverId);
|
||||
return Response.ok(DataAccess.get(Track.class, id)).build();
|
||||
}
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/upload/")
|
||||
@RolesAllowed("ADMIN")
|
||||
@ -122,7 +122,7 @@ public class TrackResource {
|
||||
album = DataTools.multipartCorrection(album);
|
||||
trackId = DataTools.multipartCorrection(trackId);
|
||||
title = DataTools.multipartCorrection(title);
|
||||
|
||||
|
||||
//public NodeSmall uploadFile(final FormDataMultiPart form) {
|
||||
System.out.println("Upload media file: " + fileMetaData);
|
||||
System.out.println(" - fileName: " + fileName);
|
||||
@ -142,7 +142,7 @@ public class TrackResource {
|
||||
build();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
final long tmpUID = DataTools.getTmpDataId();
|
||||
final String sha512 = DataTools.saveTemporaryFile(fileInputStream, tmpUID);
|
||||
Data data = DataTools.getWithSha512(sha512);
|
||||
@ -186,7 +186,7 @@ public class TrackResource {
|
||||
// return Response.notModified("TypeId does not exist ...").build();
|
||||
// }
|
||||
System.out.println(" ==> " + genderElem);
|
||||
|
||||
|
||||
Artist artistElem = null;
|
||||
if (artist != null) {
|
||||
artistElem = DataAccess.getWhere(Artist.class, new Condition(new QueryCondition("name", "=", artist)));
|
||||
@ -197,7 +197,7 @@ public class TrackResource {
|
||||
}
|
||||
}
|
||||
System.out.println(" ==> " + artistElem);
|
||||
|
||||
|
||||
Album albumElem = null;
|
||||
if (album != null) {
|
||||
albumElem = DataAccess.getWhere(Album.class, new Condition(new QueryCondition("name", "=", album)));
|
||||
@ -208,9 +208,9 @@ public class TrackResource {
|
||||
}
|
||||
}
|
||||
System.out.println(" ==> " + album);
|
||||
|
||||
|
||||
System.out.println("add media");
|
||||
|
||||
|
||||
Track trackElem = new Track();
|
||||
trackElem.name = title;
|
||||
trackElem.track = trackId != null ? Long.parseLong(trackId) : null;
|
||||
@ -236,5 +236,5 @@ public class TrackResource {
|
||||
return Response.status(417).entity("Back-end error : " + ex.getMessage()).type("text/plain").build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { AlbumService , ArianeService, DataService} from 'app/service';
|
||||
import { AlbumService, ArianeService, DataService } from 'app/service';
|
||||
import { NodeData } from 'common/model';
|
||||
|
||||
import { UploadProgress } from 'common/popin/upload-progress/upload-progress';
|
||||
@ -20,18 +20,18 @@ export interface ElementList {
|
||||
@Component({
|
||||
selector: 'app-album-edit',
|
||||
templateUrl: './album-edit.html',
|
||||
styleUrls: [ './album-edit.less' ]
|
||||
styleUrls: ['./album-edit.less']
|
||||
})
|
||||
|
||||
export class AlbumEditScene implements OnInit {
|
||||
idAlbum: number = -1;
|
||||
itemIsRemoved:boolean = false;
|
||||
itemIsNotFound:boolean = false;
|
||||
itemIsLoading:boolean = true;
|
||||
itemIsRemoved: boolean = false;
|
||||
itemIsNotFound: boolean = false;
|
||||
itemIsLoading: boolean = true;
|
||||
|
||||
error:string = '';
|
||||
error: string = '';
|
||||
|
||||
nameAlbum:string;
|
||||
nameAlbum: string;
|
||||
description: string = '';
|
||||
coverFile: File;
|
||||
uploadFileValue: string = '';
|
||||
@ -48,11 +48,11 @@ export class AlbumEditScene implements OnInit {
|
||||
private deleteCoverId: number = null;
|
||||
private deleteItemId: number = null;
|
||||
deleteConfirmed() {
|
||||
if(this.deleteCoverId !== null) {
|
||||
if (this.deleteCoverId !== null) {
|
||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
if(this.deleteItemId !== null) {
|
||||
if (this.deleteItemId !== null) {
|
||||
this.removeItemAfterConfirm(this.deleteItemId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
@ -66,9 +66,9 @@ export class AlbumEditScene implements OnInit {
|
||||
|
||||
|
||||
constructor(
|
||||
private albumService: AlbumService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService,
|
||||
private albumService: AlbumService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService,
|
||||
private dataService: DataService) {
|
||||
|
||||
}
|
||||
@ -78,7 +78,7 @@ export class AlbumEditScene implements OnInit {
|
||||
let self = this;
|
||||
this.albumService.get(this.idAlbum)
|
||||
.then((response: NodeData) => {
|
||||
console.log(`get response of album : ${ JSON.stringify(response, null, 2)}`);
|
||||
console.log(`get response of album : ${JSON.stringify(response, null, 2)}`);
|
||||
self.nameAlbum = response.name;
|
||||
self.description = response.description;
|
||||
self.updateCoverList(response.covers);
|
||||
@ -92,44 +92,44 @@ export class AlbumEditScene implements OnInit {
|
||||
self.itemIsLoading = false;
|
||||
});
|
||||
this.albumService.getTrack(this.idAlbum)
|
||||
.then((response:any) => {
|
||||
.then((response: any) => {
|
||||
self.trackCount = response.length;
|
||||
}).catch((response:any) => {
|
||||
}).catch((response: any) => {
|
||||
self.trackCount = '---';
|
||||
});
|
||||
}
|
||||
|
||||
updateCoverList(covers: any) {
|
||||
this.coversDisplay = [];
|
||||
if(covers !== undefined && covers !== null) {
|
||||
for(let iii = 0; iii < covers.length; iii++) {
|
||||
if (covers !== undefined && covers !== null) {
|
||||
for (let iii = 0; iii < covers.length; iii++) {
|
||||
this.coversDisplay.push({
|
||||
id:covers[iii],
|
||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||
id: covers[iii],
|
||||
url: this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.coversDisplay = [];
|
||||
}
|
||||
}
|
||||
onName(value:any):void {
|
||||
onName(value: any): void {
|
||||
this.nameAlbum = value;
|
||||
}
|
||||
|
||||
onDescription(value:any):void {
|
||||
onDescription(value: any): void {
|
||||
this.description = value;
|
||||
}
|
||||
|
||||
sendValues():void {
|
||||
sendValues(): void {
|
||||
console.log('send new values....');
|
||||
let data = {
|
||||
name: this.nameAlbum,
|
||||
description: this.description
|
||||
};
|
||||
if(this.description === undefined) {
|
||||
if (this.description === undefined) {
|
||||
data.description = null;
|
||||
}
|
||||
this.albumService.put(this.idAlbum, data);
|
||||
this.albumService.patch(this.idAlbum, data);
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
@ -148,15 +148,15 @@ export class AlbumEditScene implements OnInit {
|
||||
|
||||
// At the file input element
|
||||
// (change)="selectFile($event)"
|
||||
onChangeCover(value:any):void {
|
||||
onChangeCover(value: any): void {
|
||||
this.selectedFiles = value.files;
|
||||
this.coverFile = this.selectedFiles[0];
|
||||
console.log(`select file ${ this.coverFile.name}`);
|
||||
console.log(`select file ${this.coverFile.name}`);
|
||||
this.uploadCover(this.coverFile);
|
||||
}
|
||||
|
||||
uploadCover(file:File) {
|
||||
if(file === undefined) {
|
||||
uploadCover(file: File) {
|
||||
if (file === undefined) {
|
||||
console.log('No file selected!');
|
||||
return;
|
||||
}
|
||||
@ -166,35 +166,35 @@ export class AlbumEditScene implements OnInit {
|
||||
// display the upload pop-in
|
||||
this.popInService.open('popin-upload-progress');
|
||||
this.albumService.uploadCover(file, this.idAlbum, (count, total) => {
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then((response:any) => {
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then((response: any) => {
|
||||
self.upload.result = 'Cover added done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
}).catch((response: any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not add the cover in the track...');
|
||||
});
|
||||
}
|
||||
|
||||
removeCover(id:number) {
|
||||
removeCover(id: number) {
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
||||
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}`);
|
||||
removeCoverAfterConfirm(id: number) {
|
||||
console.log(`Request remove cover: ${id}`);
|
||||
let self = this;
|
||||
this.albumService.deleteCover(this.idAlbum, id)
|
||||
.then((response:any) => {
|
||||
.then((response: any) => {
|
||||
self.upload.result = 'Cover remove done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
}).catch((response: any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not remove the cover of the track...');
|
||||
});
|
||||
@ -203,11 +203,11 @@ export class AlbumEditScene implements OnInit {
|
||||
removeItem() {
|
||||
console.log('Request remove Media...');
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the Album: ${ this.idAlbum}`;
|
||||
this.confirmDeleteComment = `Delete the Album: ${this.idAlbum}`;
|
||||
this.deleteItemId = this.idAlbum;
|
||||
this.popInService.open('popin-delete-confirm');
|
||||
}
|
||||
removeItemAfterConfirm(id:number) {
|
||||
removeItemAfterConfirm(id: number) {
|
||||
let self = this;
|
||||
this.albumService.delete(id)
|
||||
.then((response3) => {
|
||||
|
@ -20,30 +20,30 @@ export class ElementList {
|
||||
@Component({
|
||||
selector: 'app-artist-edit',
|
||||
templateUrl: './artist-edit.html',
|
||||
styleUrls: [ './artist-edit.less' ]
|
||||
styleUrls: ['./artist-edit.less']
|
||||
})
|
||||
|
||||
export class ArtistEditScene implements OnInit {
|
||||
idArtist:number = -1;
|
||||
itemIsRemoved:boolean = false;
|
||||
itemIsNotFound:boolean = false;
|
||||
itemIsLoading:boolean = true;
|
||||
idArtist: number = -1;
|
||||
itemIsRemoved: boolean = false;
|
||||
itemIsNotFound: boolean = false;
|
||||
itemIsLoading: boolean = true;
|
||||
|
||||
error:string = '';
|
||||
error: string = '';
|
||||
|
||||
typeId:number = null;
|
||||
name:string = '';
|
||||
description:string = '';
|
||||
coverFile:File;
|
||||
uploadFileValue:string = '';
|
||||
selectedFiles:FileList;
|
||||
typeId: number = null;
|
||||
name: string = '';
|
||||
description: string = '';
|
||||
coverFile: File;
|
||||
uploadFileValue: string = '';
|
||||
selectedFiles: FileList;
|
||||
|
||||
albumsCount: string = null;
|
||||
trackCount: string = null;
|
||||
|
||||
coversDisplay:Array<any> = [];
|
||||
coversDisplay: Array<any> = [];
|
||||
// section tha define the upload value to display in the pop-in of upload
|
||||
public upload:UploadProgress = new UploadProgress();
|
||||
public upload: UploadProgress = new UploadProgress();
|
||||
|
||||
|
||||
listType: ElementList[] = [
|
||||
@ -51,16 +51,16 @@ export class ArtistEditScene implements OnInit {
|
||||
];
|
||||
|
||||
// --------------- confirm section ------------------
|
||||
public confirmDeleteComment:string = null;
|
||||
public confirmDeleteImageUrl:string = null;
|
||||
private deleteCoverId:number = null;
|
||||
private deleteItemId:number = null;
|
||||
public confirmDeleteComment: string = null;
|
||||
public confirmDeleteImageUrl: string = null;
|
||||
private deleteCoverId: number = null;
|
||||
private deleteItemId: number = null;
|
||||
deleteConfirmed() {
|
||||
if(this.deleteCoverId !== null) {
|
||||
if (this.deleteCoverId !== null) {
|
||||
this.removeCoverAfterConfirm(this.deleteCoverId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
if(this.deleteItemId !== null) {
|
||||
if (this.deleteItemId !== null) {
|
||||
this.removeItemAfterConfirm(this.deleteItemId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
@ -74,25 +74,25 @@ export class ArtistEditScene implements OnInit {
|
||||
|
||||
|
||||
constructor(private dataService: DataService,
|
||||
private typeService: GenderService,
|
||||
private artistService: ArtistService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService) {
|
||||
private typeService: GenderService,
|
||||
private artistService: ArtistService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.idArtist = this.arianeService.getArtistId();
|
||||
let self = this;
|
||||
this.listType = [ { value: null, label: '---' } ];
|
||||
this.listType = [{ value: null, label: '---' }];
|
||||
|
||||
this.typeService.getData()
|
||||
.then((response2) => {
|
||||
for(let iii = 0; iii < response2.length; iii++) {
|
||||
for (let iii = 0; iii < response2.length; iii++) {
|
||||
self.listType.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
}
|
||||
}).catch((response2) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
||||
console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`);
|
||||
});
|
||||
|
||||
this.artistService.get(this.idArtist)
|
||||
@ -112,7 +112,7 @@ export class ArtistEditScene implements OnInit {
|
||||
self.itemIsNotFound = true;
|
||||
self.itemIsLoading = false;
|
||||
});
|
||||
console.log(`get parameter id: ${ this.idArtist}`);
|
||||
console.log(`get parameter id: ${this.idArtist}`);
|
||||
this.artistService.getAlbum(this.idArtist)
|
||||
.then((response) => {
|
||||
self.albumsCount = "" + response.length;
|
||||
@ -129,11 +129,11 @@ export class ArtistEditScene implements OnInit {
|
||||
|
||||
updateCoverList(covers: any) {
|
||||
this.coversDisplay = [];
|
||||
if(covers !== undefined && covers !== null) {
|
||||
for(let iii = 0; iii < covers.length; iii++) {
|
||||
if (covers !== undefined && covers !== null) {
|
||||
for (let iii = 0; iii < covers.length; iii++) {
|
||||
this.coversDisplay.push({
|
||||
id:covers[iii],
|
||||
url:this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||
id: covers[iii],
|
||||
url: this.dataService.getCoverThumbnailUrl(covers[iii])
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@ -141,33 +141,33 @@ export class ArtistEditScene implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
onName(value:any):void {
|
||||
onName(value: any): void {
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
onDescription(value:any):void {
|
||||
onDescription(value: any): void {
|
||||
this.description = value;
|
||||
}
|
||||
|
||||
onChangeType(value:any):void {
|
||||
console.log(`Change requested of type ... ${ value}`);
|
||||
onChangeType(value: any): void {
|
||||
console.log(`Change requested of type ... ${value}`);
|
||||
this.typeId = value;
|
||||
if(this.typeId === undefined) {
|
||||
if (this.typeId === undefined) {
|
||||
this.typeId = null;
|
||||
}
|
||||
}
|
||||
|
||||
sendValues():void {
|
||||
sendValues(): void {
|
||||
console.log('send new values....');
|
||||
let data = {
|
||||
parentId: this.typeId,
|
||||
name: this.name,
|
||||
description: this.description
|
||||
};
|
||||
if(this.description === undefined) {
|
||||
if (this.description === undefined) {
|
||||
data.description = null;
|
||||
}
|
||||
this.artistService.put(this.idArtist, data);
|
||||
this.artistService.patch(this.idArtist, data);
|
||||
}
|
||||
|
||||
// At the drag drop area
|
||||
@ -186,15 +186,15 @@ export class ArtistEditScene implements OnInit {
|
||||
|
||||
// At the file input element
|
||||
// (change)="selectFile($event)"
|
||||
onChangeCover(value:any):void {
|
||||
onChangeCover(value: any): void {
|
||||
this.selectedFiles = value.files;
|
||||
this.coverFile = this.selectedFiles[0];
|
||||
console.log(`select file ${ this.coverFile.name}`);
|
||||
console.log(`select file ${this.coverFile.name}`);
|
||||
this.uploadCover(this.coverFile);
|
||||
}
|
||||
|
||||
uploadCover(file:File) {
|
||||
if(file === undefined) {
|
||||
uploadCover(file: File) {
|
||||
if (file === undefined) {
|
||||
console.log('No file selected!');
|
||||
return;
|
||||
}
|
||||
@ -204,34 +204,34 @@ export class ArtistEditScene implements OnInit {
|
||||
// display the upload pop-in
|
||||
this.popInService.open('popin-upload-progress');
|
||||
this.artistService.uploadCover(file, this.idArtist, (count, total) => {
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then((response:any) => {
|
||||
self.upload.mediaSendSize = count;
|
||||
self.upload.mediaSize = total;
|
||||
})
|
||||
.then((response: any) => {
|
||||
self.upload.result = 'Cover added done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
}).catch((response: any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not add the cover in the track...');
|
||||
});
|
||||
}
|
||||
removeCover(id:number) {
|
||||
removeCover(id: number) {
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
|
||||
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}`);
|
||||
removeCoverAfterConfirm(id: number) {
|
||||
console.log(`Request remove cover: ${id}`);
|
||||
let self = this;
|
||||
this.artistService.deleteCover(this.idArtist, id)
|
||||
.then((response:any) => {
|
||||
.then((response: any) => {
|
||||
self.upload.result = 'Cover remove done';
|
||||
// we retrive the whiole media ==> update data ...
|
||||
self.updateCoverList(response.covers);
|
||||
}).catch((response:any) => {
|
||||
}).catch((response: any) => {
|
||||
// self.error = "Can not get the data";
|
||||
console.log('Can not remove the cover of the track...');
|
||||
});
|
||||
@ -239,11 +239,11 @@ export class ArtistEditScene implements OnInit {
|
||||
removeItem() {
|
||||
console.log('Request remove Media...');
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the Artist: ${ this.idArtist}`;
|
||||
this.confirmDeleteComment = `Delete the Artist: ${this.idArtist}`;
|
||||
this.deleteItemId = this.idArtist;
|
||||
this.popInService.open('popin-delete-confirm');
|
||||
}
|
||||
removeItemAfterConfirm(_id:number) {
|
||||
removeItemAfterConfirm(_id: number) {
|
||||
let self = this;
|
||||
this.artistService.delete(_id)
|
||||
.then((response3) => {
|
||||
|
@ -20,14 +20,14 @@ export interface ElementList {
|
||||
|
||||
|
||||
class DataToSend {
|
||||
name:string = '';
|
||||
description:string = '';
|
||||
track?:number;
|
||||
artistId:number = null;
|
||||
albumId:number = null;
|
||||
dataId:number = -1;
|
||||
genderId:number = null;
|
||||
generatedName:string = '';
|
||||
name: string = '';
|
||||
description: string = '';
|
||||
track?: number;
|
||||
artistId: number = null;
|
||||
albumId: number = null;
|
||||
dataId: number = -1;
|
||||
genderId: number = null;
|
||||
generatedName: string = '';
|
||||
clone() {
|
||||
let tmp = new DataToSend();
|
||||
tmp.name = this.name;
|
||||
@ -48,25 +48,25 @@ class DataToSend {
|
||||
})
|
||||
|
||||
export class TrackEditScene implements OnInit {
|
||||
idTrack:number = -1;
|
||||
itemIsRemoved:boolean = false;
|
||||
itemIsNotFound:boolean = false;
|
||||
itemIsLoading:boolean = true;
|
||||
idTrack: number = -1;
|
||||
itemIsRemoved: boolean = false;
|
||||
itemIsNotFound: boolean = false;
|
||||
itemIsLoading: boolean = true;
|
||||
|
||||
error:string = '';
|
||||
error: string = '';
|
||||
|
||||
data:DataToSend = new DataToSend();
|
||||
dataOri:DataToSend = new DataToSend();
|
||||
needSend:boolean = false;
|
||||
data: DataToSend = new DataToSend();
|
||||
dataOri: DataToSend = new DataToSend();
|
||||
needSend: boolean = false;
|
||||
|
||||
|
||||
// section tha define the upload value to display in the pop-in of upload
|
||||
upload:UploadProgress = new UploadProgress();
|
||||
upload: UploadProgress = new UploadProgress();
|
||||
// --------------- confirm section ------------------
|
||||
public confirmDeleteComment:string = null;
|
||||
public confirmDeleteImageUrl:string = null;
|
||||
private deleteCoverId:number = null;
|
||||
private deleteMediaId:number = null;
|
||||
public confirmDeleteComment: string = null;
|
||||
public confirmDeleteImageUrl: string = null;
|
||||
private deleteCoverId: number = null;
|
||||
private deleteMediaId: number = null;
|
||||
|
||||
// to create new album/artist/gender:
|
||||
private albumInputNew: string;
|
||||
@ -75,7 +75,7 @@ export class TrackEditScene implements OnInit {
|
||||
|
||||
|
||||
deleteConfirmed() {
|
||||
if(this.deleteMediaId !== null) {
|
||||
if (this.deleteMediaId !== null) {
|
||||
this.removeItemAfterConfirm(this.deleteMediaId);
|
||||
this.cleanConfirm();
|
||||
}
|
||||
@ -97,34 +97,34 @@ export class TrackEditScene implements OnInit {
|
||||
{ value: undefined, label: '---' },
|
||||
];
|
||||
constructor(
|
||||
private genderService: GenderService,
|
||||
private albumService: AlbumService,
|
||||
private artistService: ArtistService,
|
||||
private trackService: TrackService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService,
|
||||
private dataService: DataService) {
|
||||
private genderService: GenderService,
|
||||
private albumService: AlbumService,
|
||||
private artistService: ArtistService,
|
||||
private trackService: TrackService,
|
||||
private arianeService: ArianeService,
|
||||
private popInService: PopInService,
|
||||
private dataService: DataService) {
|
||||
|
||||
}
|
||||
|
||||
updateNeedSend(): boolean {
|
||||
this.needSend = false;
|
||||
if(this.data.name !== this.dataOri.name) {
|
||||
if (this.data.name !== this.dataOri.name) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.description !== this.dataOri.description) {
|
||||
if (this.data.description !== this.dataOri.description) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.track !== this.dataOri.track) {
|
||||
if (this.data.track !== this.dataOri.track) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.genderId !== this.dataOri.genderId) {
|
||||
if (this.data.genderId !== this.dataOri.genderId) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.artistId !== this.dataOri.artistId) {
|
||||
if (this.data.artistId !== this.dataOri.artistId) {
|
||||
this.needSend = true;
|
||||
}
|
||||
if(this.data.albumId !== this.dataOri.albumId) {
|
||||
if (this.data.albumId !== this.dataOri.albumId) {
|
||||
this.needSend = true;
|
||||
}
|
||||
return this.needSend;
|
||||
@ -133,39 +133,39 @@ export class TrackEditScene implements OnInit {
|
||||
ngOnInit() {
|
||||
this.idTrack = this.arianeService.getTrackId();
|
||||
let self = this;
|
||||
this.listGender = [ { value: null, label: '---' } ];
|
||||
this.listArtist = [ { value: null, label: '---' } ];
|
||||
this.listAlbum = [ { value: null, label: '---' } ];
|
||||
this.listGender = [{ value: null, label: '---' }];
|
||||
this.listArtist = [{ value: null, label: '---' }];
|
||||
this.listAlbum = [{ value: null, label: '---' }];
|
||||
this.genderService.getOrder()
|
||||
.then((response2) => {
|
||||
for(let iii = 0; iii < response2.length; iii++) {
|
||||
for (let iii = 0; iii < response2.length; iii++) {
|
||||
self.listGender.push({ value: response2[iii].id, label: response2[iii].name });
|
||||
}
|
||||
}).catch((response2) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response2, null, 2)}`);
|
||||
console.log(`get response22 : ${JSON.stringify(response2, null, 2)}`);
|
||||
});
|
||||
// this.artistService.getOrder()
|
||||
this.artistService.getOrder()
|
||||
.then((response3) => {
|
||||
for(let iii = 0; iii < response3.length; iii++) {
|
||||
for (let iii = 0; iii < response3.length; iii++) {
|
||||
self.listArtist.push({ value: response3[iii].id, label: response3[iii].name });
|
||||
console.log(`[${ self.data.dataId }] Get artist: ${ 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)}`);
|
||||
console.log(`get response3 : ${JSON.stringify(response3, null, 2)}`);
|
||||
});
|
||||
this.albumService.getOrder()
|
||||
.then((response3) => {
|
||||
for(let iii = 0; iii < response3.length; iii++) {
|
||||
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}`);
|
||||
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)}`);
|
||||
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)}`);
|
||||
console.log(`get response of track : ${JSON.stringify(response, null, 2)}`);
|
||||
self.data.name = response.name;
|
||||
self.data.description = response.description;
|
||||
self.data.track = response.track;
|
||||
@ -176,7 +176,7 @@ export class TrackEditScene implements OnInit {
|
||||
self.onChangeArtist(response.artists[0]);
|
||||
}
|
||||
self.data.albumId = response.albumId;
|
||||
if(self.data.albumId === undefined) {
|
||||
if (self.data.albumId === undefined) {
|
||||
self.data.albumId = null;
|
||||
}
|
||||
self.dataOri = self.data.clone();
|
||||
@ -192,37 +192,37 @@ export class TrackEditScene implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
onChangeGender(value:any):void {
|
||||
onChangeGender(value: any): void {
|
||||
console.log(`Change requested of gender ... ${value}`);
|
||||
this.data.genderId = value;
|
||||
if(this.data.genderId === undefined) {
|
||||
if (this.data.genderId === undefined) {
|
||||
this.data.genderId = null;
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onChangeArtist(value:any):void {
|
||||
onChangeArtist(value: any): void {
|
||||
this.data.artistId = value;
|
||||
if(this.data.artistId === undefined) {
|
||||
if (this.data.artistId === undefined) {
|
||||
this.data.artistId = null;
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
onChangeAlbum(value:any):void {
|
||||
onChangeAlbum(value: any): void {
|
||||
this.data.albumId = value;
|
||||
if(this.data.albumId === undefined) {
|
||||
if (this.data.albumId === undefined) {
|
||||
this.data.albumId = null;
|
||||
}
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onName(value:any):void {
|
||||
onName(value: any): void {
|
||||
this.data.name = value;
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onDescription(value:any):void {
|
||||
if(value.length === 0) {
|
||||
onDescription(value: any): void {
|
||||
if (value.length === 0) {
|
||||
this.data.description = null;
|
||||
} else {
|
||||
this.data.description = value;
|
||||
@ -230,8 +230,8 @@ export class TrackEditScene implements OnInit {
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
onTrack(value:any):void {
|
||||
if(value.value.length > 4) {
|
||||
onTrack(value: any): void {
|
||||
if (value.value.length > 4) {
|
||||
value.value = this.data.track;
|
||||
} else {
|
||||
this.data.track = parseInt(value.value, 10);
|
||||
@ -239,38 +239,38 @@ export class TrackEditScene implements OnInit {
|
||||
this.updateNeedSend();
|
||||
}
|
||||
|
||||
sendValues():void {
|
||||
sendValues(): void {
|
||||
console.log('send new values....');
|
||||
let data:any = {};
|
||||
if(this.data.name !== this.dataOri.name) {
|
||||
let data: any = {};
|
||||
if (this.data.name !== this.dataOri.name) {
|
||||
data.name = this.data.name;
|
||||
}
|
||||
if(this.data.description !== this.dataOri.description) {
|
||||
if(this.data.description === undefined) {
|
||||
if (this.data.description !== this.dataOri.description) {
|
||||
if (this.data.description === undefined) {
|
||||
data.description = null;
|
||||
} else {
|
||||
data.description = this.data.description;
|
||||
}
|
||||
}
|
||||
if(this.data.track !== this.dataOri.track) {
|
||||
if (this.data.track !== this.dataOri.track) {
|
||||
data.track = this.data.track;
|
||||
}
|
||||
if(this.data.genderId !== this.dataOri.genderId) {
|
||||
if(this.data.genderId === undefined) {
|
||||
if (this.data.genderId !== this.dataOri.genderId) {
|
||||
if (this.data.genderId === undefined) {
|
||||
data.genderId = null;
|
||||
} else {
|
||||
data.genderId = this.data.genderId;
|
||||
}
|
||||
}
|
||||
if(this.data.artistId !== this.dataOri.artistId) {
|
||||
if(this.data.artistId === undefined) {
|
||||
if (this.data.artistId !== this.dataOri.artistId) {
|
||||
if (this.data.artistId === undefined) {
|
||||
data.artists = null;
|
||||
} else {
|
||||
data.artists = [ this.data.artistId ];
|
||||
data.artists = [this.data.artistId];
|
||||
}
|
||||
}
|
||||
if(this.data.albumId !== this.dataOri.albumId) {
|
||||
if(this.data.albumId === undefined) {
|
||||
if (this.data.albumId !== this.dataOri.albumId) {
|
||||
if (this.data.albumId === undefined) {
|
||||
data.albumId = null;
|
||||
} else {
|
||||
data.albumId = this.data.albumId;
|
||||
@ -278,23 +278,23 @@ export class TrackEditScene implements OnInit {
|
||||
}
|
||||
let tmpp = this.data.clone();
|
||||
let self = this;
|
||||
this.trackService.put(this.idTrack, data)
|
||||
this.trackService.patch(this.idTrack, data)
|
||||
.then((response3) => {
|
||||
self.dataOri = tmpp;
|
||||
self.updateNeedSend();
|
||||
}).catch((response3) => {
|
||||
console.log(`get response22 : ${ JSON.stringify(response3, null, 2)}`);
|
||||
console.log(`get response22 : ${JSON.stringify(response3, null, 2)}`);
|
||||
self.updateNeedSend();
|
||||
});
|
||||
}
|
||||
removeItem() {
|
||||
console.log('Request remove Media...');
|
||||
this.cleanConfirm();
|
||||
this.confirmDeleteComment = `Delete the Media: ${ this.idTrack}`;
|
||||
this.confirmDeleteComment = `Delete the Media: ${this.idTrack}`;
|
||||
this.deleteMediaId = this.idTrack;
|
||||
this.popInService.open('popin-delete-confirm');
|
||||
}
|
||||
removeItemAfterConfirm(id:number) {
|
||||
removeItemAfterConfirm(id: number) {
|
||||
let self = this;
|
||||
this.trackService.delete(id)
|
||||
.then((response3) => {
|
||||
@ -307,30 +307,30 @@ export class TrackEditScene implements OnInit {
|
||||
}
|
||||
|
||||
eventPopUpAlbum(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
console.log(`GET event: ${event}`);
|
||||
this.popInService.close('popin-new-album');
|
||||
if (event === "validate" && !isNullOrUndefined(this.albumInputNew)) {
|
||||
this.albumService.insert({
|
||||
name:this.albumInputNew,
|
||||
});
|
||||
name: this.albumInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
eventPopUpArtist(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
console.log(`GET event: ${event}`);
|
||||
this.popInService.close('popin-new-artist');
|
||||
if (event === "validate" && !isNullOrUndefined(this.artistInputNew)) {
|
||||
this.artistService.insert({
|
||||
name:this.artistInputNew,
|
||||
});
|
||||
name: this.artistInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
eventPopUpGender(event: string): void {
|
||||
console.log(`GET event: ${ event}`);
|
||||
console.log(`GET event: ${event}`);
|
||||
this.popInService.close('popin-new-gender');
|
||||
if (event === "validate" && !isNullOrUndefined(this.genderInputNew)) {
|
||||
this.genderService.insert({
|
||||
name:this.genderInputNew,
|
||||
});
|
||||
name: this.genderInputNew,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { DataInterface, isArrayOf, isNullOrUndefined, TypeCheck } from "common/u
|
||||
|
||||
export class GenericInterfaceModelDB {
|
||||
constructor(
|
||||
protected serviceName:string,
|
||||
protected serviceName: string,
|
||||
protected http: HttpWrapperService,
|
||||
protected bdd: BddService) {
|
||||
// nothing to do ...
|
||||
@ -18,7 +18,7 @@ export class GenericInterfaceModelDB {
|
||||
self.bdd.get(self.serviceName)
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.gets();
|
||||
if(isNullOrUndefined(data)) {
|
||||
if (isNullOrUndefined(data)) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
return;
|
||||
}
|
||||
@ -30,13 +30,13 @@ export class GenericInterfaceModelDB {
|
||||
});
|
||||
}
|
||||
|
||||
getLike(nameArtist:string):any {
|
||||
getLike(nameArtist: string): any {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.get(self.serviceName)
|
||||
.then((response:DataInterface) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.getNameLike(nameArtist);
|
||||
if(data === null || data === undefined || data.length === 0) {
|
||||
if (data === null || data === undefined || data.length === 0) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
return;
|
||||
}
|
||||
@ -58,26 +58,26 @@ export class GenericInterfaceModelDB {
|
||||
key: 'id',
|
||||
value: [undefined, null],
|
||||
},
|
||||
],
|
||||
[ 'name', 'id' ]);
|
||||
],
|
||||
['name', 'id']);
|
||||
//data = response.gets();
|
||||
if (isArrayOf(data, isNodeData)) {
|
||||
resolve(data);
|
||||
}
|
||||
reject("The model is wrong ...");
|
||||
}).catch((response) => {
|
||||
console.log(`[E] ${ self.constructor.name }: can not retrive BDD values`);
|
||||
console.log(`[E] ${self.constructor.name}: can not retrive BDD values`);
|
||||
reject(response);
|
||||
});
|
||||
});
|
||||
}
|
||||
get(id:number): Promise<NodeData> {
|
||||
get(id: number): Promise<NodeData> {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.get(self.serviceName)
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.get(id);
|
||||
if(isNullOrUndefined(data)) {
|
||||
if (isNullOrUndefined(data)) {
|
||||
reject('Data does not exist in the local BDD');
|
||||
return;
|
||||
}
|
||||
@ -94,13 +94,13 @@ export class GenericInterfaceModelDB {
|
||||
self.bdd.get(self.serviceName)
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.getsWhere([
|
||||
{
|
||||
check: TypeCheck.EQUAL,
|
||||
key: 'id',
|
||||
value: ids,
|
||||
},
|
||||
],
|
||||
[ 'name', 'id' ]);
|
||||
{
|
||||
check: TypeCheck.EQUAL,
|
||||
key: 'id',
|
||||
value: ids,
|
||||
},
|
||||
],
|
||||
['name', 'id']);
|
||||
resolve(data);
|
||||
return;
|
||||
}).catch((response) => {
|
||||
@ -113,11 +113,11 @@ export class GenericInterfaceModelDB {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.bdd.get(self.serviceName)
|
||||
.then((response:DataInterface) => {
|
||||
.then((response: DataInterface) => {
|
||||
let data = response.gets();
|
||||
resolve(data);
|
||||
}).catch((response) => {
|
||||
console.log(`[E] ${ self.constructor.name }: can not retrive BDD values`);
|
||||
console.log(`[E] ${self.constructor.name}: can not retrive BDD values`);
|
||||
reject(response);
|
||||
});
|
||||
});
|
||||
@ -126,25 +126,25 @@ 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);
|
||||
patch(id: number, data: any): any {
|
||||
let ret = this.http.patchSpecific([this.serviceName, id], data);
|
||||
return this.bdd.setAfterPut(this.serviceName, id, ret);
|
||||
}
|
||||
|
||||
delete(id:number):any {
|
||||
delete(id: number): any {
|
||||
let ret = this.http.deleteSpecific([this.serviceName, id]);
|
||||
return this.bdd.delete(this.serviceName, id, ret);
|
||||
}
|
||||
|
||||
deleteCover(nodeId:number, coverId:number) {
|
||||
deleteCover(nodeId: number, coverId: number) {
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.http.getSpecific([this.serviceName, nodeId, 'rm_cover', coverId])
|
||||
.then((response) => {
|
||||
let data = response;
|
||||
if(data === null || data === undefined) {
|
||||
if (data === null || data === undefined) {
|
||||
reject('error retrive data from server');
|
||||
return;
|
||||
}
|
||||
@ -155,19 +155,19 @@ export class GenericInterfaceModelDB {
|
||||
});
|
||||
});
|
||||
}
|
||||
uploadCover(file:File,
|
||||
nodeId:number,
|
||||
progress:any = null) {
|
||||
const formData = new FormData();
|
||||
formData.append('fileName', file.name);
|
||||
uploadCover(file: File,
|
||||
nodeId: number,
|
||||
progress: any = null) {
|
||||
const formData = new FormData();
|
||||
formData.append('fileName', file.name);
|
||||
formData.append('id', nodeId.toString());
|
||||
formData.append('file', file);
|
||||
let self = this;
|
||||
formData.append('file', file);
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.http.uploadMultipart(`${this.serviceName }/${nodeId}/add_cover/`, formData, progress)
|
||||
self.http.uploadMultipart(`${this.serviceName}/${nodeId}/add_cover/`, formData, progress)
|
||||
.then((response) => {
|
||||
let data = response;
|
||||
if(data === null || data === undefined) {
|
||||
if (data === null || data === undefined) {
|
||||
reject('error retrive data from server');
|
||||
return;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ea5a4f6b7537eb707916f4610bf79fbe86c6296f
|
||||
Subproject commit c3489422f2df7f16465b4358e868664af9cda81c
|
Loading…
Reference in New Issue
Block a user