From 47cbf4d5f28b1da557b7d24de57447d39ab624ff Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 28 Feb 2020 00:16:34 +0100 Subject: [PATCH] [DEV] set back edition adn add many small GUI adaptations --- back/src/api/data.py | 4 +- back/src/data_interface.py | 2 +- .../element-saison.component.html | 5 +- .../element-saison.component.ts | 2 +- .../src/app/scene/saison/saison.component.ts | 2 +- .../src/app/scene/video-edit/video-edit.html | 73 +++++++++++++++---- .../src/app/scene/video-edit/video-edit.less | 22 +++++- front/src/app/scene/video-edit/video-edit.ts | 53 ++++++++++---- .../src/app/scene/video/video.component.html | 20 +++-- front/src/app/scene/video/video.component.ts | 49 +++++++++++++ front/src/app/service/group.service.ts | 26 +++++-- 11 files changed, 203 insertions(+), 55 deletions(-) diff --git a/back/src/api/data.py b/back/src/api/data.py index 61bd5fd..0964b80 100644 --- a/back/src/api/data.py +++ b/back/src/api/data.py @@ -191,8 +191,8 @@ def add(_app, _name_api): @doc.summary("get a specific resource") @doc.description("Get a resource with all the needed datas ... It permeit seek for video stream.") @doc.produces(content_type='application/json') - async def retrive2(request, id, custom_user_video_name): - return retrive2(request, id) + def retrive2(request, id, custom_user_video_name): + return retrive(request, id) @elem_blueprint.get('/' + _name_api + '/', strict_slashes=True) @doc.summary("get a specific resource") diff --git a/back/src/data_interface.py b/back/src/data_interface.py index 2bd3d56..7b3fef8 100644 --- a/back/src/data_interface.py +++ b/back/src/data_interface.py @@ -233,7 +233,7 @@ class DataInterface(): raise ServerError("INTERNAL_ERROR fail request SQL ...", status_code=500) self.mark_to_store(); - return self.get(iddd); + return self.get(_id); def post(self, _value): debug.info("post " + self.name) diff --git a/front/src/app/component/element-saison/element-saison.component.html b/front/src/app/component/element-saison/element-saison.component.html index 23f7c8d..7f42188 100644 --- a/front/src/app/component/element-saison/element-saison.component.html +++ b/front/src/app/component/element-saison/element-saison.component.html @@ -10,6 +10,9 @@
Saison {{numberSaison}}
-
+
{{count}} Episodes +
+
+ {{count}} Episode
\ No newline at end of file diff --git a/front/src/app/component/element-saison/element-saison.component.ts b/front/src/app/component/element-saison/element-saison.component.ts index bf48be7..29f0112 100644 --- a/front/src/app/component/element-saison/element-saison.component.ts +++ b/front/src/app/component/element-saison/element-saison.component.ts @@ -39,7 +39,7 @@ export class ElementSaisonComponent implements OnInit { this.saisonService.get(this.id_saison) .then(function(response) { self.error = ""; - self.numberSaison = response.number; + self.numberSaison = response.name; self.description = response.description; if (response.covers == undefined || response.covers == null || response.covers.length == 0) { self.cover = null; diff --git a/front/src/app/scene/saison/saison.component.ts b/front/src/app/scene/saison/saison.component.ts index 4306706..bc74fd2 100644 --- a/front/src/app/scene/saison/saison.component.ts +++ b/front/src/app/scene/saison/saison.component.ts @@ -47,7 +47,7 @@ export class SaisonComponent implements OnInit { let self = this; this.saisonService.get(this.id_saison) .then(function(response) { - self.name = response.number; + self.name = response.name; self.group_id = response.parent_id; self.description = response.description; if (response.covers == undefined || response.covers == null || response.covers.length == 0) { diff --git a/front/src/app/scene/video-edit/video-edit.html b/front/src/app/scene/video-edit/video-edit.html index 445d3fc..3dee3af 100644 --- a/front/src/app/scene/video-edit/video-edit.html +++ b/front/src/app/scene/video-edit/video-edit.html @@ -1,5 +1,8 @@
+
+ Edit media +
Title: @@ -14,7 +17,7 @@
- Description: + description Description:
@@ -26,7 +29,7 @@
- Date: + date_range Date:
{{element.label}}
+
+ +
@@ -57,17 +65,27 @@
+
+ +
- Group: + Serie:
-
+
+ +
@@ -79,6 +97,11 @@
+
+ +
@@ -94,33 +117,53 @@
- Data ID: + data_usage Data ID:
{{data.data_id}}
-
-
- Covers: -
-
-
-
-
+

- Covers: + Add covers:
- {{upload_file_value}}
+
+
+ Actual Covers: +
+
+
+ +
+ +
+
+
+
+

+
+
+ warning Administration: +
+
+ +
+
+
\ No newline at end of file diff --git a/front/src/app/scene/video-edit/video-edit.less b/front/src/app/scene/video-edit/video-edit.less index 9a213af..d51203d 100644 --- a/front/src/app/scene/video-edit/video-edit.less +++ b/front/src/app/scene/video-edit/video-edit.less @@ -9,12 +9,19 @@ box-shadow: 0px 2px 4px 0 rgba(0, 0, 0, 0.6); } +.title { + width: 90%; + margin: 0 auto; + font-size: 50px; + text-align: center; +} + .request_raw2 { width: 90%; margin: 0 auto; height: 160px; .label { - width: 20%; + width: 15%; margin-right: 10px; text-align: right; float: left; @@ -36,7 +43,7 @@ margin: 0 auto; height: 45px; .label { - width: 20%; + width: 15%; margin-right: 10px; text-align: right; float: left; @@ -59,8 +66,17 @@ font-size: 20px; } } + .input_add { + width: 5%; + float: right; + display: block; + } .cover_div { - //float: left; + float: left; + display: block; + } + .cover_remove_div { + float: left; display: block; } .cover { diff --git a/front/src/app/scene/video-edit/video-edit.ts b/front/src/app/scene/video-edit/video-edit.ts index 0cc2216..16d920c 100644 --- a/front/src/app/scene/video-edit/video-edit.ts +++ b/front/src/app/scene/video-edit/video-edit.ts @@ -36,7 +36,7 @@ class DataToSend { description:string = "" episode:number = undefined univers_id:number = undefined - group_id:number = undefined + serie_id:number = undefined saison_id:number = undefined data_id:number = -1 time:number = undefined @@ -49,7 +49,7 @@ class DataToSend { tmp.description = this.description tmp.episode = this.episode tmp.univers_id = this.univers_id - tmp.group_id = this.group_id + tmp.serie_id = this.serie_id tmp.saison_id = this.saison_id tmp.data_id = this.data_id tmp.time = this.time @@ -128,7 +128,7 @@ export class VideoEditComponent implements OnInit { if (this.data.univers_id != this.data_ori.univers_id) { this.need_send = true; } - if (this.data.group_id != this.data_ori.group_id) { + if (this.data.serie_id != this.data_ori.serie_id) { this.need_send = true; } if (this.data.saison_id != this.data_ori.saison_id) { @@ -161,10 +161,12 @@ export class VideoEditComponent implements OnInit { }).catch(function(response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); }); - this.groupService.getOrder() + //this.groupService.getOrder() + this.groupService.getData() .then(function(response3) { for(let iii= 0; iii < response3.length; iii++) { self.listGroup.push({value: response3[iii].id, label: response3[iii].name}); + console.log("[" + self.data.data_id + "] Get serie: " + response3[iii].id + ", label:" + response3[iii].name) } }).catch(function(response3) { console.log("get response3 : " + JSON.stringify(response3, null, 2)); @@ -180,13 +182,13 @@ export class VideoEditComponent implements OnInit { self.data.time = response.time; self.data.generated_name = response.generated_name; self.onChangeType(response.type_id); - self.onChangeGroup(response.group_id); + self.onChangeGroup(response.serie_id); self.data.saison_id = response.saison_id; self.data_ori = self.data.clone(); if (response.covers !== undefined && response.covers !== null) { for (let iii=0; iii
+
+ Serie: {{group_name}} +
+
+ Saison: {{saison_name}} +
+
+ Episode: {{episode}} +
+
+ generated_name: {{generated_name}} +
{{description}}
-
- Episode {{episode}} -
-
- generated_name {{generated_name}} -
-
diff --git a/front/src/app/scene/video/video.component.ts b/front/src/app/scene/video/video.component.ts index b75ea79..cdd6ccd 100644 --- a/front/src/app/scene/video/video.component.ts +++ b/front/src/app/scene/video/video.component.ts @@ -10,6 +10,8 @@ import { Location } from '@angular/common'; import { fadeInAnimation } from '../../_animations/index'; import { HttpWrapperService } from '../../service/http-wrapper.service'; import { VideoService } from '../../service/video.service'; +import { GroupService } from '../../service/group.service'; +import { SaisonService } from '../../service/saison.service'; import { ArianeService } from '../../service/ariane.service'; @Component({ @@ -29,7 +31,9 @@ export class VideoComponent implements OnInit { description:string = "" episode:number = undefined group_id:number = undefined + group_name:string = undefined saison_id:number = undefined + saison_name:string = undefined data_id:number = -1 time:number = undefined type_id:number = undefined @@ -42,11 +46,35 @@ export class VideoComponent implements OnInit { private router: Router, private locate: Location, private videoService: VideoService, + private groupService: GroupService, + private saisonService: SaisonService, private httpService: HttpWrapperService, private arianeService: ArianeService) { } + generateName() { + this.generated_name = ""; + if (this.group_name != undefined) { + this.generated_name += this.group_name + "-"; + } + if (this.saison != undefined) { + if (this.saison_name.length < 2) { + this.generated_name += "s0" + this.saison_name + "-"; + } else { + this.generated_name += "s" + this.saison_name + "-"; + } + } + if (this.episode != undefined) { + if (this.episode < 10) { + this.generated_name += "e0" + this.episode + "-"; + } else { + this.generated_name += "e" + this.episode + "-"; + } + } + this.generated_name += this.name; + } + ngOnInit() { this.id_video = parseInt(this.route.snapshot.paramMap.get('video_id')); this.arianeService.setVideo(this.id_video); @@ -76,6 +104,25 @@ export class VideoComponent implements OnInit { self.covers.push(self.videoService.getCoverUrl(response.covers[iii])); } } + self.generateName(); + if (self.group_id !== undefined && self.group_id !== null) { + self.groupService.get(self.group_id) + .then(function(response) { + self.group_name = response.name; + self.generateName(); + }).catch(function(response) { + // nothing to do ... + }); + } + if (self.saison_id !== undefined && self.saison_id !== null) { + self.saisonService.get(self.saison_id) + .then(function(response) { + self.saison_name = response.name; + self.generateName(); + }).catch(function(response) { + // nothing to do ... + }); + } //console.log("display source " + self.video_source); //console.log("set transformed : " + JSON.stringify(self, null, 2)); }).catch(function(response) { @@ -90,6 +137,8 @@ export class VideoComponent implements OnInit { self.generated_name = ""; self.video_source = ""; self.cover = null; + self.group_name = undefined; + self.saison_name = undefined; }); } diff --git a/front/src/app/service/group.service.ts b/front/src/app/service/group.service.ts index b2c2fe8..9834dd2 100644 --- a/front/src/app/service/group.service.ts +++ b/front/src/app/service/group.service.ts @@ -17,9 +17,6 @@ export class GroupService { } get(_id:number):any { - if (environment.localBdd != true) { - return this.http.get_specific(this.serviceName, _id); - } let self = this; return new Promise((resolve, reject) => { self.bdd.getGroup() @@ -35,17 +32,30 @@ export class GroupService { }); }); }; - getOrder():any { - if (environment.localBdd != true) { - return this.http.get_specific(this.serviceName, null, "", ["name","id"]); - } + + getData():any { let self = this; return new Promise((resolve, reject) => { self.bdd.getGroup() .then(function(response) { - let data = response.gets_where([["!=", "id", null]], ["id"], ["name","id"]) + let data = response.gets(); resolve(data); }).catch(function(response) { + console.log("[E] " + self.constructor.name + ": can not retrive BDD values"); + reject(response); + }); + }); + }; + + getOrder():any { + let self = this; + return new Promise((resolve, reject) => { + self.bdd.getGroup() + .then(function(response) { + let data = response.gets_where([["!=", "id", null]], ["id", "name"], ["name","id"]) + resolve(data); + }).catch(function(response) { + console.log("[E] " + self.constructor.name + ": can not retrive BDD values"); reject(response); }); });