This commit is contained in:
Nikolaos Laskaris 2017-10-18 12:12:09 +03:00
parent 5632b85de7
commit ff2eac1bc9
2 changed files with 25 additions and 6 deletions

View File

@ -112,6 +112,7 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
onFocusOutProfileWin($event, value:string) { onFocusOutProfileWin($event, value:string) {
this.nullSafeProfile(); this.nullSafeProfile();
if(this.haveChanges){ if(this.haveChanges){
@ -121,7 +122,7 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
//create profile and a) assign it on data[] and on current profile b) assign it to dataset //create profile and a) assign it on data[] and on current profile b) assign it to dataset
this.datasetProfileService.setDatasetProfile(this.profile).subscribe((resp) => { this.datasetProfileService.setDatasetProfile(this.profile).subscribe((resp) => {
/*
console.log("SERVICE RESPONSE: "); console.log("SERVICE RESPONSE: ");
console.log(resp); console.log(resp);
console.log(resp.json()); console.log(resp.json());
@ -141,13 +142,31 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
simple_notifier("success",null,"Updated profile element"); simple_notifier("success",null,"Updated profile element");
}); });
}); });
*/
simple_notifier("success",null,"Updated profile element"); simple_notifier("success",null,"Updated profile element");
}); });
} }
else{ else{
//this.getDatasetFromDataArray() //this.getDatasetFromDataArray()
console.log("this.profile")
console.log(this.profile)
console.log(this.profile)
this.profile.dataset = {"id": this.profile.dataset};
this.datasetProfileService.setDatasetProfile(this.profile).subscribe(
response => {
simple_notifier("success",null,"Saved DMP Profile");
console.log(response);
},
err => {
simple_notifier("danger",null,"Could not save DMP Profile");
console.log(err);
}
);
} }
} }
@ -365,4 +384,4 @@ export class DatasetsViewerComponent implements OnInit, AfterViewInit {
} }
} }

View File

@ -19,12 +19,12 @@ export class DatasetProfileService implements OnInit {
getDatasetProfileById(datasetProfileID){ getDatasetProfileById(datasetProfileID){
return this.restBase.get("datasetprofile/"+datasetProfileID) return this.restBase.get("datasetprofile/"+datasetProfileID);
.map((response: Response) => response.json()); //.map((response: Response) => response.json());
} }
setDatasetProfile(datasetProfile){ setDatasetProfile(datasetProfile){
return this.restBase.post("setDatasetProfile", datasetProfile); return this.restBase.post("datasetprofile/set", datasetProfile);
} }