minor edits

This commit is contained in:
Nikolaos Laskaris 2017-11-27 14:03:43 +02:00
parent 8f6a4f0ba8
commit 01fb9bfcc4
4 changed files with 14 additions and 9 deletions

View File

@ -112,6 +112,12 @@ export class DmpComponent implements OnInit{
this.tableData = response; this.tableData = response;
if(muted && muted!=true) if(muted && muted!=true)
simple_notifier("success",null,"Refreshed DMPs"); 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) => { (err: HttpErrorResponse) => {
simple_notifier("danger",null,"Could not refresh DMPs"); 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.project = {"id":this.dmp.project};
this.dmp.creator = {"id": this.dmp.creator}; this.dmp.creator = {"id": this.dmp.creator};
if(this.dmp.previous!=null)
this.dmp.previous = this.dmp.previous.id;
this.serverService.updateDmp(this.dmp) this.serverService.updateDmp(this.dmp)
.subscribe( .subscribe(
@ -185,7 +193,7 @@ export class DmpComponent implements OnInit{
$("#newDmpModal").modal("show"); $("#newDmpModal").modal("show");
} }
editDmpVersion(item){ cloneDmp(item){
this.dmp = Object.assign({}, item); this.dmp = Object.assign({}, item);
this.dmp.project = item.project.id; this.dmp.project = item.project.id;
$("#newVersionDmpModal").modal("show"); $("#newVersionDmpModal").modal("show");
@ -211,7 +219,8 @@ export class DmpComponent implements OnInit{
this.dmp = {"id": this.dmp.id}; //only id is needed to delete this.dmp = {"id": this.dmp.id}; //only id is needed to delete
this.serverService.deleteDmp(dmp).subscribe(
this.serverService.deleteDmp(this.dmp).subscribe(
response => { response => {
simple_notifier("success",null,"Successfully deleted the DMP"); simple_notifier("success",null,"Successfully deleted the DMP");
this.getDmps(); this.getDmps();
@ -264,13 +273,11 @@ export class DmpComponent implements OnInit{
} }
viewDetailedDMP(dmp){ viewDetailedDMP(dmp){
console.log(dmp)
let random = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5); 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}}); this.router.navigate(['/dmps/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label, random: random}});
} }
viewDetailedProject(dmp){ viewDetailedProject(dmp){
console.log(dmp)
let random = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5); 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 }}); this.router.navigate(['/dmps/project'], { queryParams: { "projectid":dmp.project.id, "label":dmp.project.label, random: random }});
} }

View File

@ -76,7 +76,7 @@
<td> <td>
<a class="editGridColumn cursor-link" (click)="editDmp(dmp)"> <!--btn btn-primary btn-rounded css for button style --> <a class="editGridColumn cursor-link" (click)="editDmp(dmp)"> <!--btn btn-primary btn-rounded css for button style -->
<i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i></a> <i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i></a>
<a class="editGridColumn cursor-link" (click)="editDmpVersion(dmp)"> <a class="editGridColumn cursor-link" (click)="cloneDmp(dmp)">
<i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i> </a> <i class="fa fa-clone fa-fw" data-toggle="tooltip" title="create new version" id="changeVersionDMP"></i> </a>
<a class="editGridColumn cursor-link" (click)="markDMPForDelete(dmp)"> <a class="editGridColumn cursor-link" (click)="markDMPForDelete(dmp)">
<i class="fa fa-eraser fa-fw" data-toggle="modal" data-target="#delete-dmp-confirm" title="delete DMP"></i> </a> <i class="fa fa-eraser fa-fw" data-toggle="modal" data-target="#delete-dmp-confirm" title="delete DMP"></i> </a>

View File

@ -51,10 +51,10 @@ export class ServerService {
} }
public getDmp(dmpid : string, eager? : boolean){ public getDmp(dmpid : string, eager? : boolean){
if(eager) if(eager && eager==true)
return this.restBase.get("dmps/"+dmpid, {"eager": true}); return this.restBase.get("dmps/"+dmpid, {"eager": true});
else else
return this.restBase.get("dmps/"+dmpid, {"eager": true}); return this.restBase.get("dmps/"+dmpid, {"eager": false});
} }
public getDmpHistory(dmpid: string){ public getDmpHistory(dmpid: string){

View File

@ -14,8 +14,6 @@ if(gapi.auth2 == undefined){
scope: scope scope: scope
}); });
debugger;
//RE-Render the button (due to known issues of google-button with angular's lifecycle) //RE-Render the button (due to known issues of google-button with angular's lifecycle)
gapi.signin2.render('googleBtn'); gapi.signin2.render('googleBtn');