diff --git a/front/.gitignore b/front/.gitignore index 2ccbe46..766217c 100644 --- a/front/.gitignore +++ b/front/.gitignore @@ -1 +1,3 @@ /node_modules/ +/.angular/ +/.idea/ \ No newline at end of file diff --git a/front/src/app/scene/upload/upload.html b/front/src/app/scene/upload/upload.html index cbddbdf..b5beecb 100644 --- a/front/src/app/scene/upload/upload.html +++ b/front/src/app/scene/upload/upload.html @@ -128,6 +128,7 @@ placeholder="e?" [value]="data.episode" (input)="onEpisode(data, $event.target.value)" + [class.error]="data.episodeDetected == true" /> @@ -137,6 +138,9 @@ (input)="onTitle(data, $event.target.value)" [class.error]="data.title == ''" /> + + ^^^This title already exist !!! + @@ -152,6 +156,27 @@
+
+ + + + + + + + + + + + + + + + + + +
Episode ID:Episode Title:
{{data.episode}}{{data.name}}
+
@@ -169,7 +194,7 @@ --> - + Rejected: {{data.file.name}}
==> {{data.reason}} diff --git a/front/src/app/scene/upload/upload.less b/front/src/app/scene/upload/upload.less index a05b833..8f3e9d7 100644 --- a/front/src/app/scene/upload/upload.less +++ b/front/src/app/scene/upload/upload.less @@ -1,13 +1,3 @@ -d.fill-all{ - //width:100%; - max-width:80%; - height:100%; - margin: 20px auto; - padding: 20px; - border:0; - background-color: rgba(200, 200, 200, 0.5); - box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.6); -} .title { width: 90%; @@ -16,29 +6,6 @@ d.fill-all{ text-align: center; } -.request_raw2 { - width: 90%; - margin: 0 auto; - height: 160px; - .label { - width: 15%; - margin-right: 10px; - text-align: right; - float: left; - display: block; - } - .input { - width: 75%; - float: left; - display: block; - textarea { - width: 100%; - font-size: 20px; - resize: none; - } - } -} - .request_raw_table { display: block; width: 90%; @@ -78,139 +45,9 @@ d.fill-all{ background-color: rgba(256,220,220,1.0); } } - -.request_raw { - width: 90%; - margin: 0 auto; - height: 45px; - .label { - width: 15%; - margin-right: 10px; - text-align: right; - float: left; - display: block; - } - .input2 { - width: 75%; - float: left; - display: block; - .number-input { - clear: none; - width: 75px; - font-size: 20px; - border: 0px; - } - .title-input { - width: calc(100% - 75px); - font-size: 20px; - border: 0px; - } - .error { - border-color: rgba(200,0,0,1.0); - background-color: rgba(256,220,220,1.0); - } - } - .input { - width: 75%; - float: left; - display: block; - input { - width: 100%; - font-size: 20px; - } - select { - width: 100%; - font-size: 20px; - } - textarea { - width: 100%; - font-size: 20px; - } - .error { - border-color: rgba(200,0,0,1.0); - background-color: rgba(256,220,220,1.0); - } - } - .label2 { - width: 20%; - } - .input2 { - width: 70%; - } - .input_add { - width: 5%; - float: right; - display: block; - } - .cover_div { - float: left; - display: block; - } - .cover_remove_div { - float: left; - display: block; - } - .cover { - max-width: 30%; - } -} .send_value { width: 300px; margin: 0 auto; padding: 10px; display: block; } - -.item { - font-size: 20px; - height: 21%; - width: 23%; - margin: 1%; - padding: 0; - overflow: hidden; - //box-shadow: 0 1px 1.5px 0 rgba(0,0,0,.12),0 1px 1px 0 rgba(0,0,0,.24); - box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.6); - line-height: normal; - border: none; - font-family: "Roboto","Helvetica","Arial",sans-serif; - font-weight: 500; - text-transform: uppercase; - letter-spacing: 0; - will-change: box-shadow; - outline: none; - cursor: pointer; - text-decoration: none; - text-align: center; - vertical-align: middle; - transition-duration: 0.4s; - float:left; - display:block; - - h1 { - font-size: 24px; - } - - &:hover { - background-color: #F00; - } - - .material-icons { - vertical-align: middle; - } - - .material-icons { - position: absolute; - top: 50%; - left: 50%; - transform: ~"translate(-12px,-12px)"; - line-height: 24px; - width: 24px; - } -} - -.item-video { - &:hover { - background-color: #0F0; - } -} - diff --git a/front/src/app/scene/upload/upload.ts b/front/src/app/scene/upload/upload.ts index 77f1422..babdb1c 100644 --- a/front/src/app/scene/upload/upload.ts +++ b/front/src/app/scene/upload/upload.ts @@ -5,11 +5,8 @@ */ import { Component, OnInit } from '@angular/core'; -import { Router, ActivatedRoute, ParamMap } from '@angular/router'; -import { Location } from '@angular/common'; +import { ActivatedRoute } from '@angular/router'; import { fadeInAnimation } from '../../_animations/index'; -import { HttpWrapperService } from '../../service/http-wrapper'; -import { HttpEventType, HttpResponse } from '@angular/common/http'; import { PopInService } from '../../service/popin'; @@ -17,9 +14,9 @@ import { TypeService } from '../../service/type'; import { UniverseService } from '../../service/universe'; import { SeriesService } from '../../service/series'; import { VideoService } from '../../service/video'; -import { DataService } from '../../service/data'; import { ArianeService } from '../../service/ariane'; import { UploadProgress } from '../../popin/upload-progress/upload-progress'; +import { SeasonService } from '../../service/season'; export class ElementList { constructor( @@ -29,7 +26,9 @@ export class ElementList { } } export class FileParsedElement { - public isSended: false; + public isSended: boolean = false; + public nameDetected: boolean = false; + public episodeDetected: boolean = false; constructor( public file: File, public universe: string, @@ -57,21 +56,18 @@ export class FileFailParsedElement { }) export class UploadScene implements OnInit { - id_video: number = -1; - - error: string = ""; - - mediaFile: File[] = null; parsedElement: FileParsedElement[] = []; - parsedFaledElement: FileFailParsedElement[] = []; + parsedFailedElement: FileFailParsedElement[] = []; upload_file_value: string = "" selectedFiles: FileList; type_id: number = null series_id: number = null + saison_id: number = null need_send: boolean = false; - covers_display: Array = []; - + // list of all files already registered in the bdd to compare with the curent list of files. + listFileInBdd: any = null; + // section tha define the upload value to display in the pop-in of upload public upload:UploadProgress = new UploadProgress(); @@ -111,21 +107,18 @@ export class UploadScene implements OnInit { global_series: string = ""; global_season: number = null; constructor(private route: ActivatedRoute, - private router: Router, - private locate: Location, - private dataService: DataService, private typeService: TypeService, private universeService: UniverseService, private seriesService: SeriesService, + private seasonService: SeasonService, private videoService: VideoService, - private httpService: HttpWrapperService, private arianeService: ArianeService, private popInService: PopInService) { - + // nothing to do. } updateNeedSend (): boolean { - if (this.mediaFile == null) { + if (this.parsedElement.length === 0) { this.need_send = false; return; } @@ -143,7 +136,6 @@ export class UploadScene implements OnInit { ngOnInit () { this.arianeService.updateManual(this.route.snapshot.paramMap); - this.id_video = this.arianeService.getVideoId(); let self = this; this.listType = [{ value: null, label: '---' }]; this.listUniverse = [{ value: null, label: '---' }]; @@ -172,6 +164,7 @@ export class UploadScene implements OnInit { this.series_id = null; this.updateType (_value); } + private updateType (_value: any): void { console.log("Change requested of type ... " + _value); if (this.type_id == _value) { @@ -209,11 +202,13 @@ export class UploadScene implements OnInit { } } this.updateNeedSend(); + this.updateListOfVideoToCheck(); } onSeason (_value: any): void { this.global_season = _value; //console.log("change episode ID: " + _value + " ==> " + this.parse_season.toString()); this.updateNeedSend(); + this.updateListOfVideoToCheck(); } onTitle (data: FileParsedElement, _value: any): void { @@ -231,6 +226,7 @@ export class UploadScene implements OnInit { //console.log("change episode ID: " + _value + " ==> " + this.parse_episode.toString()); this.updateNeedSend(); } + onSeries (_value: any): void { this.global_series = _value; let self = this; @@ -246,6 +242,7 @@ export class UploadScene implements OnInit { } else if (response.length == 1) { self.series_id = response[0].id; } + this.updateListOfVideoToCheck(); }).catch(function(response) { console.log("CAN NOT find element: " ); self.series_id = null; @@ -260,10 +257,12 @@ export class UploadScene implements OnInit { this.global_series = ""; this.global_season = null; this.parsedElement = []; - this.parsedFaledElement = []; + this.parsedFailedElement = []; + this.listFileInBdd = null; this.type_id = null; this.series_id = null; + this.saison_id = null; this.listSeries = [{value: null, label: '---'}]; this.listSeason = [{value: null, label: '---'}]; } @@ -348,13 +347,6 @@ export class UploadScene implements OnInit { // At the file input element // (change)="selectFile($event)" onChangeFile (_value: any): void { - this.mediaFile = []; - for (var i = 0; i < _value.files.length; i++) { - this.mediaFile.push(_value.files[i]); - } - //console.log("get files: " + JSON.stringify(tmpFileList)); - //this.selectedFiles =_value.files; - //this.mediaFile = this.selectedFiles[0]; this.clearData(); for (let iii=0; iii<_value.files.length; iii++) { @@ -370,7 +362,7 @@ export class UploadScene implements OnInit { for (let iii=1; iii nothing to do. + if (this.series_id === null) { + this.listFileInBdd = null; + return; + } + let self = this; + // no season check only the series files. + if (this.global_season === null) { + self.seriesService.getVideo(self.series_id) + .then(function(response: any[]) { + self.listFileInBdd = response; + //console.log("find video: " + response.length); + //for (let iii = 0; iii { @@ -44,6 +49,11 @@ export class SeasonService { }); }); } + /** + * Get the number of video in this saison ID + * @param _id - Id of the season. + * @returns The number of element present in this saison + */ countVideo(_id:number):any { let self = this; return new Promise((resolve, reject) => { diff --git a/front/src/app/service/series.ts b/front/src/app/service/series.ts index ec667e6..526cfa1 100644 --- a/front/src/app/service/series.ts +++ b/front/src/app/service/series.ts @@ -89,7 +89,12 @@ export class SeriesService { }); }); } - + /** + * Get all the season of a specific series + * @param _id - ID of the series + * @param _select - Selection filter + * @returns the required List. + */ getSeason(_id:number, _select:Array = []):any { let self = this; return new Promise((resolve, reject) => {