From 01fb9bfcc4d686626500693c542728aa9596526c Mon Sep 17 00:00:00 2001 From: Nikolaos Laskaris Date: Mon, 27 Nov 2017 14:03:43 +0200 Subject: [PATCH] minor edits --- dmp-frontend/src/app/dmps/dmp.component.ts | 15 +++++++++++---- dmp-frontend/src/app/dmps/dmps.html | 2 +- dmp-frontend/src/app/services/server.service.ts | 4 ++-- dmp-frontend/src/assets/custom.js | 2 -- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dmp-frontend/src/app/dmps/dmp.component.ts b/dmp-frontend/src/app/dmps/dmp.component.ts index 370954597..b19f776a1 100644 --- a/dmp-frontend/src/app/dmps/dmp.component.ts +++ b/dmp-frontend/src/app/dmps/dmp.component.ts @@ -112,6 +112,12 @@ export class DmpComponent implements OnInit{ this.tableData = response; if(muted && muted!=true) simple_notifier("success",null,"Refreshed DMPs"); + + this.tableData.forEach( dmp => { + if(dmp.previous!=null) + this.serverService.getDmp(dmp.previous).subscribe( previous => {dmp.previous = previous;}); + }); + }, (err: HttpErrorResponse) => { simple_notifier("danger",null,"Could not refresh DMPs"); @@ -141,6 +147,8 @@ export class DmpComponent implements OnInit{ this.dmp.project = {"id":this.dmp.project}; this.dmp.creator = {"id": this.dmp.creator}; + if(this.dmp.previous!=null) + this.dmp.previous = this.dmp.previous.id; this.serverService.updateDmp(this.dmp) .subscribe( @@ -185,7 +193,7 @@ export class DmpComponent implements OnInit{ $("#newDmpModal").modal("show"); } - editDmpVersion(item){ + cloneDmp(item){ this.dmp = Object.assign({}, item); this.dmp.project = item.project.id; $("#newVersionDmpModal").modal("show"); @@ -210,8 +218,9 @@ export class DmpComponent implements OnInit{ deleteRow(dmp){ this.dmp = {"id": this.dmp.id}; //only id is needed to delete + - this.serverService.deleteDmp(dmp).subscribe( + this.serverService.deleteDmp(this.dmp).subscribe( response => { simple_notifier("success",null,"Successfully deleted the DMP"); this.getDmps(); @@ -264,13 +273,11 @@ export class DmpComponent implements OnInit{ } viewDetailedDMP(dmp){ - console.log(dmp) let random = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5); this.router.navigate(['/dmps/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label, random: random}}); } viewDetailedProject(dmp){ - console.log(dmp) let random = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5); this.router.navigate(['/dmps/project'], { queryParams: { "projectid":dmp.project.id, "label":dmp.project.label, random: random }}); } diff --git a/dmp-frontend/src/app/dmps/dmps.html b/dmp-frontend/src/app/dmps/dmps.html index d2d9dffef..2c334aa15 100644 --- a/dmp-frontend/src/app/dmps/dmps.html +++ b/dmp-frontend/src/app/dmps/dmps.html @@ -76,7 +76,7 @@ - + diff --git a/dmp-frontend/src/app/services/server.service.ts b/dmp-frontend/src/app/services/server.service.ts index e85195dbb..b02c9478d 100644 --- a/dmp-frontend/src/app/services/server.service.ts +++ b/dmp-frontend/src/app/services/server.service.ts @@ -51,10 +51,10 @@ export class ServerService { } public getDmp(dmpid : string, eager? : boolean){ - if(eager) + if(eager && eager==true) return this.restBase.get("dmps/"+dmpid, {"eager": true}); else - return this.restBase.get("dmps/"+dmpid, {"eager": true}); + return this.restBase.get("dmps/"+dmpid, {"eager": false}); } public getDmpHistory(dmpid: string){ diff --git a/dmp-frontend/src/assets/custom.js b/dmp-frontend/src/assets/custom.js index 68147b753..7bdc5bece 100644 --- a/dmp-frontend/src/assets/custom.js +++ b/dmp-frontend/src/assets/custom.js @@ -13,8 +13,6 @@ if(gapi.auth2 == undefined){ cookiepolicy: 'single_host_origin', scope: scope }); - - debugger; //RE-Render the button (due to known issues of google-button with angular's lifecycle) gapi.signin2.render('googleBtn');