diff --git a/front/src/app/app-routing.module.ts b/front/src/app/app-routing.module.ts index d2426f3..f038367 100644 --- a/front/src/app/app-routing.module.ts +++ b/front/src/app/app-routing.module.ts @@ -7,19 +7,19 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; // CLI imports router import { ModuleWithProviders } from '@angular/core'; -import { HomeComponent } from './scene/home/home'; -import { TypeComponent } from './scene/type/type'; -import { UniversComponent } from './scene/univers/univers'; -import { GroupComponent } from './scene/group/group'; -import { SaisonComponent } from './scene/saison/saison'; -import { VideoComponent } from './scene/video/video'; -import { LoginComponent } from './scene/login/login'; -import { SignUpComponent } from './scene/sign-up/sign-up'; -import { SettingsComponent } from './scene/settings/settings'; +import { HomeScene } from './scene/home/home'; +import { TypeScene } from './scene/type/type'; +import { UniverseScene } from './scene/universe/universe'; +import { SeriesScene } from './scene/series/series'; +import { SeasonScene } from './scene/season/season'; +import { VideoScene } from './scene/video/video'; +import { LoginScene } from './scene/login/login'; +import { SignUpScene } from './scene/sign-up/sign-up'; +import { SettingsScene } from './scene/settings/settings'; import { UploadScene } from './scene/upload/upload'; -import { VideoEditComponent } from './scene/video-edit/video-edit'; -import { GroupEditComponent } from './scene/group-edit/group-edit'; -import { SaisonEditComponent } from './scene/saison-edit/saison-edit'; +import { VideoEditScene } from './scene/video-edit/video-edit'; +import { SeriesEditScene } from './scene/series-edit/series-edit'; +import { SeasonEditScene } from './scene/season-edit/season-edit'; //import { HelpComponent } from './help/help.component'; // see https://angular.io/guide/router @@ -27,24 +27,24 @@ import { SaisonEditComponent } from './scene/saison-edit/saison-edit'; const routes: Routes = [ { path: '', redirectTo: '/home', pathMatch: 'full'}, - { path: 'home', component: HomeComponent }, + { path: 'home', component: HomeScene }, { path: 'upload', component: UploadScene }, - { path: 'type/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: TypeComponent }, + { path: 'type/:universe_id/:type_id/:series_id/:season_id/:video_id', component: TypeScene }, - { path: 'univers/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: UniversComponent }, + { path: 'universe/:universe_id/:type_id/:series_id/:season_id/:video_id', component: UniverseScene }, - { path: 'group/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: GroupComponent }, - { path: 'group-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: GroupEditComponent }, + { path: 'series/:universe_id/:type_id/:series_id/:season_id/:video_id', component: SeriesScene }, + { path: 'series-edit/:universe_id/:type_id/:series_id/:season_id/:video_id', component: SeriesEditScene }, - { path: 'saison/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: SaisonComponent }, - { path: 'saison-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: SaisonEditComponent }, + { path: 'season/:universe_id/:type_id/:series_id/:season_id/:video_id', component: SeasonScene }, + { path: 'season-edit/:universe_id/:type_id/:series_id/:season_id/:video_id', component: SeasonEditScene }, - { path: 'video/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: VideoComponent }, - { path: 'video-edit/:univers_id/:type_id/:group_id/:saison_id/:video_id', component: VideoEditComponent }, + { path: 'video/:universe_id/:type_id/:series_id/:season_id/:video_id', component: VideoScene }, + { path: 'video-edit/:universe_id/:type_id/:series_id/:season_id/:video_id', component: VideoEditScene }, - { path: 'login', component: LoginComponent }, - { path: 'signup', component: SignUpComponent }, - { path: 'settings', component: SettingsComponent }, + { path: 'login', component: LoginScene }, + { path: 'signup', component: SignUpScene }, + { path: 'settings', component: SettingsScene }, /*{ path: 'help', component: HelpComponent }*/ ]; /* diff --git a/front/src/app/app.module.ts b/front/src/app/app.module.ts index a676ad9..8fef425 100644 --- a/front/src/app/app.module.ts +++ b/front/src/app/app.module.ts @@ -21,30 +21,30 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { UploadFileComponent } from './component/upload-file/upload-file'; import { TopMenuComponent } from './component/top-menu/top-menu'; import { ElementTypeComponent } from './component/element-type/element-type'; -import { ElementGroupComponent } from './component/element-group/element-group'; -import { ElementSaisonComponent } from './component/element-saison/element-saison'; +import { ElementSeriesComponent } from './component/element-series/element-series'; +import { ElementSeasonComponent } from './component/element-season/element-season'; import { ElementVideoComponent } from './component/element-video/element-video'; import { CreateTypeComponent } from './component/create-type/create-type'; import { PopInUploadProgress } from './component/upload-progress/upload-progress'; import { PopInComponent } from './component/popin/popin'; -import { HelpComponent } from './scene/help/help'; -import { LoginComponent } from './scene/login/login'; -import { SignUpComponent } from './scene/sign-up/sign-up'; -import { ValidateEmailComponent } from './scene/validate-email/validate-email'; -import { HomeComponent } from './scene/home/home'; -import { TypeComponent } from './scene/type/type'; -import { UniversComponent } from './scene/univers/univers'; -import { GroupComponent } from './scene/group/group'; -import { SaisonComponent } from './scene/saison/saison'; -import { VideoComponent } from './scene/video/video'; -import { SettingsComponent } from './scene/settings/settings'; -import { ErrorViewerComponent } from './scene/error-viewer/error-viewer'; +import { HelpScene } from './scene/help/help'; +import { LoginScene } from './scene/login/login'; +import { SignUpScene } from './scene/sign-up/sign-up'; +import { ValidateEmailScene } from './scene/validate-email/validate-email'; +import { HomeScene } from './scene/home/home'; +import { TypeScene } from './scene/type/type'; +import { UniverseScene } from './scene/universe/universe'; +import { SeriesScene } from './scene/series/series'; +import { SeasonScene } from './scene/season/season'; +import { VideoScene } from './scene/video/video'; +import { SettingsScene } from './scene/settings/settings'; +import { ErrorViewerScene } from './scene/error-viewer/error-viewer'; import { ErrorComponent } from './error/error'; -import { VideoEditComponent } from './scene/video-edit/video-edit'; +import { VideoEditScene } from './scene/video-edit/video-edit'; import { UploadScene } from './scene/upload/upload'; -import { SaisonEditComponent } from './scene/saison-edit/saison-edit'; -import { GroupEditComponent } from './scene/group-edit/group-edit'; +import { SeasonEditScene } from './scene/season-edit/season-edit'; +import { SeriesEditScene } from './scene/series-edit/series-edit'; import { AuthService } from './service/auth'; import { ArianeService } from './service/ariane'; @@ -52,15 +52,17 @@ import { CookiesService } from './service/cookies'; import { HttpWrapperService } from './service/http-wrapper'; import { HttpOAuthWrapperService } from './service/http-oauth-wrapper'; import { UserService } from './service/user'; -import { UniversService } from './service/univers'; -import { GroupService } from './service/group'; +import { UniverseService } from './service/universe'; +import { SeriesService } from './service/series'; import { DataService } from './service/data'; import { TypeService } from './service/type'; -import { SaisonService } from './service/saison'; +import { SeasonService } from './service/season'; import { VideoService } from './service/video'; import { SessionService } from './service/session'; import { BddService } from './service/bdd'; import { PopInService } from './service/popin'; + + import { AppComponent } from './app.component'; @NgModule({ @@ -68,26 +70,26 @@ import { AppComponent } from './app.component'; AppComponent, TopMenuComponent, UploadFileComponent, - HelpComponent, + HelpScene, ElementTypeComponent, - ElementGroupComponent, - ElementSaisonComponent, + ElementSeriesComponent, + ElementSeasonComponent, ElementVideoComponent, - LoginComponent, - SignUpComponent, - ValidateEmailComponent, - HomeComponent, - TypeComponent, - UniversComponent, - GroupComponent, - SaisonComponent, - VideoComponent, - SettingsComponent, - ErrorViewerComponent, + LoginScene, + SignUpScene, + ValidateEmailScene, + HomeScene, + TypeScene, + UniverseScene, + SeriesScene, + SeasonScene, + VideoScene, + SettingsScene, + ErrorViewerScene, ErrorComponent, - VideoEditComponent, - SaisonEditComponent, - GroupEditComponent, + VideoEditScene, + SeasonEditScene, + SeriesEditScene, PopInComponent, PopInUploadProgress, CreateTypeComponent, @@ -115,9 +117,9 @@ import { AppComponent } from './app.component'; UserService, TypeService, DataService, - UniversService, - GroupService, - SaisonService, + UniverseService, + SeriesService, + SeasonService, VideoService, ArianeService ], diff --git a/front/src/app/component/element-saison/element-saison.html b/front/src/app/component/element-season/element-season.html similarity index 85% rename from front/src/app/component/element-saison/element-saison.html rename to front/src/app/component/element-season/element-season.html index 7f42188..d841dfd 100644 --- a/front/src/app/component/element-saison/element-saison.html +++ b/front/src/app/component/element-season/element-season.html @@ -7,8 +7,8 @@ -
- Saison {{numberSaison}} +
+ Season {{numberSeason}}
{{count}} Episodes diff --git a/front/src/app/component/element-saison/element-saison.less b/front/src/app/component/element-season/element-season.less similarity index 100% rename from front/src/app/component/element-saison/element-saison.less rename to front/src/app/component/element-season/element-season.less diff --git a/front/src/app/component/element-saison/element-saison.ts b/front/src/app/component/element-season/element-season.ts similarity index 65% rename from front/src/app/component/element-saison/element-saison.ts rename to front/src/app/component/element-season/element-season.ts index 1bdd170..43cb173 100644 --- a/front/src/app/component/element-saison/element-saison.ts +++ b/front/src/app/component/element-season/element-season.ts @@ -9,55 +9,55 @@ import { Injectable, Component, OnInit, Input } from '@angular/core'; import { Router } from "@angular/router"; import { ActivatedRoute, Params } from '@angular/router'; -import { SaisonService } from '../../service/saison'; +import { SeasonService } from '../../service/season'; @Component({ - selector: 'app-element-saison', - templateUrl: './element-saison.html', - styleUrls: ['./element-saison.less'] + selector: 'app-element-season', + templateUrl: './element-season.html', + styleUrls: ['./element-season.less'] }) @Injectable() -export class ElementSaisonComponent implements OnInit { +export class ElementSeasonComponent implements OnInit { // input parameters - @Input() id_saison:number = -1; + @Input() id_season:number = -1; error:string = ""; - numberSaison:number = -1; + numberSeason:number = -1; count:number = null; cover:string = ""; covers:Array = []; description:string = ""; constructor(private router: Router, - private saisonService: SaisonService) { + private seasonService: SeasonService) { } ngOnInit() { let self = this; - console.log("get saison properties id: " + this.id_saison); - this.saisonService.get(this.id_saison) + console.log("get season properties id: " + this.id_season); + this.seasonService.get(this.id_season) .then(function(response) { self.error = ""; - self.numberSaison = response.name; + self.numberSeason = response.name; self.description = response.description; if (response.covers == undefined || response.covers == null || response.covers.length == 0) { self.cover = null; //self.covers = []; } else { - self.cover = self.saisonService.getCoverThumbnailUrl(response.covers[0]); + self.cover = self.seasonService.getCoverThumbnailUrl(response.covers[0]); for (let iii=0; iii = []; constructor(private router: Router, - private groupService: GroupService) { + private seriesService: SeriesService) { } ngOnInit() { - this.name = "ll " + this.id_type + "+" + this.id_group + this.name = "ll " + this.id_type + "+" + this.id_series let self = this; console.log("get parameter id: " + this.id_type); - this.groupService.get(this.id_group) + this.seriesService.get(this.id_series) .then(function(response) { self.error = ""; self.name = response.name @@ -47,9 +47,9 @@ export class ElementGroupComponent implements OnInit { self.cover = null; //self.covers = []; } else { - self.cover = self.groupService.getCoverThumbnailUrl(response.covers[0]); + self.cover = self.seriesService.getCoverThumbnailUrl(response.covers[0]); for (let iii=0; iii -
/
+
/
-
/
+
/
-
/
+
/
--> -->
diff --git a/front/src/app/scene/group-edit/group-edit.less b/front/src/app/scene/season-edit/season-edit.less similarity index 100% rename from front/src/app/scene/group-edit/group-edit.less rename to front/src/app/scene/season-edit/season-edit.less diff --git a/front/src/app/scene/saison-edit/saison-edit.ts b/front/src/app/scene/season-edit/season-edit.ts similarity index 82% rename from front/src/app/scene/saison-edit/saison-edit.ts rename to front/src/app/scene/season-edit/season-edit.ts index cb3b1b5..b4d9a25 100644 --- a/front/src/app/scene/saison-edit/saison-edit.ts +++ b/front/src/app/scene/season-edit/season-edit.ts @@ -11,7 +11,7 @@ import { NgForm } from '@angular/forms'; import { FormGroup, FormControl } from "@angular/forms"; import { fadeInAnimation } from '../../_animations/index'; -import { SaisonService } from '../../service/saison'; +import { SeasonService } from '../../service/season'; import { DataService } from '../../service/data'; import { ArianeService } from '../../service/ariane'; @@ -25,15 +25,15 @@ export class ElementList { } @Component({ - selector: 'app-saison-edit', - templateUrl: './saison-edit.html', - styleUrls: ['./saison-edit.less'], + selector: 'app-season-edit', + templateUrl: './season-edit.html', + styleUrls: ['./season-edit.less'], animations: [fadeInAnimation], host: { '[@fadeInAnimation]': '' } }) // https://www.sitepoint.com/angular-forms/ -export class SaisonEditComponent implements OnInit { - id_saison:number = -1; +export class SeasonEditScene implements OnInit { + id_season:number = -1; error:string = ""; @@ -49,23 +49,23 @@ export class SaisonEditComponent implements OnInit { private router: Router, private locate: Location, private dataService: DataService, - private saisonService: SaisonService, + private seasonService: SeasonService, private arianeService: ArianeService) { } ngOnInit() { this.arianeService.updateManual(this.route.snapshot.paramMap); - this.id_saison = this.arianeService.getSaisonId(); + this.id_season = this.arianeService.getSeasonId(); let self = this; - this.saisonService.get(this.id_saison) + this.seasonService.get(this.id_season) .then(function(response) { - console.log("get response of saison : " + JSON.stringify(response, null, 2)); + console.log("get response of season : " + JSON.stringify(response, null, 2)); self.numberVal = response.number; self.description = response.description; if (response.covers !== undefined && response.covers !== null) { for (let iii=0; iii -
- {{group_name}} +
+ {{series_name}}
- Saison {{name}} + Season {{name}}
diff --git a/front/src/app/scene/group/group.less b/front/src/app/scene/season/season.less similarity index 100% rename from front/src/app/scene/group/group.less rename to front/src/app/scene/season/season.less diff --git a/front/src/app/scene/saison/saison.ts b/front/src/app/scene/season/season.ts similarity index 56% rename from front/src/app/scene/saison/saison.ts rename to front/src/app/scene/season/season.ts index 04547c7..0155133 100644 --- a/front/src/app/scene/saison/saison.ts +++ b/front/src/app/scene/season/season.ts @@ -9,79 +9,77 @@ import { Router, ActivatedRoute, ParamMap } from '@angular/router'; import { Location } from '@angular/common'; import { fadeInAnimation } from '../../_animations/index'; -import { SaisonService } from '../../service/saison'; -import { GroupService } from '../../service/group'; +import { SeasonService } from '../../service/season'; +import { SeriesService } from '../../service/series'; import { ArianeService } from '../../service/ariane'; -import { environment } from 'environments/environment'; @Component({ - selector: 'app-saison', - templateUrl: './saison.html', - styleUrls: ['./saison.less'], + selector: 'app-season', + templateUrl: './season.html', + styleUrls: ['./season.less'], animations: [fadeInAnimation], host: { '[@fadeInAnimation]': '' } }) - -export class SaisonComponent implements OnInit { +export class SeasonScene implements OnInit { name: string = ""; - group_name: string = ""; + series_name: string = ""; description: string = ""; - group_id: number = null; + series_id: number = null; cover: string = "" covers: Array = [] - id_saison = -1; + id_season = -1; videos_error = ""; videos = []; constructor(private route: ActivatedRoute, private router: Router, private locate: Location, - private saisonService: SaisonService, - private groupService: GroupService, + private seasonService: SeasonService, + private seriesService: SeriesService, private arianeService: ArianeService) { } ngOnInit() { - console.log("ngOnInit(SaisonComponent)"); + console.log("ngOnInit(SeasonComponent)"); this.arianeService.updateManual(this.route.snapshot.paramMap); - this.id_saison = this.arianeService.getSaisonId(); + this.id_season = this.arianeService.getSeasonId(); let self = this; - this.saisonService.get(this.id_saison) - .then(function(response) { + this.seasonService.get(this.id_season) + .then(function(response:any) { self.name = response.name; - self.group_id = response.parent_id; + self.series_id = response.parent_id; self.description = response.description; if (response.covers == undefined || response.covers == null || response.covers.length == 0) { self.cover = null; self.covers = []; } else { - self.cover = self.groupService.getCoverUrl(response.covers[0]); + self.cover = self.seriesService.getCoverUrl(response.covers[0]); for (let iii=0; iii
diff --git a/front/src/app/scene/saison-edit/saison-edit.less b/front/src/app/scene/series-edit/series-edit.less similarity index 100% rename from front/src/app/scene/saison-edit/saison-edit.less rename to front/src/app/scene/series-edit/series-edit.less diff --git a/front/src/app/scene/group-edit/group-edit.ts b/front/src/app/scene/series-edit/series-edit.ts similarity index 84% rename from front/src/app/scene/group-edit/group-edit.ts rename to front/src/app/scene/series-edit/series-edit.ts index 9bbefc1..2809e55 100644 --- a/front/src/app/scene/group-edit/group-edit.ts +++ b/front/src/app/scene/series-edit/series-edit.ts @@ -11,7 +11,7 @@ import { NgForm } from '@angular/forms'; import { FormGroup, FormControl } from "@angular/forms"; import { fadeInAnimation } from '../../_animations/index'; -import { GroupService } from '../../service/group'; +import { SeriesService } from '../../service/series'; import { DataService } from '../../service/data'; import { ArianeService } from '../../service/ariane'; @@ -25,15 +25,15 @@ export class ElementList { } @Component({ - selector: 'app-group-edit', - templateUrl: './group-edit.html', - styleUrls: ['./group-edit.less'], + selector: 'app-series-edit', + templateUrl: './series-edit.html', + styleUrls: ['./series-edit.less'], animations: [fadeInAnimation], host: { '[@fadeInAnimation]': '' } }) // https://www.sitepoint.com/angular-forms/ -export class GroupEditComponent implements OnInit { - id_group:number = -1; +export class SeriesEditScene implements OnInit { + id_series:number = -1; error:string = "" @@ -49,23 +49,23 @@ export class GroupEditComponent implements OnInit { private router: Router, private locate: Location, private dataService: DataService, - private groupService: GroupService, + private seriesService: SeriesService, private arianeService: ArianeService) { } ngOnInit() { this.arianeService.updateManual(this.route.snapshot.paramMap); - this.id_group = this.arianeService.getGroupId(); + this.id_series = this.arianeService.getSeriesId(); let self = this; - this.groupService.get(this.id_group) + this.seriesService.get(this.id_series) .then(function(response) { console.log("get response of video : " + JSON.stringify(response, null, 2)); self.name = response.name; self.description = response.description; if (response.covers !== undefined && response.covers !== null) { for (let iii=0; iii {{description}}
-
-
Saisons:
-
- +
+
Seasons:
+
+
diff --git a/front/src/app/scene/saison/saison.less b/front/src/app/scene/series/series.less similarity index 100% rename from front/src/app/scene/saison/saison.less rename to front/src/app/scene/series/series.less diff --git a/front/src/app/scene/group/group.ts b/front/src/app/scene/series/series.ts similarity index 62% rename from front/src/app/scene/group/group.ts rename to front/src/app/scene/series/series.ts index f59f820..e282c66 100644 --- a/front/src/app/scene/group/group.ts +++ b/front/src/app/scene/series/series.ts @@ -9,45 +9,44 @@ import { Router, ActivatedRoute, ParamMap } from '@angular/router'; import { Location } from '@angular/common'; import { fadeInAnimation } from '../../_animations/index'; -import { GroupService } from '../../service/group'; +import { SeriesService } from '../../service/series'; import { ArianeService } from '../../service/ariane'; -import { environment } from 'environments/environment'; @Component({ - selector: 'app-group', - templateUrl: './group.html', - styleUrls: ['./group.less'], + selector: 'app-series', + templateUrl: './series.html', + styleUrls: ['./series.less'], animations: [fadeInAnimation], host: { '[@fadeInAnimation]': '' } }) -export class GroupComponent implements OnInit { +export class SeriesScene implements OnInit { //id_type = -1; - //id_univers = -1; - id_group = -1; + //id_universe = -1; + id_series = -1; name: string = ""; description: string = ""; cover: string = "" covers: Array = [] - saisons_error: string = ""; - saisons: Array = []; + seasons_error: string = ""; + seasons: Array = []; videos_error: string = ""; videos: Array = []; constructor(private route: ActivatedRoute, private router: Router, private locate: Location, - private groupService: GroupService, + private seriesService: SeriesService, private arianeService: ArianeService) { } ngOnInit() { this.arianeService.updateManual(this.route.snapshot.paramMap); - //this.id_univers = parseInt(this.route.snapshot.paramMap.get('univers_id')); + //this.id_universe = parseInt(this.route.snapshot.paramMap.get('univers_id')); //this.id_type = parseInt(this.route.snapshot.paramMap.get('type_id')); - this.id_group = this.arianeService.getGroupId(); + this.id_series = this.arianeService.getSeriesId(); let self = this; - this.groupService.get(this.id_group) + this.seriesService.get(this.id_series) .then(function(response) { self.name = response.name; self.description = response.description; @@ -55,9 +54,9 @@ export class GroupComponent implements OnInit { self.cover = null; self.covers = []; } else { - self.cover = self.groupService.getCoverUrl(response.covers[0]); + self.cover = self.seriesService.getCoverUrl(response.covers[0]); for (let iii=0; iii
-
- +
+
diff --git a/front/src/app/scene/type/type.ts b/front/src/app/scene/type/type.ts index a06917e..c3bdc6c 100644 --- a/front/src/app/scene/type/type.ts +++ b/front/src/app/scene/type/type.ts @@ -11,7 +11,7 @@ import { fadeInAnimation } from '../../_animations/index'; import { TypeService } from '../../service/type'; import { ArianeService } from '../../service/ariane'; -import { environment } from 'environments/environment'; +import { environment } from '../../../environments/environment'; @Component({ selector: 'app-type', @@ -21,13 +21,13 @@ import { environment } from 'environments/environment'; host: { '[@fadeInAnimation]': '' } }) -export class TypeComponent implements OnInit { +export class TypeScene implements OnInit { type_id = -1; name: string = ""; description: string = ""; cover:string = null; - groups_error = ""; - groups = []; + seriess_error = ""; + seriess = []; videos_error = ""; videos = []; constructor(private route: ActivatedRoute, @@ -58,13 +58,13 @@ export class TypeComponent implements OnInit { self.name = "???"; self.description = ""; }); - this.typeService.getSubGroup(this.type_id, ["id", "name"]) + this.typeService.getSubSeries(this.type_id, ["id", "name"]) .then(function(response) { - self.groups_error = ""; - self.groups = response + self.seriess_error = ""; + self.seriess = response }).catch(function(response) { - self.groups_error = "Wrong e-mail/login or password"; - self.groups = [] + self.seriess_error = "Wrong e-mail/login or password"; + self.seriess = [] }); this.typeService.getSubVideo(this.type_id, ["id", "name"]) .then(function(response) { @@ -75,8 +75,8 @@ export class TypeComponent implements OnInit { self.videos = [] }); } - onSelectGroup(_event: any, _idSelected: number):void { - this.arianeService.navigateGroup(_idSelected, _event.which==2); + onSelectSeries(_event: any, _idSelected: number):void { + this.arianeService.navigateSeries(_idSelected, _event.which==2); } onSelectVideo(_event: any, _idSelected: number):void { diff --git a/front/src/app/scene/univers/univers.html b/front/src/app/scene/universe/universe.html similarity index 100% rename from front/src/app/scene/univers/univers.html rename to front/src/app/scene/universe/universe.html diff --git a/front/src/app/scene/univers/univers.less b/front/src/app/scene/universe/universe.less similarity index 100% rename from front/src/app/scene/univers/univers.less rename to front/src/app/scene/universe/universe.less diff --git a/front/src/app/scene/univers/univers.ts b/front/src/app/scene/universe/universe.ts similarity index 74% rename from front/src/app/scene/univers/univers.ts rename to front/src/app/scene/universe/universe.ts index bc404c4..e59b17d 100644 --- a/front/src/app/scene/univers/univers.ts +++ b/front/src/app/scene/universe/universe.ts @@ -9,43 +9,43 @@ import { Router, ActivatedRoute, ParamMap } from '@angular/router'; import { Location } from '@angular/common'; import { fadeInAnimation } from '../../_animations/index'; -import { UniversService } from '../../service/univers'; +import { UniverseService } from '../../service/universe'; import { ArianeService } from '../../service/ariane'; -import { environment } from 'environments/environment'; +import { environment } from '../../../environments/environment'; @Component({ - selector: 'app-univers', - templateUrl: './univers.html', - styleUrls: ['./univers.less'], + selector: 'app-universe', + templateUrl: './universe.html', + styleUrls: ['./universe.less'], animations: [fadeInAnimation], host: { '[@fadeInAnimation]': '' } }) -export class UniversComponent implements OnInit { - univers_id = -1; +export class UniverseScene implements OnInit { + universe_id = -1; videos_error = ""; videos = []; constructor(private route: ActivatedRoute, private router: Router, private locate: Location, - private universService: UniversService, + private universeService: UniverseService, private arianeService: ArianeService) { } ngOnInit() { this.arianeService.updateManual(this.route.snapshot.paramMap); - this.univers_id = this.arianeService.getUniversId(); + this.universe_id = this.arianeService.getUniverseId(); let self = this; - console.log("get parameter id: " + this.univers_id); + console.log("get parameter id: " + this.universe_id); /* - this.universService.getVideo(this.univers_id) + this.universeService.getVideo(this.univers_id) .then(function(response) { self.videos_error = ""; self.videos = response }).catch(function(response) { - self.videos_error = "Can not get the List of video without saison"; + self.videos_error = "Can not get the List of video without season"; self.videos = [] }); */ diff --git a/front/src/app/scene/upload/upload.html b/front/src/app/scene/upload/upload.html index a7a538e..b120947 100644 --- a/front/src/app/scene/upload/upload.html +++ b/front/src/app/scene/upload/upload.html @@ -78,8 +78,8 @@
@@ -88,15 +88,15 @@ ==>
- - +
@@ -108,9 +108,9 @@
diff --git a/front/src/app/scene/upload/upload.ts b/front/src/app/scene/upload/upload.ts index 08c1c95..a7ee306 100644 --- a/front/src/app/scene/upload/upload.ts +++ b/front/src/app/scene/upload/upload.ts @@ -16,8 +16,8 @@ import { HttpEventType, HttpResponse } from '@angular/common/http'; import { PopInService } from '../../service/popin'; import { TypeService } from '../../service/type'; -import { UniversService } from '../../service/univers'; -import { GroupService } from '../../service/group'; +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'; @@ -49,7 +49,7 @@ export class UploadScene implements OnInit { upload_file_value: string = "" selectedFiles: FileList; type_id: number = undefined - serie_id: number = undefined + series_id: number = undefined need_send: boolean = false; covers_display: Array = []; @@ -65,14 +65,14 @@ export class UploadScene implements OnInit { listType: ElementList[] = [ { value: undefined, label: '---' }, ]; - listUnivers: ElementList[] = [ + listUniverse: ElementList[] = [ { value: undefined, label: '---' }, { value: null, label: '---' }, ]; - listGroup: ElementList[] = [ + listSeries: ElementList[] = [ { value: undefined, label: '---' }, ]; - listGroup2 = [{ id: undefined, description: '---' }]; + listSeries2 = [{ id: undefined, description: '---' }]; /* config = { displayKey: "label", // if objects array passed which key to be displayed defaults to description @@ -92,12 +92,12 @@ export class UploadScene implements OnInit { searchPlaceholder: 'Search', // label thats displayed in search input, searchOnKey: 'description', // key on which search should be performed this will be selective search. if undefined this will be extensive search on all keys } - listSaison: ElementList[] = [ + listSeason: ElementList[] = [ { value: undefined, label: '---' }, ]; parse_universe: string = ""; - parse_serie: string = ""; - parse_saison: number = null; + parse_series: string = ""; + parse_season: number = null; parse_episode: number = null; parse_title: string = ""; constructor(private route: ActivatedRoute, @@ -105,8 +105,8 @@ export class UploadScene implements OnInit { private locate: Location, private dataService: DataService, private typeService: TypeService, - private universService: UniversService, - private groupService: GroupService, + private universeService: UniverseService, + private seriesService: SeriesService, private videoService: VideoService, private httpService: HttpWrapperService, private arianeService: ArianeService, @@ -134,13 +134,13 @@ export class UploadScene implements OnInit { this.id_video = this.arianeService.getVideoId(); let self = this; this.listType = [{ value: undefined, label: '---' }]; - this.listUnivers = [{ value: undefined, label: '---' }]; - this.listGroup = [{ value: undefined, label: '---' }]; - this.listSaison = [{ value: undefined, label: '---' }]; - this.universService.getData() + this.listUniverse = [{ value: undefined, label: '---' }]; + this.listSeries = [{ value: undefined, label: '---' }]; + this.listSeason = [{ value: undefined, label: '---' }]; + this.universeService.getData() .then(function (response2) { for (let iii = 0; iii < response2.length; iii++) { - self.listUnivers.push({ value: response2[iii].id, label: response2[iii].name }); + self.listUniverse.push({ value: response2[iii].id, label: response2[iii].name }); } }).catch(function (response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); @@ -153,12 +153,12 @@ export class UploadScene implements OnInit { }).catch(function (response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); }); - //this.groupService.getOrder() - this.groupService.getData() + //this.seriesService.getOrder() + this.seriesService.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("Get serie: " + response3[iii].id + ", label:" + response3[iii].name) + self.listSeries.push({ value: response3[iii].id, label: response3[iii].name }); + //console.log("Get series: " + response3[iii].id + ", label:" + response3[iii].name) } }).catch(function (response3) { console.log("get response3 : " + JSON.stringify(response3, null, 2)); @@ -170,13 +170,13 @@ export class UploadScene implements OnInit { self.data.name = response.name; self.data.description = response.description; self.data.episode = response.episode; - self.data.univers_id = response.univers_id; + self.data.universe_id = response.univers_id; self.data.data_id = response.data_id; self.data.time = response.time; self.data.generated_name = response.generated_name; self.onChangeType(response.type_id); - self.onChangeGroup(response.serie_id); - self.data.saison_id = response.saison_id; + self.onChangeSeries(response.series_id); + self.data.season_id = response.season_id; self.data_ori = self.data.clone(); if (response.covers !== undefined && response.covers !== null) { for (let iii = 0; iii < response.covers.length; iii++) { @@ -205,18 +205,18 @@ export class UploadScene implements OnInit { onChangeType (_value: any): void { console.log("Change requested of type ... " + _value); this.type_id = _value; - //this.data.serie_id = null; - //this.data.saison_id = null; - //this.listGroup = [{value: undefined, label: '---'}]; - //this.listSaison = [{value: undefined, label: '---'}]; + //this.data.series_id = null; + //this.data.season_id = null; + //this.listSeries = [{value: undefined, label: '---'}]; + //this.listSeason = [{value: undefined, label: '---'}]; let self = this; this.updateNeedSend(); /* if (this.type_id != undefined) { - self.typeService.getSubGroup(this.type_id, ["id", "name"]) + self.typeService.getSubSeries(this.type_id, ["id", "name"]) .then(function(response2) { for(let iii= 0; iii < response2.length; iii++) { - self.listGroup.push({value: response2[iii].id, label: response2[iii].name}); + self.listSeries.push({value: response2[iii].id, label: response2[iii].name}); } }).catch(function(response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); @@ -225,22 +225,22 @@ export class UploadScene implements OnInit { */ } - onChangeGroup (_value: any): void { - this.serie_id = _value; + onChangeSeries (_value: any): void { + this.series_id = _value; if (_value === undefined || _value === null) { } else { - for (let iii = 0 ; iii=2) { - this.parse_serie = splitElement[0]; + this.parse_series = splitElement[0]; } splitElement.splice(0,1); if (splitElement.length == 1) { @@ -318,10 +318,10 @@ export class UploadScene implements OnInit { while (splitElement.length>0) { let element = splitElement[0]; let find = false; - if (this.parse_saison == null) { + if (this.parse_season == null) { if (element.length >= 1 && (element[0] == 's' || element[0] == 'S') ) { element = element.substring(1); - this.parse_saison = parseInt(element, 10); + this.parse_season = parseInt(element, 10); find = true; } } @@ -333,7 +333,7 @@ export class UploadScene implements OnInit { } } if (find == false) { - if (this.parse_saison == null && this.parse_episode == null) { + if (this.parse_season == null && this.parse_episode == null) { if (this.parse_universe == "") { this.parse_universe = element; } else { @@ -357,11 +357,11 @@ export class UploadScene implements OnInit { this.updateNeedSend(); let self = this; - if (this.parse_serie != "") { - this.groupService.getLike(this.parse_serie) + if (this.parse_series != "") { + this.seriesService.getLike(this.parse_series) .then(function(response) { console.log("find elemet: " + response.name + " " + response.id); - self.serie_id = response.id; + self.series_id = response.id; }).catch(function(response) { console.log("CAN NOT find element: " ); }); @@ -378,34 +378,34 @@ export class UploadScene implements OnInit { let self = this; /* - this.parse_serie = ""; - this.parse_saison = null; + this.parse_series = ""; + this.parse_season = null; this.parse_episode = null; this.parse_title = ""; */ - // clean uopload labels + // clean upload labels this.uploadMediaSendSize = 0; this.uploadMediaSize = 0; this.uploadLabelMediaTitle = ""; this.uploadResult = null; this.uploadError = null; - // add univers + // add universe if (this.parse_universe != null) { this.uploadLabelMediaTitle += this.parse_universe; } - // add serie - if (this.parse_serie != null) { + // add series + if (this.parse_series != null) { if (this.uploadLabelMediaTitle.length != 0) { this.uploadLabelMediaTitle += "/"; } - this.uploadLabelMediaTitle += this.parse_serie; + this.uploadLabelMediaTitle += this.parse_series; } - // add saison - if (this.parse_saison != null) { + // add season + if (this.parse_season != null) { if (this.uploadLabelMediaTitle.length != 0) { this.uploadLabelMediaTitle += "-"; } - this.uploadLabelMediaTitle += "s" + this.parse_saison.toString(); + this.uploadLabelMediaTitle += "s" + this.parse_season.toString(); } // add episode ID if (this.parse_episode != null) { @@ -423,8 +423,8 @@ export class UploadScene implements OnInit { this.popInService.open("popin-upload-progress"); this.videoService.uploadFile(_file, this.parse_universe, - this.parse_serie, - this.parse_saison, + this.parse_series, + this.parse_season, this.parse_episode, this.parse_title, this.type_id, @@ -458,38 +458,38 @@ export class UploadScene implements OnInit { }); } - eventPopUpSaison (_event: string): void { + eventPopUpSeason (_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-saison"); + this.popInService.close("popin-new-season"); } - eventPopUpSerie (_event: string): void { + eventPopUpSeries (_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-serie"); + this.popInService.close("popin-new-series"); } eventPopUpType (_event: string): void { console.log("GET event: " + _event); this.popInService.close("popin-new-type"); } - eventPopUpUnivers (_event: string): void { + eventPopUpUniverse (_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-univers"); + this.popInService.close("popin-new-universe"); } - newSaison (): void { - console.log("Request new Saison..."); - this.popInService.open("popin-new-saison"); + newSeason (): void { + console.log("Request new Season..."); + this.popInService.open("popin-new-season"); } - newSerie (): void { - console.log("Request new Serie..."); - this.popInService.open("popin-new-serie"); + newSeries (): void { + console.log("Request new Series..."); + this.popInService.open("popin-new-series"); } newType (): void { console.log("Request new Type..."); this.popInService.open("popin-create-type"); } - newUnivers () { - console.log("Request new Univers..."); - this.popInService.open("popin-new-univers"); + newUniverse () { + console.log("Request new Universe..."); + this.popInService.open("popin-new-universe"); } } diff --git a/front/src/app/scene/validate-email/validate-email.ts b/front/src/app/scene/validate-email/validate-email.ts index edfe408..335e117 100644 --- a/front/src/app/scene/validate-email/validate-email.ts +++ b/front/src/app/scene/validate-email/validate-email.ts @@ -7,7 +7,7 @@ import { ArianeService } from '../../service/ariane'; templateUrl: './validate-email.html', styleUrls: ['./validate-email.less'] }) -export class ValidateEmailComponent implements OnInit { +export class ValidateEmailScene implements OnInit { constructor(private route: ActivatedRoute, private arianeService: ArianeService diff --git a/front/src/app/scene/video-edit/video-edit.html b/front/src/app/scene/video-edit/video-edit.html index 8e1e7a4..2d315bc 100644 --- a/front/src/app/scene/video-edit/video-edit.html +++ b/front/src/app/scene/video-edit/video-edit.html @@ -57,48 +57,48 @@
- Univers: + Universe:
- +
-
- Serie: + Series:
- +
-
- Saison: + Season:
- +
-
@@ -170,38 +170,46 @@ - + + + + (callback)="eventPopUpSeason($event[0])">

Name:

- + (callback)="eventPopUpSeries($event[0])">

Name:

- + (callback)="eventPopUpUniverse($event[0])">

Name:

+ diff --git a/front/src/app/scene/video-edit/video-edit.ts b/front/src/app/scene/video-edit/video-edit.ts index 84d61a9..81ccb70 100644 --- a/front/src/app/scene/video-edit/video-edit.ts +++ b/front/src/app/scene/video-edit/video-edit.ts @@ -16,8 +16,9 @@ import { HttpEventType, HttpResponse} from '@angular/common/http'; import { PopInService } from '../../service/popin'; import { TypeService } from '../../service/type'; -import { UniversService } from '../../service/univers'; -import { GroupService } from '../../service/group'; +import { UniverseService } from '../../service/universe'; +import { SeriesService } from '../../service/series'; +import { SeasonService } from '../../service/season'; import { VideoService } from '../../service/video'; import { DataService } from '../../service/data'; import { ArianeService } from '../../service/ariane'; @@ -36,12 +37,12 @@ class DataToSend { name:string = "" description:string = "" episode:number = undefined - univers_id:number = undefined - serie_id:number = undefined - saison_id:number = undefined + universe_id:number = null + series_id:number = null + season_id:number = null data_id:number = -1 time:number = undefined - type_id:number = undefined + type_id:number = null covers:Array = []; generated_name:string = "" clone() { @@ -49,9 +50,9 @@ class DataToSend { tmp.name = this.name tmp.description = this.description tmp.episode = this.episode - tmp.univers_id = this.univers_id - tmp.serie_id = this.serie_id - tmp.saison_id = this.saison_id + tmp.universe_id = this.universe_id + tmp.series_id = this.series_id + tmp.season_id = this.season_id tmp.data_id = this.data_id tmp.time = this.time tmp.type_id = this.type_id @@ -69,7 +70,7 @@ class DataToSend { host: { '[@fadeInAnimation]': '' } }) // https://www.sitepoint.com/angular-forms/ -export class VideoEditComponent implements OnInit { +export class VideoEditScene implements OnInit { id_video:number = -1; error:string = "" @@ -81,19 +82,28 @@ export class VideoEditComponent implements OnInit { selectedFiles:FileList; need_send:boolean = false; + + // section tha define the upload value to display in the pop-in of upload + uploadLabelMediaTitle: string = ""; + uploadMediaSendSize: number = 0; + uploadMediaSize: number = 0; + uploadResult: string = null; + uploadError: string = null; + + covers_display:Array = []; listType: ElementList[] = [ {value: undefined, label: '---'}, ]; - listUnivers: ElementList[] = [ + listUniverse: ElementList[] = [ {value: undefined, label: '---'}, {value: null, label: '---'}, ]; - listGroup: ElementList[] = [ + listSeries: ElementList[] = [ {value: undefined, label: '---'}, ]; - listSaison: ElementList[] = [ + listSeason: ElementList[] = [ {value: undefined, label: '---'}, ]; constructor(private route: ActivatedRoute, @@ -101,8 +111,9 @@ export class VideoEditComponent implements OnInit { private locate: Location, private dataService: DataService, private typeService: TypeService, - private universService: UniversService, - private groupService: GroupService, + private universeService: UniverseService, + private seriesService: SeriesService, + private seasonService: SeasonService, private videoService: VideoService, private httpService: HttpWrapperService, private arianeService: ArianeService, @@ -127,30 +138,45 @@ export class VideoEditComponent implements OnInit { if (this.data.type_id != this.data_ori.type_id) { this.need_send = true; } - if (this.data.univers_id != this.data_ori.univers_id) { + if (this.data.universe_id != this.data_ori.universe_id) { this.need_send = true; } - if (this.data.serie_id != this.data_ori.serie_id) { + if (this.data.series_id != this.data_ori.series_id) { this.need_send = true; } - if (this.data.saison_id != this.data_ori.saison_id) { + if (this.data.season_id != this.data_ori.season_id) { this.need_send = true; } return this.need_send; } - + + updateCoverList(_covers: any) { + this.covers_display = []; + this.data.covers = []; + if (_covers !== undefined && _covers !== null) { + for (let iii=0; iii<_covers.length; iii++) { + this.data.covers.push(_covers[iii]); + this.covers_display.push({ + id:_covers[iii], + url:this.videoService.getCoverThumbnailUrl(_covers[iii]) + }); + } + } else { + this.covers_display = [] + } + } ngOnInit() { this.arianeService.updateManual(this.route.snapshot.paramMap); this.id_video = this.arianeService.getVideoId(); let self = this; - this.listType = [{value: undefined, label: '---'}]; - this.listUnivers = [{value: undefined, label: '---'}]; - this.listGroup = [{value: undefined, label: '---'}]; - this.listSaison = [{value: undefined, label: '---'}]; - this.universService.getData() + this.listType = [{value: null, label: '---'}]; + this.listUniverse = [{value: null, label: '---'}]; + this.listSeries = [{value: null, label: '---'}]; + this.listSeason = [{value: null, label: '---'}]; + this.universeService.getData() .then(function(response2) { for(let iii= 0; iii < response2.length; iii++) { - self.listUnivers.push({value: response2[iii].id, label: response2[iii].name}); + self.listUniverse.push({value: response2[iii].id, label: response2[iii].name}); } }).catch(function(response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); @@ -163,12 +189,12 @@ export class VideoEditComponent implements OnInit { }).catch(function(response2) { console.log("get response22 : " + JSON.stringify(response2, null, 2)); }); - //this.groupService.getOrder() - this.groupService.getData() + //this.seriesService.getOrder() + this.seriesService.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) + self.listSeries.push({value: response3[iii].id, label: response3[iii].name}); + console.log("[" + self.data.data_id + "] Get series: " + response3[iii].id + ", label:" + response3[iii].name) } }).catch(function(response3) { console.log("get response3 : " + JSON.stringify(response3, null, 2)); @@ -179,25 +205,27 @@ export class VideoEditComponent implements OnInit { self.data.name = response.name; self.data.description = response.description; self.data.episode = response.episode; - self.data.univers_id = response.univers_id; + self.data.universe_id = response.univers_id; + if (self.data.universe_id === undefined) { + self.data.universe_id = null; + } self.data.data_id = response.data_id; self.data.time = response.time; self.data.generated_name = response.generated_name; self.onChangeType(response.type_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 update data ... + self.updateCoverList(response.covers); + }).catch(function (response:any) { + //self.error = "Can not get the data"; + console.log("Can not add the cover in the video..."); + self.uploadError = "Error in the upload of the cover..." + JSON.stringify(response, null, 2); + }); } - removeCover(_id) { + removeCover(_id:number) { console.log("Request remove cover: " + _id); + let self = this; + this.videoService.deleteCover(this.id_video, _id) + .then(function (response:any) { + console.log("get response of remove cover : " + JSON.stringify(response, null, 2)); + self.uploadResult = "Cover remove done"; + // TODO: we retrive the whiole media ==> update data ... + self.updateCoverList(response.covers); + }).catch(function (response:any) { + //self.error = "Can not get the data"; + console.log("Can not remove the cover of the video..."); + self.uploadError = "Error in the upload of the cover..." + JSON.stringify(response, null, 2); + }); } removeMedia() { console.log("Request remove Media..."); @@ -390,38 +457,38 @@ export class VideoEditComponent implements OnInit { }); } - eventPopUpSaison(_event: string): void { + eventPopUpSeason(_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-saison"); + this.popInService.close("popin-new-season"); } - eventPopUpSerie(_event: string): void { + eventPopUpSeries(_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-serie"); + this.popInService.close("popin-new-series"); } eventPopUpType(_event: string): void { console.log("GET event: " + _event); this.popInService.close("popin-new-type"); } - eventPopUpUnivers(_event: string): void { + eventPopUpUniverse(_event: string): void { console.log("GET event: " + _event); - this.popInService.close("popin-new-univers"); + this.popInService.close("popin-new-universe"); } - newSaison(): void { - console.log("Request new Saison..."); - this.popInService.open("popin-new-saison"); + newSeason(): void { + console.log("Request new Season..."); + this.popInService.open("popin-new-season"); } - newSerie(): void { - console.log("Request new Serie..."); - this.popInService.open("popin-new-serie"); + newSeries(): void { + console.log("Request new Series..."); + this.popInService.open("popin-new-series"); } newType(): void { console.log("Request new Type..."); this.popInService.open("popin-create-type"); } - newUnivers() { - console.log("Request new Univers..."); - this.popInService.open("popin-new-univers"); + newUniverse() { + console.log("Request new Universe..."); + this.popInService.open("popin-new-universe"); } } diff --git a/front/src/app/scene/video/video.html b/front/src/app/scene/video/video.html index 415dff7..b5475f4 100644 --- a/front/src/app/scene/video/video.html +++ b/front/src/app/scene/video/video.html @@ -6,11 +6,11 @@
-
- Serie: {{group_name}} +
+ Series: {{series_name}}
-
- Saison: {{saison_name}} +
+ Season: {{season_name}}
Episode: {{episode}} diff --git a/front/src/app/scene/video/video.ts b/front/src/app/scene/video/video.ts index cd59541..b20423e 100644 --- a/front/src/app/scene/video/video.ts +++ b/front/src/app/scene/video/video.ts @@ -10,8 +10,8 @@ import { Location } from '@angular/common'; import { fadeInAnimation } from '../../_animations/index'; import { HttpWrapperService } from '../../service/http-wrapper'; import { VideoService } from '../../service/video'; -import { GroupService } from '../../service/group'; -import { SaisonService } from '../../service/saison'; +import { SeriesService } from '../../service/series'; +import { SeasonService } from '../../service/season'; import { ArianeService } from '../../service/ariane'; @Component({ @@ -22,7 +22,7 @@ import { ArianeService } from '../../service/ariane'; host: { '[@fadeInAnimation]': '' } }) -export class VideoComponent implements OnInit { +export class VideoScene implements OnInit { id_video:number = -1; error:string = "" @@ -30,10 +30,10 @@ export class VideoComponent implements OnInit { name:string = "" description:string = "" episode:number = undefined - group_id:number = undefined - group_name:string = undefined - saison_id:number = undefined - saison_name:string = undefined + series_id:number = undefined + series_name:string = undefined + season_id:number = undefined + season_name:string = undefined data_id:number = -1 time:number = undefined type_id:number = undefined @@ -46,8 +46,8 @@ export class VideoComponent implements OnInit { private router: Router, private locate: Location, private videoService: VideoService, - private groupService: GroupService, - private saisonService: SaisonService, + private seriesService: SeriesService, + private seasonService: SeasonService, private httpService: HttpWrapperService, private arianeService: ArianeService) { @@ -55,14 +55,14 @@ export class VideoComponent implements OnInit { generateName() { this.generated_name = ""; - if (this.group_name != undefined) { - this.generated_name += this.group_name + "-"; + if (this.series_name != undefined) { + this.generated_name += this.series_name + "-"; } - if (this.saison_name != undefined) { - if (this.saison_name.length < 2) { - this.generated_name += "s0" + this.saison_name + "-"; + if (this.season_name != undefined) { + if (this.season_name.length < 2) { + this.generated_name += "s0" + this.season_name + "-"; } else { - this.generated_name += "s" + this.saison_name + "-"; + this.generated_name += "s" + this.season_name + "-"; } } if (this.episode != undefined) { @@ -87,8 +87,8 @@ export class VideoComponent implements OnInit { self.name = response.name; self.description = response.description; self.episode = response.episode; - self.group_id = response.serie_id; - self.saison_id = response.saison_id; + self.series_id = response.series_id; + self.season_id = response.season_id; self.data_id = response.data_id; self.time = response.time; self.generated_name = response.generated_name; @@ -106,19 +106,19 @@ export class VideoComponent implements OnInit { } } self.generateName(); - if (self.group_id !== undefined && self.group_id !== null) { - self.groupService.get(self.group_id) + if (self.series_id !== undefined && self.series_id !== null) { + self.seriesService.get(self.series_id) .then(function(response) { - self.group_name = response.name; + self.series_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) + if (self.season_id !== undefined && self.season_id !== null) { + self.seasonService.get(self.season_id) .then(function(response) { - self.saison_name = response.name; + self.season_name = response.name; self.generateName(); }).catch(function(response) { // nothing to do ... @@ -131,15 +131,15 @@ export class VideoComponent implements OnInit { self.name = ""; self.description = ""; self.episode = undefined; - self.group_id = undefined; - self.saison_id = undefined; + self.series_id = undefined; + self.season_id = undefined; self.data_id = -1; self.time = undefined; self.generated_name = ""; self.video_source = ""; self.cover = null; - self.group_name = undefined; - self.saison_name = undefined; + self.series_name = undefined; + self.season_name = undefined; }); } diff --git a/front/src/app/service/ariane.ts b/front/src/app/service/ariane.ts index 0162ac9..4fee966 100644 --- a/front/src/app/service/ariane.ts +++ b/front/src/app/service/ariane.ts @@ -8,18 +8,18 @@ import { Injectable, Output, EventEmitter, OnInit} from '@angular/core' import { Router, ActivatedRoute, ParamMap, NavigationEnd } from '@angular/router'; -import { TypeService } from 'app/service/type'; -import { UniversService } from 'app/service/univers'; -import { GroupService } from 'app/service/group'; -import { SaisonService } from 'app/service/saison'; -import { VideoService } from 'app/service/video'; -import { environment } from 'environments/environment'; +import { TypeService } from './type'; +import { UniverseService } from './universe'; +import { SeriesService } from './series'; +import { SeasonService } from './season'; +import { VideoService } from './video'; +import { environment } from '../../environments/environment'; export class InputOrders { public type_id: number = null; - public univers_id: number = null; - public group_id: number = null; - public saison_id: number = null; + public universe_id: number = null; + public series_id: number = null; + public season_id: number = null; public video_id: number = null; } @@ -31,17 +31,17 @@ export class ArianeService { public type_name: string = null; @Output() type_change: EventEmitter = new EventEmitter(); - public univers_id: number = null; - public univers_name: string = null; - @Output() univers_change: EventEmitter = new EventEmitter(); + public universe_id: number = null; + public universe_name: string = null; + @Output() universe_change: EventEmitter = new EventEmitter(); - public group_id: number = null; - public group_name: string = null; - @Output() group_change: EventEmitter = new EventEmitter(); + public series_id: number = null; + public series_name: string = null; + @Output() series_change: EventEmitter = new EventEmitter(); - public saison_id: number = null; - public saison_name: string = null; - @Output() saison_change: EventEmitter = new EventEmitter(); + public season_id: number = null; + public season_name: string = null; + @Output() season_change: EventEmitter = new EventEmitter(); public video_id: number = null; public video_name: string = null; @@ -50,9 +50,9 @@ export class ArianeService { constructor(private route: ActivatedRoute, private router: Router, private typeService: TypeService, - private universService: UniversService, - private groupService: GroupService, - private saisonService: SaisonService, + private universeService: UniverseService, + private seriesService: SeriesService, + private seasonService: SeasonService, private videoService: VideoService) { console.log("Start ArianeService"); } @@ -75,29 +75,29 @@ export class ArianeService { } console.log("type_id = " + type_id + " " + params.get('type_id')); - let univers_id = params.get('univers_id'); - if (univers_id === null || univers_id === undefined || univers_id == "null" || univers_id == "NULL" || univers_id == "") { - univers_id = null; + let universe_id = params.get('universe_id'); + if (universe_id === null || universe_id === undefined || universe_id == "null" || universe_id == "NULL" || universe_id == "") { + universe_id = null; } else { - univers_id = parseInt(univers_id) + universe_id = parseInt(universe_id) } - console.log("univers_id = " + univers_id + " " + params.get('univers_id')); + console.log("universe_id = " + universe_id + " " + params.get('univers_id')); - let group_id = params.get('group_id'); - if (group_id === null || group_id === undefined || group_id == "null" || group_id == "NULL" || group_id == "") { - group_id = null; + let series_id = params.get('series_id'); + if (series_id === null || series_id === undefined || series_id == "null" || series_id == "NULL" || series_id == "") { + series_id = null; } else { - group_id = parseInt(group_id) + series_id = parseInt(series_id) } - console.log("group_id = " + group_id + " " + params.get('group_id')); + console.log("series_id = " + series_id + " " + params.get('series_id')); - let saison_id = params.get('saison_id'); - if (saison_id === null || saison_id === undefined || saison_id == "null" || saison_id == "NULL" || saison_id == "") { - saison_id = null; + let season_id = params.get('season_id'); + if (season_id === null || season_id === undefined || season_id == "null" || season_id == "NULL" || season_id == "") { + season_id = null; } else { - saison_id = parseInt(saison_id) + season_id = parseInt(season_id) } - console.log("saison_id = " + saison_id + " " + params.get('saison_id')); + console.log("season_id = " + season_id + " " + params.get('season_id')); let video_id = params.get('video_id'); if (video_id === null || video_id === undefined || video_id == "null" || video_id == "NULL" || video_id == "") { @@ -108,24 +108,24 @@ export class ArianeService { console.log("video_id = " + video_id + " " + params.get('video_id')); this.setType(type_id); - this.setUnivers(univers_id); - this.setGroup(group_id); - this.setSaison(saison_id); + this.setUniverse(universe_id); + this.setSeries(series_id); + this.setSeason(season_id); this.setVideo(video_id); } reset():void { this.type_id = null; this.type_name = null; this.type_change.emit(this.type_id); - this.univers_id = null; - this.univers_name = null; - this.univers_change.emit(this.univers_id); - this.group_id = null; - this.group_name = null; - this.group_change.emit(this.group_id); - this.saison_id = null; - this.saison_name = null; - this.saison_change.emit(this.saison_id); + this.universe_id = null; + this.universe_name = null; + this.universe_change.emit(this.universe_id); + this.series_id = null; + this.series_name = null; + this.series_change.emit(this.series_id); + this.season_id = null; + this.season_name = null; + this.season_change.emit(this.season_id); this.video_id = null; this.video_name = null; this.video_change.emit(this.video_id); @@ -137,17 +137,17 @@ export class ArianeService { if (out.type_id == 0){ out.type_id = undefined; } - out.univers_id = parseInt(this.route.snapshot.paramMap.get('univers_id')); - if (out.univers_id == 0){ - out.univers_id = undefined; + out.universe_id = parseInt(this.route.snapshot.paramMap.get('univers_id')); + if (out.universe_id == 0){ + out.universe_id = undefined; } - out.group_id = parseInt(this.route.snapshot.paramMap.get('group_id')); - if (out.group_id == 0){ - out.group_id = undefined; + out.series_id = parseInt(this.route.snapshot.paramMap.get('series_id')); + if (out.series_id == 0){ + out.series_id = undefined; } - out.saison_id = parseInt(this.route.snapshot.paramMap.get('saison_id')); - if (out.saison_id == 0){ - out.saison_id = undefined; + out.season_id = parseInt(this.route.snapshot.paramMap.get('season_id')); + if (out.season_id == 0){ + out.season_id = undefined; } out.video_id = parseInt(this.route.snapshot.paramMap.get('video_id')); if (out.video_id == 0){ @@ -159,7 +159,7 @@ export class ArianeService { routeTo(_data:InputOrders, _destination:string = null) { routeTo = "" //if ( - this.router.navigate(['/type/' + this.type_id + '/group/' + this.id_group + '/saison/' + _idSelected ]); + this.router.navigate(['/type/' + this.type_id + '/series/' + this.id_series + '/season/' + _idSelected ]); } */ @@ -192,92 +192,92 @@ export class ArianeService { return this.type_name; } - setUnivers(_id:number) { - if (this.univers_id == _id) { + setUniverse(_id:number) { + if (this.universe_id == _id) { return; } if (_id === undefined) { return; } - this.univers_id = _id; - this.univers_name = "??--??"; - if (this.univers_id === null) { - this.univers_change.emit(this.univers_id); + this.universe_id = _id; + this.universe_name = "??--??"; + if (this.universe_id === null) { + this.universe_change.emit(this.universe_id); return; } let self = this; - this.universService.get(_id) + this.universeService.get(_id) .then(function(response) { - self.univers_name = response.number - self.univers_change.emit(self.univers_id); + self.universe_name = response.number + self.universe_change.emit(self.universe_id); }).catch(function(response) { - self.univers_change.emit(self.univers_id); + self.universe_change.emit(self.universe_id); }); } - getUniversId():number { - return this.univers_id; + getUniverseId():number { + return this.universe_id; } - getUniversName():string { - return this.univers_name; + getUniverseName():string { + return this.universe_name; } - setGroup(_id:number):void { - if (this.group_id == _id) { + setSeries(_id:number):void { + if (this.series_id == _id) { return; } if (_id === undefined) { return; } - this.group_id = _id; - this.group_name = "??--??"; - if (this.group_id === null) { - this.group_change.emit(this.group_id); + this.series_id = _id; + this.series_name = "??--??"; + if (this.series_id === null) { + this.series_change.emit(this.series_id); return; } let self = this; - this.groupService.get(_id) + this.seriesService.get(_id) .then(function(response) { - self.group_name = response.name - self.group_change.emit(self.group_id); + self.series_name = response.name + self.series_change.emit(self.series_id); }).catch(function(response) { - self.group_change.emit(self.group_id); + self.series_change.emit(self.series_id); }); } - getGroupId():number { - return this.group_id; + getSeriesId():number { + return this.series_id; } - getGroupName():string { - return this.group_name; + getSeriesName():string { + return this.series_name; } - setSaison(_id:number):void { - if (this.saison_id == _id) { + setSeason(_id:number):void { + if (this.season_id == _id) { return; } if (_id === undefined) { return; } - this.saison_id = _id; - this.saison_name = "??--??"; - if (this.saison_id === null) { - this.saison_change.emit(this.saison_id); + this.season_id = _id; + this.season_name = "??--??"; + if (this.season_id === null) { + this.season_change.emit(this.season_id); return; } let self = this; - this.saisonService.get(_id) + this.seasonService.get(_id) .then(function(response) { - //self.setGroup(response.group_id); - self.saison_name = response.name - self.saison_change.emit(self.saison_id); + //self.setSeries(response.series_id); + self.season_name = response.name + self.season_change.emit(self.season_id); }).catch(function(response) { - self.saison_change.emit(self.saison_id); + self.season_change.emit(self.season_id); }); } - getSaisonId():number { - return this.saison_id; + getSeasonId():number { + return this.season_id; } - getSaisonName():string { - return this.saison_name; + getSeasonName():string { + return this.season_name; } setVideo(_id:number):void { @@ -296,8 +296,8 @@ export class ArianeService { let self = this; this.videoService.get(_id) .then(function(response) { - //self.setSaison(response.saison_id); - //self.setGroup(response.group_id); + //self.setSeason(response.season_id); + //self.setSeries(response.series_id); self.video_name = response.name; self.video_change.emit(self.video_id); }).catch(function(response) { @@ -311,8 +311,8 @@ export class ArianeService { return this.video_name; } - genericNavigate(_destination:string, _universId:number, _typeId:number, _groupId:number, _saisonId:number, _videoId:number, _newWindows:boolean):void { - let addressOffset = _destination + '/' + _universId + '/' + _typeId + '/' + _groupId + '/' + _saisonId + '/' + _videoId; + genericNavigate(_destination:string, _universeId:number, _typeId:number, _seriesId:number, _seasonId:number, _videoId:number, _newWindows:boolean):void { + let addressOffset = _destination + '/' + _universeId + '/' + _typeId + '/' + _seriesId + '/' + _seasonId + '/' + _videoId; if(_newWindows==true) { if (environment.frontBaseUrl === undefined || environment.frontBaseUrl === null || environment.frontBaseUrl === "") { window.open('/' + addressOffset); @@ -324,35 +324,35 @@ export class ArianeService { } } - navigateUnivers(_id:number, _newWindows:boolean):void { - this.genericNavigate('univers', _id, this.type_id, null, null, null, _newWindows); + navigateUniverse(_id:number, _newWindows:boolean):void { + this.genericNavigate('universe', _id, this.type_id, null, null, null, _newWindows); } - navigateUniversEdit(_id:number, _newWindows:boolean):void { - this.genericNavigate('univers-edit', _id, this.type_id, null, null, null, _newWindows); + navigateUniverseEdit(_id:number, _newWindows:boolean):void { + this.genericNavigate('universe-edit', _id, this.type_id, null, null, null, _newWindows); } navigateType(_id:number, _newWindows:boolean):void { - this.genericNavigate('type', this.univers_id, _id, null, null, null, _newWindows); + this.genericNavigate('type', this.universe_id, _id, null, null, null, _newWindows); } navigateTypeEdit(_id:number, _newWindows:boolean):void { - this.genericNavigate('type-edit', this.univers_id, _id, null, null, null, _newWindows); + this.genericNavigate('type-edit', this.universe_id, _id, null, null, null, _newWindows); } - navigateGroup(_id:number, _newWindows:boolean):void { - this.genericNavigate('group', this.univers_id, this.type_id, _id, null, null, _newWindows); + navigateSeries(_id:number, _newWindows:boolean):void { + this.genericNavigate('series', this.universe_id, this.type_id, _id, null, null, _newWindows); } - navigateGroupEdit(_id:number, _newWindows:boolean):void { - this.genericNavigate('group-edit', this.univers_id, this.type_id, _id, null, null, _newWindows); + navigateSeriesEdit(_id:number, _newWindows:boolean):void { + this.genericNavigate('series-edit', this.universe_id, this.type_id, _id, null, null, _newWindows); } - navigateSaison(_id:number, _newWindows:boolean):void { - this.genericNavigate('saison', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows); + navigateSeason(_id:number, _newWindows:boolean):void { + this.genericNavigate('season', this.universe_id, this.type_id, this.series_id, _id, null, _newWindows); } - navigateSaisonEdit(_id:number, _newWindows:boolean):void { - this.genericNavigate('saison-edit', this.univers_id, this.type_id, this.group_id, _id, null, _newWindows); + navigateSeasonEdit(_id:number, _newWindows:boolean):void { + this.genericNavigate('season-edit', this.universe_id, this.type_id, this.series_id, _id, null, _newWindows); } navigateVideo(_id:number, _newWindows:boolean):void { - this.genericNavigate('video', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows); + this.genericNavigate('video', this.universe_id, this.type_id, this.series_id, this.season_id, _id, _newWindows); } navigateVideoEdit(_id:number, _newWindows:boolean):void { - this.genericNavigate('video-edit', this.univers_id, this.type_id, this.group_id, this.saison_id, _id, _newWindows); + this.genericNavigate('video-edit', this.universe_id, this.type_id, this.series_id, this.season_id, _id, _newWindows); } diff --git a/front/src/app/service/bdd.ts b/front/src/app/service/bdd.ts index c9593f5..4780aeb 100644 --- a/front/src/app/service/bdd.ts +++ b/front/src/app/service/bdd.ts @@ -1,23 +1,22 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; -import { environment } from 'environments/environment'; @Injectable() export class BddService { private bdd = { "type": null, - "group": null, - "saison": null, - "univers": null, + "series": null, + "season": null, + "universe": null, "video": null }; private bddPomise = { "type": null, - "group": null, - "saison": null, - "univers": null, + "series": null, + "season": null, + "universe": null, "video": null }; @@ -30,9 +29,10 @@ export class BddService { let self = this; return new Promise((resolve, reject) => { self.get(_name) - .then(function(response) { + .then(function(response:DataInterface) { + let responseTmp = response; ret.then(function(response2) { - response.set(_id, response2); + responseTmp.set(_id, response2); resolve(response2); }).catch(function(response2) { reject(response2); @@ -42,14 +42,24 @@ export class BddService { }); }); } + asyncSetInDB(_name: string, _id: number, data: any) { + let self = this; + self.get(_name) + .then(function(response:DataInterface) { + response.set(_id, data); + }).catch(function(response) { + // nothing to do ... + }); + } delete(_name: string, _id: number, ret: any) { let self = this; return new Promise((resolve, reject) => { self.get(_name) - .then(function(response) { + .then(function(response:DataInterface) { + let responseTmp = response; ret.then(function(response2) { - response.delete(_id); + responseTmp.delete(_id); resolve(response2); }).catch(function(response2) { reject(response2); @@ -62,8 +72,9 @@ export class BddService { get(_name: string): any { let self = this; + console.log("Try to get DB '" + _name + "'"); if (this.bdd[_name] === undefined) { - console.log("Try to get a non existant BDD ... '" + _name + "'"); + console.log("Try to get a non existant DB ... '" + _name + "'"); return; } if (this.bdd[_name] !== null) { @@ -101,24 +112,24 @@ export class BddService { }); } - getType():any { + getType():DataInterface { return this.get("type"); - }; + } - getGroup():any { - return this.get("group"); - }; + getSeries():DataInterface { + return this.get("series"); + } - getSaison():any { - return this.get("saison"); - }; + getSeason():DataInterface { + return this.get("season"); + } - getUnivers():any { - return this.get("univers"); - }; + getUniverse():DataInterface { + return this.get("universe"); + } - getVideo():any { + getVideo():DataInterface { return this.get("video"); - }; + } } diff --git a/front/src/app/service/data.ts b/front/src/app/service/data.ts index 315210a..a9640c4 100644 --- a/front/src/app/service/data.ts +++ b/front/src/app/service/data.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; -import { environment } from 'environments/environment'; @Injectable() export class DataService { diff --git a/front/src/app/service/dataInterface.ts b/front/src/app/service/dataInterface.ts index 807b7cb..a318cda 100644 --- a/front/src/app/service/dataInterface.ts +++ b/front/src/app/service/dataInterface.ts @@ -248,13 +248,21 @@ export class DataInterface { } //console.log("order in list by : " + value_order); //out = sorted(out, key=lambda x{ x[value_order]) - out.sort(function (a, b) { - //const name1 = t1.name.toLowerCase(); - //const name2 = t2.name.toLowerCase(); + if (value_order == "name") { + out.sort(function (a, b) { + const name1 = a[value_order].toLowerCase(); + const name2 = b[value_order].toLowerCase(); + if (name1 > name2) { return 1; } + if (name1 < name2) { return -1; } + return 0; + }); + } else { + out.sort(function (a, b) { if (a[value_order] > b[value_order]) { return 1; } if (a[value_order] < b[value_order]) { return -1; } return 0; }); + } if (_order.length > 1) { out_unclassable = this.order_by(out_unclassable, _order.slice(1)); } diff --git a/front/src/app/service/http-oauth-wrapper.ts b/front/src/app/service/http-oauth-wrapper.ts index f6954b4..a85db50 100644 --- a/front/src/app/service/http-oauth-wrapper.ts +++ b/front/src/app/service/http-oauth-wrapper.ts @@ -4,7 +4,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpEvent} from '@ang import { catchError, map, tap } from 'rxjs/operators'; import {Observable} from "rxjs"; -import { environment } from 'environments/environment'; +import { environment } from '../../environments/environment'; @Injectable() export class HttpOAuthWrapperService { @@ -312,7 +312,7 @@ export class HttpOAuthWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: delete_specific(_base:string, _id:number, _subElement:string = ""):any { @@ -349,7 +349,7 @@ export class HttpOAuthWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any { //console.log("put data to " + _base); @@ -385,7 +385,7 @@ export class HttpOAuthWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: post_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any { //console.log("put data to " + _base); @@ -421,5 +421,5 @@ export class HttpOAuthWrapperService { } }); }); - }; + } } diff --git a/front/src/app/service/http-wrapper.ts b/front/src/app/service/http-wrapper.ts index e77e969..f18df86 100644 --- a/front/src/app/service/http-wrapper.ts +++ b/front/src/app/service/http-wrapper.ts @@ -4,8 +4,8 @@ import { HttpClient, HttpHeaders, HttpParams, HttpRequest, HttpEvent, HttpEventT import { catchError, map, tap } from 'rxjs/operators'; import {Observable} from "rxjs"; -import { environment } from 'environments/environment'; -import { SessionService } from 'app/service/session'; +import { environment } from '../../environments/environment'; +import { SessionService } from './session'; @Injectable() export class HttpWrapperService { @@ -404,8 +404,8 @@ export class HttpWrapperService { self.post(url, headers, _multipart, _progress) .then(function(response: any) { console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2)); - if (response.status == 200) { - resolve(response.data); + if (response.status >= 200 && response.status <= 299) { + resolve(response.data.body); return; } reject("An error occured"); @@ -484,7 +484,7 @@ export class HttpWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: delete_specific(_base:string, _id:number, _subElement:string = ""):any { @@ -521,7 +521,7 @@ export class HttpWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any { //console.log("put data to " + _base); @@ -557,7 +557,7 @@ export class HttpWrapperService { } }); }); - }; + } // Complex wrapper to simplify interaction: post_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any { //console.log("put data to " + _base); @@ -593,5 +593,5 @@ export class HttpWrapperService { } }); }); - }; + } } diff --git a/front/src/app/service/saison.ts b/front/src/app/service/season.ts similarity index 74% rename from front/src/app/service/saison.ts rename to front/src/app/service/season.ts index f4c55cc..fd41fe8 100644 --- a/front/src/app/service/saison.ts +++ b/front/src/app/service/season.ts @@ -1,25 +1,24 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; -import { environment } from 'environments/environment'; -import { BddService } from 'app/service/bdd'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; +import { BddService } from './bdd'; @Injectable() -export class SaisonService { +export class SeasonService { // 0: Not hide password; 1 hide password; private identificationVersion: number = 1; - private serviceName:string = "saison"; + private serviceName:string = "season"; constructor(private http: HttpWrapperService, private bdd: BddService) { - console.log("Start SaisonService"); + console.log("Start SeasonService"); } get(_id:number):any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getSaison() + self.bdd.getSeason() .then(function(response) { let data = response.get(_id); if (data === null || data === undefined) { @@ -37,8 +36,8 @@ export class SaisonService { return new Promise((resolve, reject) => { self.bdd.getVideo() .then(function(response) { - //let data = response.gets_where([["==", "saison_id", _id]], ["id", "name", "episode"], ["episode", "name"]) - let data = response.gets_where([["==", "saison_id", _id]], undefined, ["episode", "name"]) + //let data = response.gets_where([["==", "season_id", _id]], ["id", "name", "episode"], ["episode", "name"]) + let data = response.gets_where([["==", "season_id", _id]], undefined, ["episode", "name"]) resolve(data); }).catch(function(response) { reject(response); @@ -50,8 +49,8 @@ export class SaisonService { return new Promise((resolve, reject) => { self.bdd.getVideo() .then(function(response) { - //let data = response.gets_where([["==", "saison_id", _id]], ["id", "name", "episode"], ["episode", "name"]) - let data = response.gets_where([["==", "saison_id", _id]], undefined, ["episode", "name"]) + //let data = response.gets_where([["==", "season_id", _id]], ["id", "name", "episode"], ["episode", "name"]) + let data = response.gets_where([["==", "season_id", _id]], undefined, ["episode", "name"]) resolve(data.length); }).catch(function(response) { reject(response); diff --git a/front/src/app/service/group.ts b/front/src/app/service/series.ts similarity index 77% rename from front/src/app/service/group.ts rename to front/src/app/service/series.ts index aaa612f..9336b28 100644 --- a/front/src/app/service/group.ts +++ b/front/src/app/service/series.ts @@ -1,25 +1,24 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; -import { BddService } from 'app/service/bdd'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; +import { BddService } from './bdd'; -import { environment } from 'environments/environment'; @Injectable() -export class GroupService { +export class SeriesService { // 0: Not hide password; 1 hide password; private identificationVersion: number = 1; - private serviceName:string = "group"; + private serviceName:string = "series"; constructor(private http: HttpWrapperService, private bdd: BddService) { - console.log("Start GroupService"); + console.log("Start SeriesService"); } get(_id:number):any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getGroup() + self.bdd.getSeries() .then(function(response) { let data = response.get(_id); if (data === null || data === undefined) { @@ -32,12 +31,12 @@ export class GroupService { reject(response); }); }); - }; + } getData():any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getGroup() + self.bdd.getSeries() .then(function(response) { let data = response.gets(); resolve(data); @@ -46,12 +45,12 @@ export class GroupService { reject(response); }); }); - }; + } getOrder():any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getGroup() + self.bdd.getSeries() .then(function(response) { let data = response.gets_where([["!=", "id", null]], ["id", "name"], ["name","id"]) resolve(data); @@ -60,30 +59,30 @@ export class GroupService { reject(response); }); }); - }; + } getVideoAll(_id:number):any { //this.checkLocalBdd(); - }; + } getVideo(_id:number):any { let self = this; return new Promise((resolve, reject) => { self.bdd.getVideo() .then(function(response) { - //let data = response.gets_where([["==", "serie_id", _id], ["==", "saison_id", null]], ["id"], ["episode", "name"]) - let data = response.gets_where([["==", "serie_id", _id], ["==", "saison_id", null]], undefined, ["episode", "name"]) + //let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], ["id"], ["episode", "name"]) + let data = response.gets_where([["==", "series_id", _id], ["==", "season_id", null]], undefined, ["episode", "name"]) resolve(data); }).catch(function(response) { reject(response); }); }); - }; + } - getSaison(_id:number, _select:Array = []):any { + getSeason(_id:number, _select:Array = []):any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getSaison() + self.bdd.getSeason() .then(function(response) { let data = response.gets_where([["==", "parent_id", _id]], ["id"], ["number"]) if (_select.length == 0) { @@ -102,30 +101,31 @@ export class GroupService { reject(response); }); }); - }; + } put(_id:number, _data:any):any { let ret = this.http.put_specific(this.serviceName, _id, _data); return this.bdd.setAfterPut(this.serviceName, _id, ret); - }; + } addCover(_id:number, _coverId:number):any { return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover"); - }; + } getCoverUrl(_coverId:number):any { return this.http.createRESTCall("data/" + _coverId); - }; + } + getCoverThumbnailUrl(_coverId:number):any { return this.http.createRESTCall("data/thumbnail/" + _coverId); - }; + } - getLike(_nameGroup:string):any { + getLike(_nameSeries:string):any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getGroup() + self.bdd.getSeries() .then(function(response) { - let data = response.getNameLike(_nameGroup); + let data = response.getNameLike(_nameSeries); if (data === null || data === undefined) { reject("Data does not exist in the local BDD"); return; diff --git a/front/src/app/service/type.ts b/front/src/app/service/type.ts index b260b46..9258efe 100644 --- a/front/src/app/service/type.ts +++ b/front/src/app/service/type.ts @@ -1,11 +1,9 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -//import { SHA512 } from 'assets/js_3rd_party/sha512'; -import { DataInterface } from 'app/service/dataInterface'; -import { BddService } from 'app/service/bdd'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; +import { BddService } from './bdd'; -import { environment } from 'environments/environment'; export interface MessageLogIn { id: number; @@ -66,16 +64,16 @@ export class TypeService { self.bdd.getVideo() .then(function(response) { if (_select.length == 0) { - let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], undefined, ["name"]); + let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], undefined, ["name"]); resolve(data); return; } if (_select[0] == "*") { - let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], undefined, ["name"]); + let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], undefined, ["name"]); resolve(data); return; } - let data = response.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], _select, ["name"]); + let data = response.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], _select, ["name"]); resolve(data); return; }).catch(function(response) { @@ -84,17 +82,17 @@ export class TypeService { }); } - getSubGroup(_id:number, _select:Array = []):any { + getSubSeries(_id:number, _select:Array = []):any { let self = this; return new Promise((resolve, reject) => { self.bdd.getVideo() .then(function(response) { - let data = response.gets_where([["==", "type_id", _id], ["!=", "serie_id", null], ["==", "univers_id", null]], ["serie_id"], ["name"]); + let data = response.gets_where([["==", "type_id", _id], ["!=", "series_id", null], ["==", "universe_id", null]], ["series_id"], ["name"]); if (_select.length == 0) { resolve(data); return; } - self.bdd.getGroup() + self.bdd.getSeries() .then(function(response2) { if (_select[0] == "*") { let data2 = response2.gets_where([["==", "id", data]], undefined, ["name"]); @@ -113,17 +111,17 @@ export class TypeService { }); } - getSubUnivers(_id:number, _select:Array = []):any { + getSubUniverse(_id:number, _select:Array = []):any { let self = this; return new Promise((resolve, reject) => { self.bdd.getVideo() .then(function(response) { - let data = response.data.gets_where([["==", "type_id", _id], ["==", "serie_id", null], ["==", "univers_id", null]], ["univers_id"], ["name"]); + let data = response.data.gets_where([["==", "type_id", _id], ["==", "series_id", null], ["==", "universe_id", null]], ["univers_id"], ["name"]); if (_select.length == 0) { resolve(data); return; } - self.bdd.getUnivers() + self.bdd.getUniverse() .then(function(response2) { if (_select[0] == "*") { let data2 = response2.gets_where([["==", "id", data]], undefined, ["name"]); diff --git a/front/src/app/service/univers.ts b/front/src/app/service/universe.ts similarity index 74% rename from front/src/app/service/univers.ts rename to front/src/app/service/universe.ts index a700403..3117e74 100644 --- a/front/src/app/service/univers.ts +++ b/front/src/app/service/universe.ts @@ -1,25 +1,23 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; -import { BddService } from 'app/service/bdd'; - -import { environment } from 'environments/environment'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; +import { BddService } from './bdd'; @Injectable() -export class UniversService { +export class UniverseService { // 0: Not hide password; 1 hide password; private identificationVersion: number = 1; - private serviceName:string = "univers"; + private serviceName:string = "universe"; constructor(private http: HttpWrapperService, private bdd: BddService) { - console.log("Start universService"); + console.log("Start universeService"); } getData():any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getUnivers() + self.bdd.getUniverse() .then(function(response) { let data = response.gets(); resolve(data); @@ -27,12 +25,12 @@ export class UniversService { reject(response); }); }); - }; + } get(_id:number):any { let self = this; return new Promise((resolve, reject) => { - self.bdd.getUnivers() + self.bdd.getUniverse() .then(function(response) { let data = response.get(_id); if (data === null || data === undefined) { @@ -44,25 +42,25 @@ export class UniversService { reject(response); }); }); - }; + } - getSubGroup(_id:number, _select:Array = []):any { + getSubSeries(_id:number, _select:Array = []):any { //this.checkLocalBdd(); - }; + } getSubVideo(_id:number, _select:Array = []):any { //this.checkLocalBdd(); - }; + } put(_id:number, _data:any):any { let ret = this.http.put_specific(this.serviceName, _id, _data); return this.bdd.setAfterPut(this.serviceName, _id, ret); - }; + } addCover(_id:number, _coverId:number):any { return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover"); - }; + } getCoverUrl(_coverId:number):any { return this.http.createRESTCall("data/" + _coverId); - }; + } } diff --git a/front/src/app/service/user.ts b/front/src/app/service/user.ts index 573e520..518a391 100644 --- a/front/src/app/service/user.ts +++ b/front/src/app/service/user.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -import { HttpOAuthWrapperService } from 'app/service/http-oauth-wrapper'; -import { HttpWrapperService } from 'app/service/http-wrapper'; +import { HttpOAuthWrapperService } from './http-oauth-wrapper'; +import { HttpWrapperService } from './http-wrapper'; //import { SHA512 } from 'assets/js_3rd_party/sha512'; interface MessageLogIn { diff --git a/front/src/app/service/video.ts b/front/src/app/service/video.ts index 34645fe..e0efff0 100644 --- a/front/src/app/service/video.ts +++ b/front/src/app/service/video.ts @@ -1,9 +1,9 @@ import { Injectable } from '@angular/core'; -import { HttpWrapperService } from 'app/service/http-wrapper'; -import { DataInterface } from 'app/service/dataInterface'; -import { BddService } from 'app/service/bdd'; +import { HttpWrapperService } from './http-wrapper'; +import { DataInterface } from './dataInterface'; +import { BddService } from './bdd'; -import { environment } from 'environments/environment'; +import { environment } from '../../environments/environment'; @Injectable() export class VideoService { @@ -42,20 +42,17 @@ export class VideoService { let ret = this.http.delete_specific(this.serviceName, _id); return this.bdd.delete(this.serviceName, _id, ret); } - addCover(_id:number, _coverId:number):any { - return this.http.post_specific(this.serviceName, _id, {"data_id":_coverId}, "add_cover"); - } getCoverUrl(_coverId:number):any { return this.http.createRESTCall("data/" + _coverId); } getCoverThumbnailUrl(_coverId:number):any { return this.http.createRESTCall("data/thumbnail/" + _coverId); } - + uploadFile(_file:File, _universe:string, - _serie:string, - _saison:number, + _series:string, + _season:number, _episode:number, _title:string, _type_id:number, @@ -63,11 +60,11 @@ export class VideoService { const formData = new FormData(); formData.append('file_name', _file.name); formData.append('universe', _universe); - formData.append('serie', _serie); - if (_saison != null) { - formData.append('saison', _saison.toString()); + formData.append('series', _series); + if (_season != null) { + formData.append('season', _season.toString()); } else { - formData.append('saison', null); + formData.append('season', null); } if (_episode != null) { @@ -85,5 +82,48 @@ export class VideoService { formData.append('file', _file); return this.http.uploadMultipart(this.serviceName + "/upload/", formData, _progress); } + + deleteCover(_media_id:number, + _cover_id:number) { + let self = this; + return new Promise((resolve, reject) => { + self.http.get_specific(this.serviceName + "/" + _media_id + "/rm_cover" , _cover_id) + .then(function(response) { + let data = response; + if (data === null || data === undefined) { + reject("error retrive data from server"); + return; + } + self.bdd.asyncSetInDB(self.serviceName, _media_id, data); + resolve(data); + }).catch(function(response) { + reject(response); + }); + }); + + } + uploadCover(_file:File, + _media_id:number, + _progress:any = null) { + const formData = new FormData(); + formData.append('file_name', _file.name); + formData.append('type_id', _media_id.toString()); + formData.append('file', _file); + let self = this; + return new Promise((resolve, reject) => { + self.http.uploadMultipart(this.serviceName + "/" + _media_id + "/add_cover/", formData, _progress) + .then(function(response) { + let data = response; + if (data === null || data === undefined) { + reject("error retrive data from server"); + return; + } + self.bdd.asyncSetInDB(self.serviceName, _media_id, data); + resolve(data); + }).catch(function(response) { + reject(response); + }); + }); + } }