[DEV] integrate update of video properties
This commit is contained in:
parent
8c2a836e65
commit
766db280f9
@ -104,17 +104,24 @@ def add(_app, _name_api):
|
|||||||
@doc.description("List all the videos availlable for this group tht does not depend on saison.")
|
@doc.description("List all the videos availlable for this group tht does not depend on saison.")
|
||||||
@doc.produces(content_type='application/json')
|
@doc.produces(content_type='application/json')
|
||||||
async def retrive_saison(request, id):
|
async def retrive_saison(request, id):
|
||||||
value = data_global_elements.get_interface(data_global_elements.API_SAISON).gets_where(select=[["==", "group_id", id]], filter=["id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_SAISON).gets_where(select=[["==", "group_id", id]], filter=["id"])
|
||||||
if value != None:
|
if list_values == None:
|
||||||
return response.json(value)
|
raise ServerError("No data found", status_code=404)
|
||||||
raise ServerError("No data found", status_code=404)
|
if len(list_values) == 0:
|
||||||
|
return response.json(list_values)
|
||||||
|
if "select" in request.args:
|
||||||
|
if request.args["select"] == "*":
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_SAISON).gets_where(select=[["==", "id", list_values]])
|
||||||
|
else:
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_SAISON).gets_where(select=[["==", "id", list_values]], filter=request.args["select"])
|
||||||
|
return response.json(list_values)
|
||||||
|
|
||||||
@elem_blueprint.put('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.put('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
@doc.summary("Update resource")
|
@doc.summary("Update resource")
|
||||||
@doc.description("Update the specified resource in storage.")
|
@doc.description("Update the specified resource in storage.")
|
||||||
@doc.response_success(status=201, description='If successful updated')
|
@doc.response_success(status=201, description='If successful updated')
|
||||||
async def update(request, id):
|
async def update(request, id):
|
||||||
ret = data_global_elements.get_interface(_name_api).put(id)
|
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
|
||||||
return response.json({})
|
return response.json({})
|
||||||
|
|
||||||
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
|
@ -97,7 +97,7 @@ def add(_app, _name_api):
|
|||||||
@doc.description("Update the specified resource in storage.")
|
@doc.description("Update the specified resource in storage.")
|
||||||
@doc.response_success(status=201, description='If successful updated')
|
@doc.response_success(status=201, description='If successful updated')
|
||||||
async def update(request, id):
|
async def update(request, id):
|
||||||
ret = data_global_elements.get_interface(_name_api).put(id)
|
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
|
||||||
return response.json({})
|
return response.json({})
|
||||||
|
|
||||||
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
|
@ -73,7 +73,7 @@ def add(_app, _name_api):
|
|||||||
@doc.description("Update the specified resource in storage.")
|
@doc.description("Update the specified resource in storage.")
|
||||||
@doc.response_success(status=201, description='If successful updated')
|
@doc.response_success(status=201, description='If successful updated')
|
||||||
async def update(request, id):
|
async def update(request, id):
|
||||||
ret = data_global_elements.get_interface(_name_api).put(id)
|
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
|
||||||
return response.json({})
|
return response.json({})
|
||||||
|
|
||||||
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
@ -111,6 +111,8 @@ def add(_app, _name_api):
|
|||||||
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["==", "group_id", None], ["==", "univers_id", None]], filter=["id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["==", "group_id", None], ["==", "univers_id", None]], filter=["id"])
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
|
|
||||||
|
## ----------------------------------------------------------------------------------------
|
||||||
|
## sub list of Groups ...
|
||||||
@elem_blueprint.get('/' + _name_api + '/<id:int>/group', strict_slashes=True)
|
@elem_blueprint.get('/' + _name_api + '/<id:int>/group', strict_slashes=True)
|
||||||
@doc.summary("List all group availlable.")
|
@doc.summary("List all group availlable.")
|
||||||
@doc.description("List all groups availlable in this type (not depending of an univers).")
|
@doc.description("List all groups availlable in this type (not depending of an univers).")
|
||||||
@ -119,9 +121,15 @@ def add(_app, _name_api):
|
|||||||
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["!=", "group_id", None], ["==", "univers_id", None]], filter=["group_id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["!=", "group_id", None], ["==", "univers_id", None]], filter=["group_id"])
|
||||||
if len(list_values) == 0:
|
if len(list_values) == 0:
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
list_values = data_global_elements.get_interface(data_global_elements.API_GROUP).gets_where(select=[["==", "id", list_values]], filter=["id", "name"])
|
if "select" in request.args:
|
||||||
|
if request.args["select"] == "*":
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_GROUP).gets_where(select=[["==", "id", list_values]])
|
||||||
|
else:
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_GROUP).gets_where(select=[["==", "id", list_values]], filter=request.args["select"])
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
|
|
||||||
|
## ----------------------------------------------------------------------------------------
|
||||||
|
## Sub list of univers ...
|
||||||
@elem_blueprint.get('/' + _name_api + '/<id:int>/univers', strict_slashes=True)
|
@elem_blueprint.get('/' + _name_api + '/<id:int>/univers', strict_slashes=True)
|
||||||
@doc.summary("List all univers availlable.")
|
@doc.summary("List all univers availlable.")
|
||||||
@doc.description("List all univers availlable.")
|
@doc.description("List all univers availlable.")
|
||||||
@ -130,7 +138,11 @@ def add(_app, _name_api):
|
|||||||
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["!=", "univers_id", None]], filter=["univers_id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "type_id", id], ["!=", "univers_id", None]], filter=["univers_id"])
|
||||||
if len(list_values) == 0:
|
if len(list_values) == 0:
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
list_values = data_global_elements.get_interface(data_global_elements.API_UNIVERS).gets_where(select=[["==", "id", list_values]], filter=["id", "name"])
|
if "select" in request.args:
|
||||||
|
if request.args["select"] == "*":
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_UNIVERS).gets_where(select=[["==", "id", list_values]])
|
||||||
|
else:
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_UNIVERS).gets_where(select=[["==", "id", list_values]], filter=request.args["select"])
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
|
|
||||||
_app.blueprint(elem_blueprint)
|
_app.blueprint(elem_blueprint)
|
@ -74,7 +74,7 @@ def add(_app, _name_api):
|
|||||||
@doc.description("Update the specified resource in storage.")
|
@doc.description("Update the specified resource in storage.")
|
||||||
@doc.response_success(status=201, description='If successful updated')
|
@doc.response_success(status=201, description='If successful updated')
|
||||||
async def update(request, id):
|
async def update(request, id):
|
||||||
ret = data_global_elements.get_interface(_name_api).put(id)
|
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
|
||||||
return response.json({})
|
return response.json({})
|
||||||
|
|
||||||
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
@ -112,12 +112,18 @@ def add(_app, _name_api):
|
|||||||
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "univers_id", id], ["==", "group_id", None], ["==", "univers_id", None]], filter=["id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "univers_id", id], ["==", "group_id", None], ["==", "univers_id", None]], filter=["id"])
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
|
|
||||||
|
## ----------------------------------------------------------------------------------------
|
||||||
@elem_blueprint.get('/' + _name_api + '/<id:int>/group', strict_slashes=True)
|
@elem_blueprint.get('/' + _name_api + '/<id:int>/group', strict_slashes=True)
|
||||||
@doc.summary("List all group availlable.")
|
@doc.summary("List all group availlable.")
|
||||||
@doc.description("List all groups availlable in this univers (not depending of an univers).")
|
@doc.description("List all groups availlable in this univers (not depending of an univers).")
|
||||||
@doc.produces(content_type='application/json')
|
@doc.produces(content_type='application/json')
|
||||||
async def retrive_group(request, id):
|
async def retrive_group(request, id):
|
||||||
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "univers_id", id], ["!=", "group_id", None], ["==", "univers_id", None]], filter=["group_id"])
|
list_values = data_global_elements.get_interface(data_global_elements.API_VIDEO).gets_where(select=[["==", "univers_id", id], ["!=", "group_id", None], ["==", "univers_id", None]], filter=["group_id"])
|
||||||
|
if "select" in request.args:
|
||||||
|
if request.args["select"] == "*":
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_GROUP).gets_where(select=[["==", "id", list_values]])
|
||||||
|
else:
|
||||||
|
list_values = data_global_elements.get_interface(data_global_elements.API_GROUP).gets_where(select=[["==", "id", list_values]], filter=request.args["select"].split('|'))
|
||||||
return response.json(list_values)
|
return response.json(list_values)
|
||||||
|
|
||||||
@elem_blueprint.post('/' + _name_api + "/<id:int>/add_cover", strict_slashes=True)
|
@elem_blueprint.post('/' + _name_api + "/<id:int>/add_cover", strict_slashes=True)
|
||||||
|
@ -152,8 +152,8 @@ def add(_app, _name_api):
|
|||||||
@doc.description("Update the specified resource in storage.")
|
@doc.description("Update the specified resource in storage.")
|
||||||
@doc.response_success(status=201, description='If successful updated')
|
@doc.response_success(status=201, description='If successful updated')
|
||||||
async def update(request, id):
|
async def update(request, id):
|
||||||
ret = data_global_elements.get_interface(_name_api).put(id)
|
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
|
||||||
return response.json({})
|
return response.json({"update":"done"});
|
||||||
|
|
||||||
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
|
||||||
@doc.summary("Remove resource")
|
@doc.summary("Remove resource")
|
||||||
|
@ -12,6 +12,7 @@ import tools
|
|||||||
import json
|
import json
|
||||||
from realog import debug
|
from realog import debug
|
||||||
import random
|
import random
|
||||||
|
import copy
|
||||||
from sanic.exceptions import ServerError
|
from sanic.exceptions import ServerError
|
||||||
##
|
##
|
||||||
## @breif Generic interface to access to the BDD (no BDD, direct file IO)
|
## @breif Generic interface to access to the BDD (no BDD, direct file IO)
|
||||||
@ -167,8 +168,16 @@ class DataInterface():
|
|||||||
id_in_bdd = self.get_table_index(_id)
|
id_in_bdd = self.get_table_index(_id)
|
||||||
if id_in_bdd == None:
|
if id_in_bdd == None:
|
||||||
return False
|
return False
|
||||||
_value["id"] = _id
|
# todo: check the model before update ...
|
||||||
self.bdd[id_in_bdd] = _value
|
debug.warning("update element: " + str(_id))
|
||||||
|
value_bdd = copy.deepcopy(self.bdd[id_in_bdd]);
|
||||||
|
for elem in _value.keys():
|
||||||
|
debug.warning(" [" + elem + "] " + str(value_bdd[elem]) + " ==> " + str(_value[elem]))
|
||||||
|
value_bdd[elem] = _value[elem]
|
||||||
|
if self.check_with_model(value_bdd) == False:
|
||||||
|
raise ServerError("FORBIDDEN Corelation with BDD error", status_code=403)
|
||||||
|
self.bdd[id_in_bdd] = value_bdd
|
||||||
|
debug.warning(" ==> " + str(self.bdd[id_in_bdd]))
|
||||||
self.mark_to_store()
|
self.mark_to_store()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -265,6 +274,8 @@ class DataInterface():
|
|||||||
|
|
||||||
def filter_object_values(self, _values, _filter):
|
def filter_object_values(self, _values, _filter):
|
||||||
out = []
|
out = []
|
||||||
|
if _filter == None:
|
||||||
|
return _values
|
||||||
if len(_filter) == 1:
|
if len(_filter) == 1:
|
||||||
token = _filter[0]
|
token = _filter[0]
|
||||||
for elem in _values:
|
for elem in _values:
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Name of the film"
|
placeholder="Name of the Media"
|
||||||
[(value)]="name"
|
[value]="name"
|
||||||
|
(input)="onName($event.target.value)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -16,7 +17,10 @@
|
|||||||
Description:
|
Description:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" [(value)]="description"/>
|
<input type="text"
|
||||||
|
placeholder="Description of the Media"
|
||||||
|
[value]="description"
|
||||||
|
(input)="onDescription($event.target.value)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
@ -24,7 +28,9 @@
|
|||||||
Date:
|
Date:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" [(value)]="time"/>
|
<input type="text"
|
||||||
|
[value]="time"
|
||||||
|
(input)="onDate($event.target.value)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
@ -32,7 +38,8 @@
|
|||||||
Type:
|
Type:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<select [(ngModel)]="type_id">
|
<select [ngModel]="type_id"
|
||||||
|
(ngModelChange)="onChangeType($event)">
|
||||||
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listType" [ngValue]="element.value">{{element.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -42,7 +49,8 @@
|
|||||||
Univers:
|
Univers:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<select [(ngModel)]="univers_id">
|
<select [ngModel]="univers_id"
|
||||||
|
(ngModelChange)="onChangeUnivers($event)">
|
||||||
<option *ngFor="let element of listUnivers" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listUnivers" [ngValue]="element.value">{{element.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -52,7 +60,8 @@
|
|||||||
Group:
|
Group:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<select [(ngModel)]="group_id">
|
<select [ngModel]="group_id"
|
||||||
|
(ngModelChange)="onChangeGroup($event)">
|
||||||
<option *ngFor="let element of listGroup" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listGroup" [ngValue]="element.value">{{element.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -62,7 +71,8 @@
|
|||||||
Saison:
|
Saison:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<select [(ngModel)]="saison_id">
|
<select [ngModel]="saison_id"
|
||||||
|
(ngModelChange)="onChangeSaison($event)">
|
||||||
<option *ngFor="let element of listSaison" [ngValue]="element.value">{{element.label}}</option>
|
<option *ngFor="let element of listSaison" [ngValue]="element.value">{{element.label}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -72,7 +82,9 @@
|
|||||||
Episode:
|
Episode:
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" [(value)]="episode"/>
|
<input type="text"
|
||||||
|
[value]="episode"
|
||||||
|
(input)="onEpisode($event.target.value)"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="request_raw">
|
<div class="request_raw">
|
||||||
|
@ -15,6 +15,7 @@ import { HttpWrapperService } from '../../service/http-wrapper.service';
|
|||||||
|
|
||||||
import { TypeService } from '../../service/type.service';
|
import { TypeService } from '../../service/type.service';
|
||||||
import { UniversService } from '../../service/univers.service';
|
import { UniversService } from '../../service/univers.service';
|
||||||
|
import { GroupService } from '../../service/group.service';
|
||||||
import { VideoService } from '../../service/video.service';
|
import { VideoService } from '../../service/video.service';
|
||||||
|
|
||||||
export class ElementList {
|
export class ElementList {
|
||||||
@ -49,7 +50,6 @@ export class VideoEditComponent implements OnInit {
|
|||||||
time:number = undefined
|
time:number = undefined
|
||||||
type_id:number = undefined
|
type_id:number = undefined
|
||||||
generated_name:string = ""
|
generated_name:string = ""
|
||||||
video_source:string = ""
|
|
||||||
listType: ElementList[] = [
|
listType: ElementList[] = [
|
||||||
{value: undefined, label: '---'},
|
{value: undefined, label: '---'},
|
||||||
];
|
];
|
||||||
@ -68,66 +68,48 @@ export class VideoEditComponent implements OnInit {
|
|||||||
private locate: Location,
|
private locate: Location,
|
||||||
private typeService: TypeService,
|
private typeService: TypeService,
|
||||||
private universService: UniversService,
|
private universService: UniversService,
|
||||||
|
private groupService: GroupService,
|
||||||
private videoService: VideoService,
|
private videoService: VideoService,
|
||||||
private httpService: HttpWrapperService) {
|
private httpService: HttpWrapperService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendValues():void {
|
|
||||||
console.log("send new values....");
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.id_video = parseInt(this.route.snapshot.paramMap.get('video_id'));
|
this.id_video = parseInt(this.route.snapshot.paramMap.get('video_id'));
|
||||||
let self = this;
|
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.universService.getData()
|
||||||
.then(function(response2) {
|
.then(function(response2) {
|
||||||
self.listUnivers = [{value: undefined, label: '---'}];
|
|
||||||
for(let iii= 0; iii < response2.length; iii++) {
|
for(let iii= 0; iii < response2.length; iii++) {
|
||||||
self.listUnivers.push({value: response2[iii].id, label: response2[iii].name});
|
self.listUnivers.push({value: response2[iii].id, label: response2[iii].name});
|
||||||
}
|
}
|
||||||
}).catch(function(response2) {
|
}).catch(function(response2) {
|
||||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
});
|
});
|
||||||
|
this.typeService.getData()
|
||||||
|
.then(function(response2) {
|
||||||
|
for(let iii= 0; iii < response2.length; iii++) {
|
||||||
|
self.listType.push({value: response2[iii].id, label: response2[iii].name});
|
||||||
|
}
|
||||||
|
}).catch(function(response2) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
|
});
|
||||||
this.videoService.get(this.id_video)
|
this.videoService.get(this.id_video)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
console.log("get response of video : " + JSON.stringify(response, null, 2));
|
||||||
self.name = response.name;
|
self.name = response.name;
|
||||||
self.description = response.description;
|
self.description = response.description;
|
||||||
self.episode = response.episode;
|
self.episode = response.episode;
|
||||||
self.type_id = response.type_id;
|
|
||||||
self.typeService.getData()
|
|
||||||
.then(function(response2) {
|
|
||||||
self.listType = [{value: undefined, label: '---'}];
|
|
||||||
for(let iii= 0; iii < response2.length; iii++) {
|
|
||||||
self.listType.push({value: response2[iii].id, label: response2[iii].name});
|
|
||||||
}
|
|
||||||
}).catch(function(response2) {
|
|
||||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
|
||||||
});
|
|
||||||
self.saison_id = response.saison_id;
|
|
||||||
self.group_id = response.group_id;
|
|
||||||
self.listGroup = [{value: undefined, label: '---'}];
|
|
||||||
if (response.type_id != undefined) {
|
|
||||||
self.typeService.getSubGroup(response.type_id)
|
|
||||||
.then(function(response2) {
|
|
||||||
for(let iii= 0; iii < response2.length; iii++) {
|
|
||||||
self.listGroup.push({value: response2[iii].id, label: response2[iii].name});
|
|
||||||
}
|
|
||||||
}).catch(function(response2) {
|
|
||||||
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
self.univers_id = response.univers_id;
|
self.univers_id = response.univers_id;
|
||||||
self.data_id = response.data_id;
|
self.data_id = response.data_id;
|
||||||
self.time = response.time;
|
self.time = response.time;
|
||||||
self.generated_name = response.generated_name;
|
self.generated_name = response.generated_name;
|
||||||
if (self.data_id != -1) {
|
self.onChangeType(response.type_id);
|
||||||
self.video_source = self.httpService.createRESTCall("data/" + self.data_id);
|
self.onChangeGroup(response.group_id);
|
||||||
} else {
|
self.saison_id = response.saison_id;
|
||||||
self.video_source = "";
|
|
||||||
}
|
|
||||||
console.log("display source " + self.video_source);
|
|
||||||
//console.log("set transformed : " + JSON.stringify(self, null, 2));
|
//console.log("set transformed : " + JSON.stringify(self, null, 2));
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
self.error = "Can not get the data";
|
self.error = "Can not get the data";
|
||||||
@ -140,12 +122,83 @@ export class VideoEditComponent implements OnInit {
|
|||||||
self.data_id = -1;
|
self.data_id = -1;
|
||||||
self.time = undefined;
|
self.time = undefined;
|
||||||
self.generated_name = "";
|
self.generated_name = "";
|
||||||
self.video_source = "";
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
submitChange(videoForm:NgForm):void {
|
|
||||||
console.log("videoForm form display" + videoForm);
|
onChangeType(_value:any):void {
|
||||||
|
console.log("Change requested of type ... " + _value);
|
||||||
|
this.type_id = _value;
|
||||||
|
this.group_id = null;
|
||||||
|
this.saison_id = null;
|
||||||
|
this.listGroup = [{value: undefined, label: '---'}];
|
||||||
|
this.listSaison = [{value: undefined, label: '---'}];
|
||||||
|
let self = this;
|
||||||
|
if (this.type_id != undefined) {
|
||||||
|
self.typeService.getSubGroup(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});
|
||||||
|
}
|
||||||
|
}).catch(function(response2) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response2, null, 2));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeUnivers(_value:any):void {
|
||||||
|
this.univers_id = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeGroup(_value:any):void {
|
||||||
|
this.group_id = _value;
|
||||||
|
this.saison_id = null;
|
||||||
|
this.listSaison = [{value: undefined, label: '---'}];
|
||||||
|
let self = this;
|
||||||
|
if (this.group_id != undefined) {
|
||||||
|
self.groupService.getSaison(this.group_id, ["id", "number"])
|
||||||
|
.then(function(response3) {
|
||||||
|
for(let iii= 0; iii < response3.length; iii++) {
|
||||||
|
self.listSaison.push({value: response3[iii].id, label: "saison " + response3[iii].number});
|
||||||
|
}
|
||||||
|
}).catch(function(response3) {
|
||||||
|
console.log("get response22 : " + JSON.stringify(response3, null, 2));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onChangeSaison(_value:any):void {
|
||||||
|
this.saison_id = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onName(_value:any):void {
|
||||||
|
this.name = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onDescription(_value:any):void {
|
||||||
|
this.description = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onDate(_value:any):void {
|
||||||
|
this.time = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
onEpisode(_value:any):void {
|
||||||
|
this.episode = _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sendValues():void {
|
||||||
|
console.log("send new values....");
|
||||||
|
let data = {
|
||||||
|
"name": this.name,
|
||||||
|
"description": this.description,
|
||||||
|
"episode": this.episode,
|
||||||
|
"time": this.time,
|
||||||
|
"type_id": this.type_id,
|
||||||
|
"univers_id": this.univers_id,
|
||||||
|
"group_id": this.group_id,
|
||||||
|
"saison_id": this.saison_id
|
||||||
|
};
|
||||||
|
this.videoService.put(this.id_video, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,47 +10,20 @@ export class GroupService {
|
|||||||
console.log("Start GroupService");
|
console.log("Start GroupService");
|
||||||
}
|
}
|
||||||
|
|
||||||
get_specific(_id:number, _subElement:string = ""):any {
|
|
||||||
console.log("Get All data from types");
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "group/" + _id;
|
|
||||||
if (_subElement != "") {
|
|
||||||
url += "/" + _subElement;
|
|
||||||
}
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
//console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
return this.get_specific(_id);
|
return this.http.get_specific("group", _id);
|
||||||
};
|
};
|
||||||
|
|
||||||
getVideoAll(_id:number):any {
|
getVideoAll(_id:number):any {
|
||||||
return this.get_specific(_id, "video_all");
|
return this.http.get_specific("group", _id, "video_all");
|
||||||
};
|
};
|
||||||
|
|
||||||
getVideo(_id:number):any {
|
getVideo(_id:number):any {
|
||||||
return this.get_specific(_id, "video");
|
return this.http.get_specific("group", _id, "video");
|
||||||
};
|
};
|
||||||
|
|
||||||
getSaison(_id:number):any {
|
getSaison(_id:number, _select:Array<string> = []):any {
|
||||||
return this.get_specific(_id, "saison");
|
return this.http.get_specific("group", _id, "saison", _select);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,4 +103,117 @@ export class HttpWrapperService {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
put(_uriRest:string, _headerOption:any, _data:any) {
|
||||||
|
let connectionAdresse = this.createRESTCall(_uriRest, {});
|
||||||
|
const httpOption = {
|
||||||
|
headers: new HttpHeaders(_headerOption)
|
||||||
|
};
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (this.displayReturn == true) {
|
||||||
|
console.log("call POST " + connectionAdresse + " data=" + JSON.stringify(_data, null, 2));
|
||||||
|
}
|
||||||
|
let request = this.http.put<any>(connectionAdresse, _data, httpOption);
|
||||||
|
let self = this;
|
||||||
|
request.subscribe((res: any) => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("!! data " + JSON.stringify(res, null, 2));
|
||||||
|
}
|
||||||
|
if (res) {
|
||||||
|
if (res.httpCode) {
|
||||||
|
resolve({status:res.httpCode, data:res});
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:res});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve({status:200, data:""});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (self.displayReturn == true) {
|
||||||
|
console.log("an error occured status: " + error.status);
|
||||||
|
console.log("answer: " + JSON.stringify(error, null, 2));
|
||||||
|
}
|
||||||
|
reject({status:error.status, data:error.error});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
get_specific(_base:string, _id:number = null, _subElement:string = "", _select:Array<string> = []):any {
|
||||||
|
console.log("Get All data from " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
if (_select.length != 0) {
|
||||||
|
let select = ""
|
||||||
|
for (let iii=0; iii<_select.length; iii++) {
|
||||||
|
if (select.length != 0) {
|
||||||
|
select += "&";
|
||||||
|
}
|
||||||
|
select += "select=" + _select[iii];
|
||||||
|
}
|
||||||
|
url += "?" + select;
|
||||||
|
}
|
||||||
|
console.log("call GET " + url);
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.get(url, httpOption, {})
|
||||||
|
.then(function(response: any) {
|
||||||
|
console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Complex wrapper to simplify interaction:
|
||||||
|
put_specific(_base:string, _id:number, _data:any, _subElement:string = ""):any {
|
||||||
|
console.log("put data to " + _base);
|
||||||
|
const httpOption = { 'Content-Type': 'application/json' };
|
||||||
|
let url = _base;
|
||||||
|
if (_id != null) {
|
||||||
|
url += "/" + _id;
|
||||||
|
}
|
||||||
|
if (_subElement != "") {
|
||||||
|
url += "/" + _subElement;
|
||||||
|
}
|
||||||
|
console.log("call PUT: " + url);
|
||||||
|
console.log(" data: " + JSON.stringify(_data, null, 2));
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.put(url, httpOption, _data)
|
||||||
|
.then(function(response: any) {
|
||||||
|
console.log("URL: " + url + "\nRespond(" + response.status + "): " + JSON.stringify(response.data, null, 2));
|
||||||
|
if (response.status == 200) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.status == 201) {
|
||||||
|
resolve(response.data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject("An error occured");
|
||||||
|
}, function(response: any) {
|
||||||
|
if (typeof response.data === 'undefined') {
|
||||||
|
reject("return ERROR undefined");
|
||||||
|
} else {
|
||||||
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,40 +10,12 @@ export class SaisonService {
|
|||||||
console.log("Start SaisonService");
|
console.log("Start SaisonService");
|
||||||
}
|
}
|
||||||
|
|
||||||
get_specific(_id:number, _subElement:string = ""):any {
|
|
||||||
console.log("Get All data from types");
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "saison/" + _id;
|
|
||||||
if (_subElement != "") {
|
|
||||||
url += "/" + _subElement;
|
|
||||||
}
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
//console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
return this.get_specific(_id);
|
return this.http.get_specific("saison", _id);
|
||||||
};
|
};
|
||||||
|
|
||||||
getVideo(_id:number):any {
|
getVideo(_id:number):any {
|
||||||
return this.get_specific(_id, "video");
|
return this.http.get_specific("saison", _id, "video");
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,136 +20,25 @@ export class TypeService {
|
|||||||
console.log("Start TypeService");
|
console.log("Start TypeService");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getData():any {
|
getData():any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("type");
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "type";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
//console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("type", _id);
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "type/" + _id;
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubGroup(_id: number):any {
|
getSubGroup(_id:number, _select:Array<string> = []):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("type", _id, "group", _select);
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "type/" + _id + "/group";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubVideo(_id: number):any {
|
getSubVideo(_id:number, _select:Array<string> = []):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("type", _id, "video", _select);
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "type/" + _id + "/video";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubUnivers(_id: number):any {
|
getSubUnivers(_id:number, _select:Array<string> = []):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("type", _id, "univers", _select);
|
||||||
let currentDate:number = dateFormat(new Date(), 'm-d-Y h:i:s ms');
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "type/" + _id + "/univers";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,106 +11,19 @@ export class UniversService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getData():any {
|
getData():any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("univers");
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "univers";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
//console.log("get data from univers : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
console.log("Get All data from univers");
|
return this.http.get_specific("univers", _id);
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "univers/" + _id;
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubGroup(_id: number):any {
|
getSubGroup(_id:number, _select:Array<string> = []):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("univers", _id, "group", _select);
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "univers/" + _id + "/group";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getSubVideo(_id: number):any {
|
getSubVideo(_id:number, _select:Array<string> = []):any {
|
||||||
console.log("Get All data from types");
|
return this.http.get_specific("univers", _id, "video", _select);
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "univers/" + _id + "/video_no_group";
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
console.log("get data from type : " + response.data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,35 +10,11 @@ export class VideoService {
|
|||||||
console.log("Start VideoService");
|
console.log("Start VideoService");
|
||||||
}
|
}
|
||||||
|
|
||||||
get_specific(_id:number, _subElement:string = ""):any {
|
|
||||||
console.log("Get All data from types");
|
|
||||||
const httpOption = { 'Content-Type': 'application/json' };
|
|
||||||
let url = "video/" + _id;
|
|
||||||
if (_subElement != "") {
|
|
||||||
url += "/" + _subElement;
|
|
||||||
}
|
|
||||||
console.log("call GET " + url);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
this.http.get(url, httpOption, {})
|
|
||||||
.then(function(response: any) {
|
|
||||||
if (response.status == 200) {
|
|
||||||
resolve(response.data);
|
|
||||||
//console.log("get data from response : " + JSON.stringify(response.data, null, 2));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reject("An error occured");
|
|
||||||
}, function(response: any) {
|
|
||||||
if (typeof response.data === 'undefined') {
|
|
||||||
reject("return ERROR undefined");
|
|
||||||
} else {
|
|
||||||
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
get(_id:number):any {
|
get(_id:number):any {
|
||||||
return this.get_specific(_id);
|
return this.http.get_specific("video", _id);
|
||||||
|
};
|
||||||
|
put(_id:number, _data:any):any {
|
||||||
|
return this.http.put_specific("video", _id, _data);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user