[DEV] big upgrade...

This commit is contained in:
Edouard DUPIN 2022-06-06 23:52:44 +02:00
parent a50e9535e0
commit ff5e479dcb
30 changed files with 144 additions and 215 deletions

View File

@ -392,26 +392,40 @@ public class DataResource {
// || value.mimeType.contentEquals("image/webp") // || value.mimeType.contentEquals("image/webp")
) { ) {
// reads input image // reads input image
System.out.println("Read path: " + filePathName);
File inputFile = new File(filePathName); File inputFile = new File(filePathName);
System.out.println(" ==> file exist: "+ inputFile.exists());
if (!inputFile.exists()) {
return Response.status(500).
entity("Internal Error: Media is NOT FOUNDABLE: " + id).
type("text/plain").
build();
}
BufferedImage inputImage = ImageIO.read(inputFile); BufferedImage inputImage = ImageIO.read(inputFile);
System.out.println(" ==> in buffer ready");
int scaledWidth = 250; int scaledWidth = 250;
int scaledHeight = (int)((float)inputImage.getHeight() / (float)inputImage.getWidth() * (float) scaledWidth); int scaledHeight = (int)((float)inputImage.getHeight() / (float)inputImage.getWidth() * (float) scaledWidth);
// creates output image // creates output image
BufferedImage outputImage = new BufferedImage(scaledWidth, BufferedImage outputImage = new BufferedImage(scaledWidth,
scaledHeight, inputImage.getType()); scaledHeight, inputImage.getType());
System.out.println(" ==> out buffer ready");
// scales the input image to the output image // scales the input image to the output image
Graphics2D g2d = outputImage.createGraphics(); Graphics2D g2d = outputImage.createGraphics();
g2d.drawImage(inputImage, 0, 0, scaledWidth, scaledHeight, null); g2d.drawImage(inputImage, 0, 0, scaledWidth, scaledHeight, null);
g2d.dispose(); g2d.dispose();
System.out.println(" ==> configure Resize Done");
// create the oputput stream: // create the oputput stream:
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(outputImage, "JPG", baos); ImageIO.write(outputImage, "JPG", baos);
System.out.println(" ==> resize done");
byte[] imageData = baos.toByteArray(); byte[] imageData = baos.toByteArray();
System.out.println(" ==> generate response");
Response.ok(new ByteArrayInputStream(imageData)).build(); Response.ok(new ByteArrayInputStream(imageData)).build();
Response.ResponseBuilder out = Response.ok(imageData) Response.ResponseBuilder out = Response.ok(imageData)
.header(HttpHeaders.CONTENT_LENGTH, imageData.length); .header(HttpHeaders.CONTENT_LENGTH, imageData.length);
out.type("image/jpeg"); out.type("image/jpeg");
System.out.println(" ==> SSSSSSSSSSSSend");
return out.build(); return out.build();
} }
return buildStream(filePathName, range, value.mimeType); return buildStream(filePathName, range, value.mimeType);

View File

