[DEV] add progress callback
This commit is contained in:
parent
df384cc8be
commit
d5f335e1e7
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.annotation.AsyncType;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnManyToMany;
|
||||
@ -99,6 +100,7 @@ public class AlbumResource {
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@Operation(description = "Add a cover on a specific album")
|
||||
@AsyncType(Album.class)
|
||||
@TypeScriptProgress
|
||||
public Response uploadCover(@PathParam("id") final Long id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Album.class, id, fileName, fileInputStream, fileMetaData);
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.annotation.AsyncType;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
@ -72,6 +73,7 @@ public class ArtistResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@AsyncType(Artist.class)
|
||||
@TypeScriptProgress
|
||||
public Response uploadCover(@PathParam("id") final Long id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Artist.class, id, fileName, fileInputStream, fileMetaData);
|
||||
|
@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.annotation.AsyncType;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
import org.kar.archidata.tools.DataTools;
|
||||
@ -72,6 +73,7 @@ public class GenderResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@AsyncType(Gender.class)
|
||||
@TypeScriptProgress
|
||||
public Response uploadCover(@PathParam("id") final Long id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Gender.class, id, fileName, fileInputStream, fileMetaData);
|
||||
|
@ -10,6 +10,7 @@ import java.util.UUID;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.kar.archidata.annotation.AsyncType;
|
||||
import org.kar.archidata.annotation.TypeScriptProgress;
|
||||
import org.kar.archidata.dataAccess.DataAccess;
|
||||
import org.kar.archidata.dataAccess.QueryCondition;
|
||||
import org.kar.archidata.dataAccess.addOn.AddOnDataJson;
|
||||
@ -99,6 +100,7 @@ public class TrackResource {
|
||||
@RolesAllowed("ADMIN")
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
@AsyncType(Track.class)
|
||||
@TypeScriptProgress
|
||||
public Response uploadCover(@PathParam("id") final Long id, @FormDataParam("fileName") final String fileName, @FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
return DataTools.uploadCover(Track.class, id, fileName, fileInputStream, fileMetaData);
|
||||
@ -118,16 +120,18 @@ public class TrackResource {
|
||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||
// Formatter:off
|
||||
@AsyncType(Track.class)
|
||||
@TypeScriptProgress
|
||||
public Response uploadTrack(
|
||||
@FormDataParam("fileName") String fileName,
|
||||
@FormDataParam("gender") String gender,
|
||||
@FormDataParam("artist") String artist,
|
||||
@FormDataParam("fileName") String fileName, //
|
||||
@FormDataParam("gender") String gender, //
|
||||
@FormDataParam("artist") String artist, //
|
||||
//@FormDataParam("seriesId") String seriesId, Not used ...
|
||||
@FormDataParam("album") String album,
|
||||
@AsyncType(Long.class) @FormDataParam("trackId") String trackId,
|
||||
@FormDataParam("title") String title,
|
||||
@FormDataParam("file") final InputStream fileInputStream,
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||
@FormDataParam("album") String album, //
|
||||
@AsyncType(Long.class) @FormDataParam("trackId") String trackId, //
|
||||
@FormDataParam("title") String title, //
|
||||
@FormDataParam("file") final InputStream fileInputStream, //
|
||||
@FormDataParam("file") final FormDataContentDisposition fileMetaData //
|
||||
) {
|
||||
// Formatter:on
|
||||
try {
|
||||
// correct input string stream :
|
||||
|
@ -14,8 +14,7 @@
|
||||
"update_packages": "ncu --upgrade",
|
||||
"install_dependency": "pnpm install --force",
|
||||
"link_kar_cw": "pnpm link ../../kar-cw/dist/kar-cw/",
|
||||
"unlink_kar_cw": "pnpm unlink ../../kar-cw/dist/kar-cw/",
|
||||
"publish": "pnpm publish --no-git-checks"
|
||||
"unlink_kar_cw": "pnpm unlink ../../kar-cw/dist/kar-cw/"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
@ -546,10 +546,12 @@ export class TrackScene implements OnInit {
|
||||
// convert it and send it to the server
|
||||
let self = this;
|
||||
|
||||
console.log("not implemented right now...");
|
||||
/*
|
||||
this.videoCanva.toBlob((blob) => {
|
||||
self.trackService.uploadCoverBlob(blob, this.idTrack);
|
||||
}, 'image/jpeg', 0.95);
|
||||
|
||||
*/
|
||||
/*
|
||||
let tmpUrl = this.videoCanva.toDataURL('image/jpeg', 0.95);
|
||||
fetch(tmpUrl)
|
||||
|
@ -5,9 +5,9 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SessionService, isNullOrUndefined, isString } from '@kangaroo-and-rabbit/kar-cw';
|
||||
import { SessionService, isArrayOf, isNullOrUndefined, isString } from '@kangaroo-and-rabbit/kar-cw';
|
||||
|
||||
import { RESTConfig, RESTUrl, isArrayOf } from 'app/back-api/rest-tools';
|
||||
import { RESTConfig, RESTUrl } from 'app/back-api/rest-tools';
|
||||
import { environment } from 'environments/environment';
|
||||
|
||||
@Injectable()
|
||||
|
@ -423,32 +423,5 @@ export class TrackService extends GenericDataService<Track> {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
uploadCoverBlob(blob: Blob,
|
||||
TrackId: number,
|
||||
progress: any = null) {
|
||||
/*
|
||||
const formData = new FormData();
|
||||
formData.append('fileName', 'take_screenshoot');
|
||||
formData.append('typeId', TrackId.toString());
|
||||
formData.append('file', blob);
|
||||
let self = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
self.http.uploadMultipart(`${this.serviceName}/${TrackId}/add_cover/`, formData, progress)
|
||||
.then((response) => {
|
||||
let data = response;
|
||||
if (data === null || data === undefined) {
|
||||
reject('error retrieve data from server');
|
||||
return;
|
||||
}
|
||||
self.bdd.asyncSetInDB(self.serviceName, TrackId, data);
|
||||
resolve(data);
|
||||
}).catch((response) => {
|
||||
reject(response);
|
||||
});
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user