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;
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 }});
}

View File

@ -76,7 +76,7 @@
<td>
<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>
<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>
<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>

View File

@ -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){

View File

@ -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');