Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot
This commit is contained in:
commit
e9f9cac007
|
@ -104,6 +104,7 @@ public class DMP implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
|
@ -111,6 +112,21 @@ public class DMP implements Serializable {
|
|||
private Date modified = new Date();
|
||||
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -57,11 +57,12 @@ public class DMPProfile implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -72,11 +72,11 @@ public class DataRepository implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -99,11 +99,25 @@ public class Dataset implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -67,11 +67,25 @@ public class DatasetProfile implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -74,11 +74,12 @@ public class Organisation implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -80,11 +80,25 @@ public class Project implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -73,11 +73,12 @@ public class Registry implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -73,11 +73,12 @@ public class Researcher implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -73,11 +73,12 @@ public class Service implements Serializable {
|
|||
@Column(name = "\"Status\"", nullable = false)
|
||||
private Short status;
|
||||
|
||||
@Column(name = "\"Created\"", nullable = false)
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
@Column(name = "\"Modified\"", nullable = false)
|
||||
private Date modified = null;
|
||||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -84,6 +85,11 @@ public class UserInfo implements Serializable{
|
|||
private Set<DMP> dmps;
|
||||
|
||||
|
||||
|
||||
public Set<DMP> getDmpsNonDeleted(){
|
||||
return getDmps().parallelStream().filter(dmp -> dmp.getStatus()>=0).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ public class DMPs {
|
|||
d.setStatus(new Short("-1"));
|
||||
|
||||
try {
|
||||
int code = updateDMP(dmp).getStatusCodeValue();
|
||||
int code = updateDMP(d).getStatusCodeValue();
|
||||
if(code>199 && code<300)
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("DELETED!");
|
||||
else
|
||||
|
@ -238,7 +238,8 @@ public class DMPs {
|
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
try {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(userInfo.getDmps()));
|
||||
Set<DMP> nonDeleted = userInfo.getDmpsNonDeleted();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(nonDeleted));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
|
@ -285,6 +286,51 @@ public class DMPs {
|
|||
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/cloneforuser" }, produces="text/plain", consumes = "application/json")
|
||||
public @ResponseBody ResponseEntity<Object> cloneDmpOfUser(@RequestBody DMP dmp){
|
||||
|
||||
String userID = null;
|
||||
try {
|
||||
userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
|
||||
} catch(NullPointerException ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here");
|
||||
}
|
||||
|
||||
UserInfo userInfo = userInfoDao.read(UUID.fromString(userID));
|
||||
|
||||
if(userInfo==null) //this should normally never happer
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
DMP clone = dMPDao.read(dmp.getId());
|
||||
|
||||
try {
|
||||
|
||||
Set<UserInfo> users = new HashSet<UserInfo>();
|
||||
users.add(userInfo);
|
||||
clone.setUsers(users);
|
||||
|
||||
clone.setCreated(new Date());
|
||||
clone.setModified(new Date());
|
||||
clone.setStatus(new Short("0"));
|
||||
|
||||
clone.setVersion(clone.getVersion()+1);
|
||||
clone.setLabel(clone.getLabel()+"_clone");
|
||||
clone.setPrevious(clone.getId());
|
||||
|
||||
|
||||
clone.setId(null);
|
||||
|
||||
clone = dMPDao.create(clone);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(clone));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/adduser" }, produces="text/plain")
|
||||
public @ResponseBody ResponseEntity<Object> addUserToDmp(@RequestBody DMP dmp){
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package rest.entities;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -137,7 +138,15 @@ public class Projects {
|
|||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
||||
public @ResponseBody ResponseEntity<Object> createProject(@RequestBody Project project) {
|
||||
Project createdProject = projectDao.update(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(createdProject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/update" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> updateProject(@RequestBody Project project) {
|
||||
Project createdProject = projectDao.update(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(createdProject);
|
||||
}
|
||||
|
@ -159,6 +168,23 @@ public class Projects {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/softdelete" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> softDelete(@RequestBody Project project) {
|
||||
|
||||
project.setStatus(new Short("-1"));
|
||||
|
||||
try {
|
||||
projectDao.update(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted project!\"}");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete Project!\"}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/project/getdmps" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> getProjectDmps(@RequestBody Project project) {
|
||||
|
@ -230,13 +256,18 @@ public class Projects {
|
|||
try {
|
||||
|
||||
project.setId(null);
|
||||
project.setStatus(new Short("0"));
|
||||
project.setCreated(new Date());
|
||||
project.setModified(new Date());
|
||||
|
||||
Project newproj = projectDao.create(project);
|
||||
|
||||
DMP newdmp = new DMP();
|
||||
newdmp.setId(null);
|
||||
newdmp.setLabel("Auto-Generated");
|
||||
newdmp.setCreated(new Date());
|
||||
newdmp.setVersion(1);
|
||||
newdmp.setStatus(new Short("0"));
|
||||
newdmp.setProject(newproj);
|
||||
|
||||
Set<UserInfo> users = new HashSet<UserInfo>();
|
||||
|
@ -248,6 +279,7 @@ public class Projects {
|
|||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(newproj));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -181,8 +181,6 @@ public class TestRest {
|
|||
|
||||
System.out.println(SerializerProvider.toJson(userProjects));
|
||||
|
||||
|
||||
|
||||
assertEquals("aaa", "aaa");
|
||||
|
||||
}
|
||||
|
@ -204,9 +202,18 @@ public class TestRest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testDataset() {
|
||||
public void testDmpClone() {
|
||||
|
||||
System.out.println(datasetsService.getAllDatasets().getBody());
|
||||
System.out.println(dmpsService.getDmpsOfUser().getBody());
|
||||
|
||||
DMP dmp = new DMP();
|
||||
dmp.setId(UUID.fromString("8faad611-7083-497c-ad96-9459e47ee175"));
|
||||
String clonedJSON = dmpsService.cloneDmpOfUser(dmp).toString();
|
||||
|
||||
System.out.println(clonedJSON);
|
||||
|
||||
|
||||
// System.out.println(datasetsService.getAllDatasets().getBody());
|
||||
|
||||
// System.out.println(dmpsService.getDatasetsOfDMP(dmp).getBody());
|
||||
|
||||
|
@ -216,4 +223,48 @@ public class TestRest {
|
|||
}
|
||||
|
||||
|
||||
//@Test
|
||||
public void testProject() {
|
||||
|
||||
String projectJson = "{\"id\":\"d558e52c-a61b-4e16-a401-b27c579cf8e3\",\"dmps\":null,\"label\":\"Sample project\",\"abbreviation\":null,\"reference\":\"agasdfasdf\",\"uri\":\"hadfhadfgazfrg\",\"definition\":\"<info>sdfgsdg</info>\",\"startdate\":\"2017-11-01\",\"enddate\":\"2017-11-30\",\"status\":0,\"created\":1509638367900,\"modified\":1509638367900}";
|
||||
try {
|
||||
Project project = SerializerProvider.fromJson(projectJson, Project.class);
|
||||
System.out.println(SerializerProvider.toJson(project));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// System.out.println(dmpsService.getAllDMPs().getBody().toString());
|
||||
|
||||
String dmpJSON = dmpsService.getDMP("d0d01f5e-9aed-4733-a0cf-aabe44cd30c9").getBody().toString();
|
||||
System.out.println(dmpJSON);
|
||||
|
||||
try {
|
||||
DMP dmp = SerializerProvider.fromJson(dmpJSON, DMP.class);
|
||||
ResponseEntity<Object> resp = dmpsService.softDelete(dmp);
|
||||
resp.getStatusCode();
|
||||
|
||||
}
|
||||
catch(Exception ex) {
|
||||
|
||||
}
|
||||
|
||||
//dmpsService.softDelete(dmp)
|
||||
|
||||
//System.out.println(datasetsService.getAllDatasets().getBody());
|
||||
|
||||
// System.out.println(dmpsService.getDatasetsOfDMP(dmp).getBody());
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
assertEquals("aaa", "aaa");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@ import { StatusToString } from '../pipes/various/status-to-string';
|
|||
|
||||
declare var $: any;
|
||||
|
||||
|
||||
import '../../assets/custom.js';
|
||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||
|
||||
@Component({
|
||||
selector: 'datasets-table',
|
||||
templateUrl: 'dataset.html',
|
||||
|
@ -87,11 +91,7 @@ export class DatasetsComponent implements OnInit {
|
|||
//this.projects = this.serverService.getDummyProjects();
|
||||
this.datasets = [];
|
||||
console.log(this.dmpIdforDatasets);
|
||||
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
}
|
||||
);
|
||||
this.getDatasets();
|
||||
|
||||
this.serverService.getAllDatsetsProfile().subscribe(
|
||||
response => {
|
||||
|
@ -100,7 +100,12 @@ export class DatasetsComponent implements OnInit {
|
|||
params.key = datasetprofile.id;
|
||||
params.value = datasetprofile.label;
|
||||
this.datasetProfileDropDown.options.push(params);
|
||||
});
|
||||
},
|
||||
error => {
|
||||
simple_notifier("danger",null,"Could not load User's Dataset Profiles");
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
)
|
||||
|
@ -124,10 +129,13 @@ export class DatasetsComponent implements OnInit {
|
|||
this.dataset.profile = { "id": this.dataset.profile }
|
||||
this.serverService.createDatasetForDmp(this.dataset).subscribe(
|
||||
response => {
|
||||
console.log(response);
|
||||
simple_notifier("success",null,"Created dataset");
|
||||
this.getDatasets();
|
||||
if (this.saveAndDescribe == true)
|
||||
this.describeDataset(response);
|
||||
},
|
||||
error=>{
|
||||
simple_notifier("danger",null,"Could not create Dataset");
|
||||
}
|
||||
)
|
||||
$("#newDatasetModal").modal("hide");
|
||||
|
@ -138,10 +146,13 @@ export class DatasetsComponent implements OnInit {
|
|||
this.dataset.profile = { "id": this.dataset.profile }
|
||||
this.serverService.updateDatsetsProfile(this.dataset).subscribe(
|
||||
response => {
|
||||
console.log(response);
|
||||
simple_notifier("success",null,"Dataset edited");
|
||||
this.getDatasets();
|
||||
if (this.saveAndDescribe == true)
|
||||
this.describeDataset(response);
|
||||
},
|
||||
error => {
|
||||
simple_notifier("danger",null,"Could not edit dataset");
|
||||
}
|
||||
)
|
||||
$("#newDatasetModal").modal("hide");
|
||||
|
@ -149,10 +160,15 @@ export class DatasetsComponent implements OnInit {
|
|||
|
||||
}
|
||||
|
||||
getDatasets(){
|
||||
getDatasets(muted?: boolean){
|
||||
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
if(muted && muted!=true)
|
||||
simple_notifier("success",null,"Updated datasets table");
|
||||
},
|
||||
error => {
|
||||
simple_notifier("danger",null,"Could not update datasets table");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -162,6 +178,9 @@ export class DatasetsComponent implements OnInit {
|
|||
this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
},
|
||||
error => {
|
||||
console.log("could not retrieve dataset for dpm: "+dmpid);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -201,13 +220,13 @@ export class DatasetsComponent implements OnInit {
|
|||
deleteRow(dataset, $event){
|
||||
this.serverService.deleteDataset(dataset).subscribe(
|
||||
response => {
|
||||
console.log("Deleted Successfully the dataset")
|
||||
simple_notifier("success",null,"Deleted dataset");
|
||||
this.getDatasets();
|
||||
},
|
||||
err => {
|
||||
console.log("Could not delete the dataset")
|
||||
simple_notifier("danger",null,"Could not delete the dataset");
|
||||
}
|
||||
);
|
||||
this.getDatasets();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</select>
|
||||
</th>
|
||||
<th>
|
||||
<button class="btn btn-default" (click)="getDatasets()">
|
||||
<button class="btn btn-default" (click)="getDatasets('false')">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
|
|
|
@ -112,10 +112,12 @@ export class DmpComponent implements OnInit{
|
|||
|
||||
|
||||
|
||||
getDmps(){
|
||||
getDmps(muted? : boolean){
|
||||
this.serverService.getDmpOfUser().subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
if(muted && muted!=true)
|
||||
simple_notifier("success",null,"Refreshed DMPs");
|
||||
},
|
||||
(err: HttpErrorResponse) => {
|
||||
simple_notifier("danger",null,"Could not refresh DMPs");
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Search in Labels' />
|
||||
</th>
|
||||
<th colspan="1">
|
||||
<button class="btn btn-default " (click)="getDmps()">
|
||||
<button class="btn btn-default " (click)="getDmps('false')">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter' />
|
||||
</th>
|
||||
<th>
|
||||
<button class="btn btn-default" (click)="getProjects()">
|
||||
<button class="btn btn-default" (click)="getProjects('false')">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
|
|
|
@ -22,6 +22,8 @@ import { ProjectTableFilterPipe } from '../pipes/project-table-filter.pipe';
|
|||
|
||||
declare var $ :any;
|
||||
|
||||
import '../../assets/custom.js';
|
||||
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -118,14 +120,15 @@ getEmptyProject(){
|
|||
}
|
||||
|
||||
|
||||
getProjects(){
|
||||
getProjects(muted? : boolean){
|
||||
this.serverService.getProjectsOfUser().subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
console.log(this.tableData)
|
||||
if(muted && muted!=true)
|
||||
simple_notifier("success",null,"Updated projects table");
|
||||
},
|
||||
err => {
|
||||
|
||||
simple_notifier("danger",null,"Could not retrieve projects");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -142,13 +145,17 @@ getDMPs(){
|
|||
params.key = dmp.id;
|
||||
params.value = dmp.label;
|
||||
this.datasetDropDown.options.push(params);
|
||||
});
|
||||
},
|
||||
error => {
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
showDatasets(){debugger; //dmpId, event
|
||||
showDatasets(){ //dmpId, event
|
||||
//this.dataSetVisibe = true;
|
||||
|
||||
}
|
||||
|
@ -165,8 +172,10 @@ SaveProject(){
|
|||
action.subscribe(
|
||||
response =>{
|
||||
this.getProjects();
|
||||
console.log("response");
|
||||
console.log(response);
|
||||
simple_notifier("success",null, (this.project.id == null) ? "Created" : "Updated" +" projects table");
|
||||
},
|
||||
error => {
|
||||
simple_notifier("danger",null, "Could not "+ (this.project.id == null) ? "create" : "update" + " projects table");
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue