[DEV] update dynamique when modify

This commit is contained in:
Edouard DUPIN 2020-03-02 23:12:14 +01:00
parent 47cbf4d5f2
commit ec7e9dbe95
5 changed files with 13 additions and 37 deletions

View File

@ -231,7 +231,7 @@ def add(_app, _name_api):
@doc.response_success(status=201, description='If successful updated')
async def update(request, id):
ret = data_global_elements.get_interface(_name_api).put(id, request.json)
return response.json({"update":"done"});
return response.json(ret);
@elem_blueprint.delete('/' + _name_api + '/<id:int>', strict_slashes=True)
@doc.summary("Remove resource")

View File

@ -151,7 +151,7 @@ def create_if_needed():
c.execute('''
CREATE TRIGGER set_timestamp
BEFORE UPDATE ON object
AFTER UPDATE ON object
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();
''')
@ -174,14 +174,6 @@ def create_if_needed():
''')
connection.commit()
c.execute('''
CREATE TRIGGER set_timestamp_data
BEFORE UPDATE ON data
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();
''')
connection.commit()
debug.info("Add NODE interface");
@ -198,13 +190,6 @@ def create_if_needed():
COMMENT ON COLUMN node.description IS 'Description of the Node.';
''')
connection.commit()
c.execute('''
CREATE TRIGGER set_timestamp_node
BEFORE UPDATE ON node
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();
''')
connection.commit()
debug.info("Add Cover interface");
# Create table
@ -216,13 +201,6 @@ def create_if_needed():
COMMENT ON TABLE cover_link IS 'Link between cover data id and Nodes.';
''')
connection.commit()
c.execute('''
CREATE TRIGGER set_timestamp_cover_link
BEFORE UPDATE ON cover_link
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();
''')
connection.commit()
debug.info("Add MEDIA interface");
# Create table
@ -247,13 +225,6 @@ def create_if_needed():
# Save (commit) the changes
connection.commit()
c.execute('''
CREATE TRIGGER set_timestamp_media
BEFORE UPDATE ON media
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();
''')
connection.commit()
debug.info("Add Views models");

View File

@ -41,7 +41,7 @@ class DataToSend {
data_id:number = -1
time:number = undefined
type_id:number = undefined
covers:Array<number> = [];
covers:Array<any> = [];
generated_name:string = ""
clone() {
let tmp = new DataToSend();
@ -80,7 +80,7 @@ export class VideoEditComponent implements OnInit {
selectedFiles:FileList;
need_send:boolean = false;
covers_display:Array<string> = [];
covers_display:Array<any> = [];
listType: ElementList[] = [
{value: undefined, label: '---'},
@ -188,7 +188,10 @@ export class VideoEditComponent implements OnInit {
if (response.covers !== undefined && response.covers !== null) {
for (let iii=0; iii<response.covers.length; iii++) {
self.data.covers.push(response.covers[iii]);
self.covers_display.push({id:response.covers[iii],url:self.videoService.getCoverUrl(response.covers[iii])});
self.covers_display.push({
id:response.covers[iii],
url:self.videoService.getCoverUrl(response.covers[iii])
});
}
} else {
self.covers_display = []

View File

@ -58,7 +58,7 @@ export class VideoComponent implements OnInit {
if (this.group_name != undefined) {
this.generated_name += this.group_name + "-";
}
if (this.saison != undefined) {
if (this.saison_name != undefined) {
if (this.saison_name.length < 2) {
this.generated_name += "s0" + this.saison_name + "-";
} else {

View File

@ -54,16 +54,18 @@ export class DataInterface {
}
set(_id, _value){
console.log("[I] Set " + this.name + "{ " + _id)
console.log("[I] Set " + this.name + " " + _id)
for (let iii=0; iii<this.bdd.length; iii++) {
console.log(" check: " + " " + this.bdd[iii]['id'])
if (this.bdd[iii]['id'] == _id) {
console.log(" *** Set specific values: " + _id + " " + JSON.stringify(_value, null, 2));
this.bdd[iii] = _value
}
}
}
delete(_id) {
console.log("[I] delete " + this.name + "{ " + _id)
console.log("[I] delete " + this.name + " " + _id)
for (let iii=0; iii<this.bdd.length; iii++) {
if (this.bdd[iii]['id'] == _id) {
this.bdd[iii] = undefined