@ -3,7 +3,7 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { ModelResponseHttp } from '../../service/http-wrapper'; import { ModelResponseHttp } from '../../service/http-wrapper';
import { DataService } from '../../service/data'; import { DataService } from '../../service/data';
@ -12,7 +12,6 @@ import { DataService } from '../../service/data';
templateUrl: './data-image.html', templateUrl: './data-image.html',
styleUrls: [ './data-image.less' ] styleUrls: [ './data-image.less' ]
}) })
@Injectable()
export class ElementDataImageComponent implements OnInit { export class ElementDataImageComponent implements OnInit {
// input parameters // input parameters
@Input() id:number = -1; @Input() id:number = -1;

View File

@ -3,17 +3,15 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input } from '@angular/core'; import {Component, OnInit, Input } from '@angular/core';
import { SeasonService } from '../../service/season'; import { SeasonService, DataService } from '../../service';
@Component({ @Component({
selector: 'app-element-season', selector: 'app-element-season',
templateUrl: './element-season.html', templateUrl: './element-season.html',
styleUrls: [ './element-season.less' ] styleUrls: [ './element-season.less' ]
}) })
@Injectable()
export class ElementSeasonComponent implements OnInit { export class ElementSeasonComponent implements OnInit {
// input parameters // input parameters
@Input() idSeason:number = -1; @Input() idSeason:number = -1;
@ -25,7 +23,9 @@ export class ElementSeasonComponent implements OnInit {
covers:Array<string> = []; covers:Array<string> = [];
description:string = ''; description:string = '';
constructor(private seasonService: SeasonService) { constructor(
private seasonService: SeasonService,
private dataService: DataService) {
} }
ngOnInit() { ngOnInit() {
@ -42,7 +42,7 @@ export class ElementSeasonComponent implements OnInit {
} else { } else {
self.cover = response.covers[0];//self.seasonService.getCoverThumbnailUrl(response.covers[0]); self.cover = response.covers[0];//self.seasonService.getCoverThumbnailUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.seasonService.getCoverThumbnailUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverThumbnailUrl(response.covers[iii]));
} }
} }
}).catch((response) => { }).catch((response) => {

View File

@ -3,17 +3,15 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { SeriesService } from '../../service/series'; import { SeriesService, DataService } from '../../service';
@Component({ @Component({
selector: 'app-element-series', selector: 'app-element-series',
templateUrl: './element-series.html', templateUrl: './element-series.html',
styleUrls: [ './element-series.less' ] styleUrls: [ './element-series.less' ]
}) })
@Injectable()
export class ElementSeriesComponent implements OnInit { export class ElementSeriesComponent implements OnInit {
// input parameters // input parameters
@Input() idSeries:number = -1; @Input() idSeries:number = -1;
@ -28,7 +26,9 @@ export class ElementSeriesComponent implements OnInit {
cover:string = ''; cover:string = '';
covers:Array<string> = []; covers:Array<string> = [];
constructor(private seriesService: SeriesService) { constructor(
private seriesService: SeriesService,
private dataService: DataService) {
} }
ngOnInit() { ngOnInit() {
@ -43,9 +43,9 @@ export class ElementSeriesComponent implements OnInit {
self.cover = null; self.cover = null;
// self.covers = []; // self.covers = [];
} else { } else {
self.cover = self.seriesService.getCoverThumbnailUrl(response.covers[0]); self.cover = self.dataService.getCoverThumbnailUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.seriesService.getCoverThumbnailUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverThumbnailUrl(response.covers[iii]));
} }
} }
}).catch((response) => { }).catch((response) => {

View File

@ -3,61 +3,49 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Component, OnInit, Input } from '@angular/core';
import { isArrayOf, isNumberFinite } from '../../utils'; import { isArrayOf, isNumberFinite } from '../../utils';
import { TypeService } from '../../service/type'; import { TypeService, DataService } from '../../service';
import { NodeData } from '../..//model'; import { NodeData } from '../../model';
@Component({ @Component({
selector: 'app-element-type', selector: 'app-element-type',
templateUrl: './element-type.html', templateUrl: './element-type.html',
styleUrls: [ './element-type.less' ] styleUrls: [ './element-type.less' ]
}) })
//@Injectable()
export class ElementTypeComponent implements OnInit { export class ElementTypeComponent implements OnInit {
// input parameters // input parameters
@Input() idType:number = -1; @Input() element:NodeData;
public name: string = 'rr'; public name: string = 'rr';
public description: string = 'sdqdfqsd'; public description: string = 'sdqdfqsd';
public imageSource:string; // TODO: remove this ... public imageSource:string; // TODO: remove this ...
public error:string;
public countvideo:number; public countvideo:number;
public countserie:number; public countserie:number;
public covers: string[]; public covers: string[];
constructor(private typeService: TypeService) { constructor(
private typeService: TypeService,
private dataService: DataService) {
} }
ngOnInit() { ngOnInit() {
let self = this; let self = this;
//console.log(`get parameter id: ${ this.idType}`); console.log(" ??? Get element ! " + JSON.stringify(this.element));
this.typeService.get(this.idType) self.name = this.element.name;
.then((response: NodeData) => { self.description = this.element.description;
//console.log("Get element ! " + JSON.stringify(response)); if(!isArrayOf(this.element.covers, isNumberFinite) || this.element.covers.length === 0) {
self.error = '';
self.name = response.name;
self.description = response.description;
if(!isArrayOf(response.covers, isNumberFinite) || response.covers.length === 0) {
self.covers = undefined; self.covers = undefined;
} else { } else {
self.covers = []; self.covers = [];
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < this.element.covers.length; iii++) {
self.covers.push(self.typeService.getCoverThumbnailUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverThumbnailUrl(this.element.covers[iii]));
} }
} }
}).catch((response) => { this.typeService.countVideo(this.element.id)
self.error = 'Can not get the data';
self.name = undefined;
self.description = undefined;
self.imageSource = undefined;
self.covers = [];
});
this.typeService.countVideo(this.idType)
.then((response: number) => { .then((response: number) => {
self.countvideo = response; self.countvideo = response;
}).catch((response) => { }).catch((response) => {

View File

@ -5,8 +5,7 @@
*/ */
import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Injectable, Component, OnInit, Input } from '@angular/core';
import { VideoService } from '../../service/video'; import { VideoService, DataService, HttpWrapperService } from '../../service';
import { HttpWrapperService } from '../../service/http-wrapper';
@Component({ @Component({
selector: 'app-element-video', selector: 'app-element-video',
@ -39,7 +38,9 @@ export class ElementVideoComponent implements OnInit {
cover:string = ''; cover:string = '';
covers:string[] = []; covers:string[] = [];
constructor(private videoService: VideoService, constructor(
private videoService: VideoService,
private dataService: DataService,
private httpService: HttpWrapperService) { private httpService: HttpWrapperService) {
} }
@ -79,9 +80,9 @@ export class ElementVideoComponent implements OnInit {
self.cover = null; self.cover = null;
// self.covers = []; // self.covers = [];
} else { } else {
self.cover = self.videoService.getCoverThumbnailUrl(response.covers[0]); self.cover = self.dataService.getCoverThumbnailUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.videoService.getCoverThumbnailUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverThumbnailUrl(response.covers[iii]));
} }
} }
// console.log("101010 " + self.videoEnable + " " + self.videoSource); // console.log("101010 " + self.videoEnable + " " + self.videoSource);

View File

@ -14,7 +14,6 @@ import { PopInService } from '../../service';
templateUrl: './popin.html', templateUrl: './popin.html',
styleUrls: [ './popin.less' ] styleUrls: [ './popin.less' ]
}) })
export class PopInComponent implements OnInit, OnDestroy { export class PopInComponent implements OnInit, OnDestroy {
@Input() id: string; @Input() id: string;
@Input() popTitle: string = 'No title'; @Input() popTitle: string = 'No title';

View File

@ -3,10 +3,7 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
// import { AppRoutingModule } from "../app-routing.module";
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { UserService, SessionService, SSOService, ArianeService } from '../../service'; import { UserService, SessionService, SSOService, ArianeService } from '../../service';
@ -15,7 +12,6 @@ import { UserService, SessionService, SSOService, ArianeService } from '../../se
templateUrl: './top-menu.html', templateUrl: './top-menu.html',
styleUrls: [ './top-menu.less' ] styleUrls: [ './top-menu.less' ]
}) })
@Injectable()
export class TopMenuComponent implements OnInit { export class TopMenuComponent implements OnInit {
public login: string = null;// Session.getLogin(); public login: string = null;// Session.getLogin();
public avatar: string = null;// Session.getAvatar(); public avatar: string = null;// Session.getAvatar();

View File

@ -11,7 +11,6 @@ import { Component } from '@angular/core';
templateUrl: './upload-file.html', templateUrl: './upload-file.html',
styleUrls: [ './upload-file.less' ] styleUrls: [ './upload-file.less' ]
}) })
export class UploadFileComponent { export class UploadFileComponent {
files: any = []; files: any = [];
uploadFile(event) { uploadFile(event) {

View File

@ -3,7 +3,7 @@
* @copyright 2018, Edouard DUPIN, all right reserved * @copyright 2018, Edouard DUPIN, all right reserved
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { PopInService } from '../../service/popin'; import { PopInService } from '../../service/popin';
@ -12,8 +12,6 @@ import { PopInService } from '../../service/popin';
templateUrl: './create-type.html', templateUrl: './create-type.html',
styleUrls: [ './create-type.less' ] styleUrls: [ './create-type.less' ]
}) })
@Injectable()
export class PopInCreateType implements OnInit { export class PopInCreateType implements OnInit {
name: string = ''; name: string = '';
description: string = ''; description: string = '';

View File

@ -4,7 +4,7 @@
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { PopInService } from '../../service'; import { PopInService } from '../../service';
@ -13,8 +13,6 @@ import { PopInService } from '../../service';
templateUrl: './delete-confirm.html', templateUrl: './delete-confirm.html',
styleUrls: [ './delete-confirm.less' ] styleUrls: [ './delete-confirm.less' ]
}) })
@Injectable()
export class PopInDeleteConfirm implements OnInit { export class PopInDeleteConfirm implements OnInit {
@Input() comment: string = null; @Input() comment: string = null;
@Input() imageUrl: string = null; @Input() imageUrl: string = null;

View File

@ -4,7 +4,7 @@
* @license PROPRIETARY (see license file) * @license PROPRIETARY (see license file)
*/ */
import { Injectable, Component, OnInit, Input, SimpleChanges } from '@angular/core'; import { Component, OnInit, Input, SimpleChanges } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { PopInService } from '../../service'; import { PopInService } from '../../service';
@ -14,8 +14,6 @@ import { PopInService } from '../../service';
templateUrl: './upload-progress.html', templateUrl: './upload-progress.html',
styleUrls: [ './upload-progress.less' ] styleUrls: [ './upload-progress.less' ]
}) })
@Injectable()
export class PopInUploadProgress implements OnInit { export class PopInUploadProgress implements OnInit {
@Input() mediaTitle: string = ''; @Input() mediaTitle: string = '';
@Input() mediaUploaded: number = 0; @Input() mediaUploaded: number = 0;

View File

@ -4,7 +4,7 @@
</div> </div>
<div class="fill-all colomn_mutiple"> <div class="fill-all colomn_mutiple">
<div *ngFor="let data of dataList" class="item-home" (click)="onSelectType($event, data.id)" (auxclick)="onSelectType($event, data.id)"> <div *ngFor="let data of dataList" class="item-home" (click)="onSelectType($event, data.id)" (auxclick)="onSelectType($event, data.id)">
<app-element-type [idType]="data.id"></app-element-type> <app-element-type [element]="data"></app-element-type>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View File

@ -7,10 +7,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { SeasonService } from '../../service/season'; import { SeasonService , ArianeService, DataService, PopInService} from '../../service';
import { ArianeService } from '../../service/ariane';
import { UploadProgress } from '../../popin/upload-progress/upload-progress'; import { UploadProgress } from '../../popin/upload-progress/upload-progress';
import { PopInService } from '../../service/popin';
export interface ElementList { export interface ElementList {
value: number; value: number;
@ -65,10 +64,12 @@ export class SeasonEditScene implements OnInit {
} }
constructor(private route: ActivatedRoute, constructor(
private route: ActivatedRoute,
private seasonService: SeasonService, private seasonService: SeasonService,
private arianeService: ArianeService, private arianeService: ArianeService,
private popInService: PopInService) { private popInService: PopInService,
private dataService: DataService) {
} }
@ -105,7 +106,7 @@ export class SeasonEditScene implements OnInit {
for(let iii = 0; iii < covers.length; iii++) { for(let iii = 0; iii < covers.length; iii++) {
this.coversDisplay.push({ this.coversDisplay.push({
id:covers[iii], id:covers[iii],
url:this.seasonService.getCoverThumbnailUrl(covers[iii]) url:this.dataService.getCoverThumbnailUrl(covers[iii])
}); });
} }
} else { } else {
@ -182,7 +183,7 @@ export class SeasonEditScene implements OnInit {
removeCover(id:number) { removeCover(id:number) {
this.cleanConfirm(); this.cleanConfirm();
this.confirmDeleteComment = `Delete the cover ID: ${ id}`; this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
this.confirmDeleteImageUrl = this.seasonService.getCoverThumbnailUrl(id); this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
this.deleteCoverId = id; this.deleteCoverId = id;
this.popInService.open('popin-delete-confirm'); this.popInService.open('popin-delete-confirm');
} }

View File

@ -7,9 +7,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { SeasonService } from '../../service/season'; import { SeasonService, DataService, SeriesService, ArianeService } from '../../service';
import { SeriesService } from '../../service/series';
import { ArianeService } from '../../service/ariane';
@Component({ @Component({
selector: 'app-season', selector: 'app-season',
@ -26,10 +24,12 @@ export class SeasonScene implements OnInit {
idSeason = -1; idSeason = -1;
videosError = ''; videosError = '';
videos = []; videos = [];
constructor(private route: ActivatedRoute, constructor(
private route: ActivatedRoute,
private seasonService: SeasonService, private seasonService: SeasonService,
private seriesService: SeriesService, private seriesService: SeriesService,
private arianeService: ArianeService) { private arianeService: ArianeService,
private dataService: DataService) {
} }
@ -49,9 +49,9 @@ export class SeasonScene implements OnInit {
self.cover = null; self.cover = null;
self.covers = []; self.covers = [];
} else { } else {
self.cover = self.seriesService.getCoverUrl(response.covers[0]); self.cover = self.dataService.getCoverUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.seriesService.getCoverUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverUrl(response.covers[iii]));
} }
} }
self.seriesService.get(self.seriesId) self.seriesService.get(self.seriesId)

View File

@ -5,22 +5,15 @@
*/ */
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { Location } from '@angular/common';
import { SeriesService } from '../../service/series'; import { SeriesService, DataService, TypeService, ArianeService, PopInService } from '../../service';
import { DataService } from '../../service/data';
import { TypeService } from '../../service/type';
import { ArianeService } from '../../service/ariane';
import { UploadProgress } from '../../popin/upload-progress/upload-progress'; import { UploadProgress } from '../../popin/upload-progress/upload-progress';
import { PopInService } from '../../service/popin';
export class ElementList { export class ElementList {
value: number; constructor(
label: string; public value: number,
constructor(_value: number, _label: string) { public label: string) {
this.value = _value;
this.label = _label;
} }
} }
@ -81,8 +74,6 @@ export class SeriesEditScene implements OnInit {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router,
private locate: Location,
private dataService: DataService, private dataService: DataService,
private typeService: TypeService, private typeService: TypeService,
private seriesService: SeriesService, private seriesService: SeriesService,
@ -144,7 +135,7 @@ export class SeriesEditScene implements OnInit {
for(let iii = 0; iii < covers.length; iii++) { for(let iii = 0; iii < covers.length; iii++) {
this.coversDisplay.push({ this.coversDisplay.push({
id:covers[iii], id:covers[iii],
url:this.seriesService.getCoverThumbnailUrl(covers[iii]) url:this.dataService.getCoverThumbnailUrl(covers[iii])
}); });
} }
} else { } else {
@ -230,7 +221,7 @@ export class SeriesEditScene implements OnInit {
removeCover(id:number) { removeCover(id:number) {
this.cleanConfirm(); this.cleanConfirm();
this.confirmDeleteComment = `Delete the cover ID: ${ id}`; this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
this.confirmDeleteImageUrl = this.seriesService.getCoverThumbnailUrl(id); this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
this.deleteCoverId = id; this.deleteCoverId = id;
this.popInService.open('popin-delete-confirm'); this.popInService.open('popin-delete-confirm');
} }

View File

@ -7,8 +7,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { SeriesService } from '../../service/series'; import { SeriesService, DataService, ArianeService } from '../../service';
import { ArianeService } from '../../service/ariane';
import { NodeData } from '../../model'; import { NodeData } from '../../model';
@Component({ @Component({
@ -27,9 +26,11 @@ export class SeriesScene implements OnInit {
seasons: NodeData[] = []; seasons: NodeData[] = [];
videosError: string = ''; videosError: string = '';
videos: Array<any> = []; videos: Array<any> = [];
constructor(private route: ActivatedRoute, constructor(
private route: ActivatedRoute,
private seriesService: SeriesService, private seriesService: SeriesService,
private arianeService: ArianeService) { private arianeService: ArianeService,
private dataService: DataService) {
} }
@ -52,9 +53,9 @@ export class SeriesScene implements OnInit {
self.cover = null; self.cover = null;
self.covers = []; self.covers = [];
} else { } else {
self.cover = self.seriesService.getCoverUrl(response.covers[0]); self.cover = self.dataService.getCoverUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.seriesService.getCoverUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverUrl(response.covers[iii]));
} }
} }
updateEnded.seriesMetadata = true; updateEnded.seriesMetadata = true;

View File

@ -6,7 +6,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ArianeService } from '../../service/ariane'; import { ArianeService, DataService } from '../../service';
@Component({ @Component({
selector: 'app-settings', selector: 'app-settings',
@ -16,8 +16,11 @@ import { ArianeService } from '../../service/ariane';
export class SettingsScene implements OnInit { export class SettingsScene implements OnInit {
page = ''; page = '';
constructor(private route: ActivatedRoute, constructor(
private arianeService: ArianeService) { } private route: ActivatedRoute,
private arianeService: ArianeService) {
// nothing to do.
}
ngOnInit() { ngOnInit() {
this.arianeService.updateManual(this.route.snapshot.paramMap); this.arianeService.updateManual(this.route.snapshot.paramMap);

View File

@ -7,8 +7,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TypeService } from '../../service/type'; import { TypeService, DataService, ArianeService } from '../../service';
import { ArianeService } from '../../service/ariane';
@Component({ @Component({
selector: 'app-type', selector: 'app-type',
@ -26,9 +25,11 @@ export class TypeScene implements OnInit {
seriess = []; seriess = [];
videosError = ''; videosError = '';
videos = []; videos = [];
constructor(private route: ActivatedRoute, constructor(
private route: ActivatedRoute,
private typeService: TypeService, private typeService: TypeService,
private arianeService: ArianeService) { private arianeService: ArianeService,
private dateService: DataService) {
/* /*
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
@ -54,9 +55,9 @@ export class TypeScene implements OnInit {
self.cover = null; self.cover = null;
self.covers = []; self.covers = [];
} else { } else {
self.cover = self.typeService.getCoverUrl(response.covers[0]); self.cover = self.dateService.getCoverUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.typeService.getCoverUrl(response.covers[iii])); self.covers.push(self.dateService.getCoverUrl(response.covers[iii]));
} }
} }
}).catch((response) => { }).catch((response) => {

View File

@ -8,12 +8,7 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { PopInService } from '../../service/popin'; import { PopInService, DataService, TypeService, UniverseService, SeriesService, VideoService, ArianeService } from '../../service';
import { TypeService } from '../../service/type';
import { UniverseService } from '../../service/universe';
import { SeriesService } from '../../service/series';
import { VideoService } from '../../service/video';
import { ArianeService } from '../../service/ariane';
import { UploadProgress } from '../../popin/upload-progress/upload-progress'; import { UploadProgress } from '../../popin/upload-progress/upload-progress';
import { NodeData } from '../../model'; import { NodeData } from '../../model';
@ -113,13 +108,15 @@ export class VideoEditScene implements OnInit {
listSeason: ElementList[] = [ listSeason: ElementList[] = [
{ value: undefined, label: '---' }, { value: undefined, label: '---' },
]; ];
constructor(private route: ActivatedRoute, constructor(
private route: ActivatedRoute,
private typeService: TypeService, private typeService: TypeService,
private universeService: UniverseService, private universeService: UniverseService,
private seriesService: SeriesService, private seriesService: SeriesService,
private videoService: VideoService, private videoService: VideoService,
private arianeService: ArianeService, private arianeService: ArianeService,
private popInService: PopInService) { private popInService: PopInService,
private dataService: DataService) {
} }
@ -160,7 +157,7 @@ export class VideoEditScene implements OnInit {
this.data.covers.push(covers[iii]); this.data.covers.push(covers[iii]);
this.coversDisplay.push({ this.coversDisplay.push({
id:covers[iii], id:covers[iii],
url:this.videoService.getCoverThumbnailUrl(covers[iii]) url:this.dataService.getCoverThumbnailUrl(covers[iii])
}); });
} }
} else { } else {
@ -437,7 +434,7 @@ export class VideoEditScene implements OnInit {
removeCover(id:number) { removeCover(id:number) {
this.cleanConfirm(); this.cleanConfirm();
this.confirmDeleteComment = `Delete the cover ID: ${ id}`; this.confirmDeleteComment = `Delete the cover ID: ${ id}`;
this.confirmDeleteImageUrl = this.seriesService.getCoverThumbnailUrl(id); this.confirmDeleteImageUrl = this.dataService.getCoverThumbnailUrl(id);
this.deleteCoverId = id; this.deleteCoverId = id;
this.popInService.open('popin-delete-confirm'); this.popInService.open('popin-delete-confirm');
} }

View File

@ -6,11 +6,7 @@
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { HttpWrapperService } from '../../service/http-wrapper'; import { HttpWrapperService, DataService, VideoService, SeriesService, SeasonService, ArianeService } from '../../service';
import { VideoService } from '../../service/video';
import { SeriesService } from '../../service/series';
import { SeasonService } from '../../service/season';
import { ArianeService } from '../../service/ariane';
import { isNullOrUndefined } from '../..//utils'; import { isNullOrUndefined } from '../..//utils';
@Component({ @Component({
@ -82,7 +78,8 @@ export class VideoScene implements OnInit {
private seriesService: SeriesService, private seriesService: SeriesService,
private seasonService: SeasonService, private seasonService: SeasonService,
private httpService: HttpWrapperService, private httpService: HttpWrapperService,
private arianeService: ArianeService) { private arianeService: ArianeService,
private dataService: DataService) {
} }
@ -221,9 +218,9 @@ export class VideoScene implements OnInit {
if(response.covers === undefined || response.covers === null || response.covers.length === 0) { if(response.covers === undefined || response.covers === null || response.covers.length === 0) {
self.cover = null; self.cover = null;
} else { } else {
self.cover = self.videoService.getCoverUrl(response.covers[0]); self.cover = self.dataService.getCoverUrl(response.covers[0]);
for(let iii = 0; iii < response.covers.length; iii++) { for(let iii = 0; iii < response.covers.length; iii++) {
self.covers.push(self.videoService.getCoverUrl(response.covers[iii])); self.covers.push(self.dataService.getCoverUrl(response.covers[iii]));
} }
} }
self.generateName(); self.generateName();
@ -266,7 +263,7 @@ export class VideoScene implements OnInit {
self.haveNext = response6[iii]; self.haveNext = response6[iii];
} }
} }
self.covers.push(self.seriesService.getCoverUrl(response6[iii])); self.covers.push(self.dataService.getCoverUrl(response6[iii]));
} }
}).catch((response7:any) => { }).catch((response7:any) => {

View File

@ -57,7 +57,7 @@ export class HttpWrapperService {
} }
addTokenIfNeeded(headerOption:any): any { addTokenIfNeeded(headerOption:any): any {
if(this.session.sessionData !== null) { if(!isNullOrUndefined(this.session.getToken())) {
if(headerOption.Authorization === undefined) { if(headerOption.Authorization === undefined) {
headerOption.Authorization = `Yota ${this.session.getToken()}`; headerOption.Authorization = `Yota ${this.session.getToken()}`;
} }
@ -182,14 +182,15 @@ export class HttpWrapperService {
out = out + "=" + options[keys[iii]]; out = out + "=" + options[keys[iii]];
} }
} }
if (!isNullOrUndefined(this.session.sessionData)) { console.log(`try to get session : ${this.session.getToken()}`);
if (!isNullOrUndefined(this.session.getToken())) {
if (addURLToken !== undefined && addURLToken === true) { if (addURLToken !== undefined && addURLToken === true) {
if(first === false) { if(first === false) {
out = `${out }&`; out = `${out }&`;
} else { } else {
out = `${out }?`; out = `${out }?`;
} }
out = out + `Authorization=Yota ${this.session.sessionData.userId}:${this.session.sessionData.token}`; out = out + `Authorization=Yota ${this.session.getToken()}`;
} }
} }
return out; return out;

View File

@ -96,19 +96,6 @@ export class SeasonService {
let ret = this.http.deleteSpecific(this.serviceName, id); let ret = this.http.deleteSpecific(this.serviceName, id);
return this.bdd.delete(this.serviceName, id, ret); return this.bdd.delete(this.serviceName, id, ret);
} }
// deprecated ???
getCoverUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/${coverId}`,
addURLToken: true,
});
}
getCoverThumbnailUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/thumbnail/${coverId}`,
addURLToken: true,
});
}
deleteCover(nodeId:number, deleteCover(nodeId:number,
coverId:number) { coverId:number) {
let self = this; let self = this;

View File

@ -155,20 +155,6 @@ export class SeriesService {
return this.bdd.delete(this.serviceName, id, ret); return this.bdd.delete(this.serviceName, id, ret);
} }
getCoverUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/${coverId}`,
addURLToken: true,
});
}
getCoverThumbnailUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/thumbnail/${coverId}`,
addURLToken: true,
});
}
getLike(nameSeries:string):any { getLike(nameSeries:string):any {
let self = this; let self = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

View File

@ -15,7 +15,7 @@ export enum UserRoles222 {
@Injectable() @Injectable()
export class SessionService { export class SessionService {
private tokenJwt = null; private tokenJwt = null;
public sessionData = null; public sessionId = null;
public userLogin = null; public userLogin = null;
public userAdmin = null; public userAdmin = null;
public userEMail = null; public userEMail = null;
@ -31,22 +31,22 @@ export class SessionService {
/** /**
* @brief Create a new session. * @brief Create a new session.
* *
* @param sessionData - * @param sessionId -
* @param userId - * @param userId -
* @param userLogin - * @param userLogin -
* @param userEMail - * @param userEMail -
* @param userAdmin - * @param userAdmin -
* @param userAvatar - * @param userAvatar -
*/ */
create(sessionData, create(sessionId,
userId: string, userId: string,
userLogin: string, userLogin: string,
userEMail: string, userEMail: string,
userAdmin: boolean, userAdmin: boolean,
userAvatar: string) { userAvatar: string) {
console.log(`Session Create: userId=${userId} userLogin=${userLogin} userEMail=${userEMail} userAdmin=${userAdmin} userAvatar=${userAvatar} `); console.log(`Session Create: userId=${userId} userLogin=${userLogin} userEMail=${userEMail} userAdmin=${userAdmin} userAvatar=${userAvatar} sessionId = ${sessionId}`);
this.tokenJwt = undefined; this.tokenJwt = undefined;
this.sessionData = sessionData; this.sessionId = sessionId;
this.userId = userId; this.userId = userId;
this.userLogin = userLogin; this.userLogin = userLogin;
this.userAdmin = userAdmin; this.userAdmin = userAdmin;
@ -60,8 +60,8 @@ export class SessionService {
*/ */
destroy() { destroy() {
console.log('Session REMOVE'); console.log('Session REMOVE');
let last = this.sessionData; let last = this.sessionId;
this.sessionData = null; this.sessionId = null;
this.tokenJwt = undefined; this.tokenJwt = undefined;
this.userId = null; this.userId = null;
this.userLogin = null; this.userLogin = null;
@ -77,7 +77,7 @@ export class SessionService {
return this.tokenJwt; return this.tokenJwt;
} }
islogged() { islogged() {
return this.sessionData !== null; return this.sessionId !== null;
} }
hasRight(type) { hasRight(type) {
if(type === UserRoles222.admin) { if(type === UserRoles222.admin) {
@ -86,7 +86,7 @@ export class SessionService {
} }
if(type === UserRoles222.user) { if(type === UserRoles222.user) {
// is connected ==> is user // is connected ==> is user
return this.sessionData !== null; return this.sessionId !== null;
} }
if(type === UserRoles222.guest) { if(type === UserRoles222.guest) {
// all the other ... maybe unneeded // all the other ... maybe unneeded

View File

@ -14,6 +14,7 @@ export class SSOService {
console.log('Start SSOService'); console.log('Start SSOService');
} }
utf8_to_b64( str:string ): string { utf8_to_b64( str:string ): string {
// remove unneeded "=" padding
return window.btoa(unescape(encodeURIComponent( str ))).replace("=", ""); return window.btoa(unescape(encodeURIComponent( str ))).replace("=", "");
} }

View File

@ -151,17 +151,5 @@ export class TypeService {
}); });
} }
getCoverUrl(coverId:number): string {
return this.http.createRESTCall2({
api: `data/${coverId}`,
addURLToken: true,
});
}
getCoverThumbnailUrl(coverId:number): string {
return this.http.createRESTCall2({
api: `data/thumbnail/${coverId}`,
addURLToken: true,
});
}
} }

View File

@ -62,9 +62,6 @@ export class UniverseService {
let ret = this.http.putSpecific(this.serviceName, id, data); let ret = this.http.putSpecific(this.serviceName, id, data);
return this.bdd.setAfterPut(this.serviceName, id, ret); return this.bdd.setAfterPut(this.serviceName, id, ret);
} }
getCoverUrl(coverId:number):any {
return this.http.createRESTCall(`data/${ coverId}`);
}
deleteCover(nodeId:number, deleteCover(nodeId:number,
coverId:number) { coverId:number) {
let self = this; let self = this;

View File

@ -85,8 +85,8 @@ export class UserService {
// Need to use the windows global route to prevent the log in cycle ... // Need to use the windows global route to prevent the log in cycle ...
// And in the mlain application position, the route does not have curently root the page // And in the mlain application position, the route does not have curently root the page
let pathName = window.location.pathname; let pathName = window.location.pathname;
console.log("start Path-name: '" + pathName + "'"); //console.log("start Path-name: '" + pathName + "'");
console.log("check with: '" + environment.applName + "/sso/" + "'"); //console.log("check with: '" + environment.applName + "/sso/" + "'");
if (pathName.startsWith("/sso/") || pathName.startsWith(environment.applName + "/sso/")) { if (pathName.startsWith("/sso/") || pathName.startsWith(environment.applName + "/sso/")) {
console.log(" ==> SSo section"); console.log(" ==> SSo section");
reject(); reject();

View File

@ -47,18 +47,6 @@ export class VideoService {
let ret = this.http.deleteSpecific(this.serviceName, id); let ret = this.http.deleteSpecific(this.serviceName, id);
return this.bdd.delete(this.serviceName, id, ret); return this.bdd.delete(this.serviceName, id, ret);
} }
getCoverUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/${coverId}`,
addURLToken: true,
});
}
getCoverThumbnailUrl(coverId:number):any {
return this.http.createRESTCall2({
api: `data/thumbnail/${coverId}`,
addURLToken: true,
});
}
uploadFile(file:File, uploadFile(file:File,
universe?:string, universe?:string,