Added notifications on dmp.ts
This commit is contained in:
parent
3ec174ad2e
commit
be6ce2ee71
|
@ -23,9 +23,8 @@
|
||||||
"styles.css"
|
"styles.css"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"./../node_modules/jquery/dist/jquery.min.js",
|
|
||||||
"./../node_modules/bootstrap/dist/js/bootstrap.min.js",
|
"./../node_modules/bootstrap/dist/js/bootstrap.min.js",
|
||||||
"./assets/xml2json.min.js",
|
"./assets/xml2json.min.js",
|
||||||
"./assets/jquery.scrollTo.min.js"
|
"./assets/jquery.scrollTo.min.js"
|
||||||
],
|
],
|
||||||
"environmentSource": "environments/environment.ts",
|
"environmentSource": "environments/environment.ts",
|
||||||
|
|
|
@ -18,6 +18,9 @@ import { StatusToString } from '../pipes/various/status-to-string';
|
||||||
|
|
||||||
declare var $ :any;
|
declare var $ :any;
|
||||||
|
|
||||||
|
import '../../assets/custom.js';
|
||||||
|
declare function simple_notifier(type: string, title: string, message:string): any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dmps',
|
selector: 'dmps',
|
||||||
templateUrl: 'dmps.html',
|
templateUrl: 'dmps.html',
|
||||||
|
@ -87,15 +90,8 @@ export class DmpComponent implements OnInit{
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
||||||
this.serverService.getDmpOfUser().subscribe(
|
this.getDmps();
|
||||||
response => {
|
|
||||||
this.tableData = response;
|
|
||||||
},
|
|
||||||
(err: HttpErrorResponse) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.serverService.getAllProjects().subscribe(
|
this.serverService.getAllProjects().subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
@ -109,7 +105,7 @@ export class DmpComponent implements OnInit{
|
||||||
|
|
||||||
},
|
},
|
||||||
(err: HttpErrorResponse) => {
|
(err: HttpErrorResponse) => {
|
||||||
|
simple_notifier("danger",null,"Could not load User's Projects");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -122,7 +118,7 @@ getDmps(){
|
||||||
this.tableData = response;
|
this.tableData = response;
|
||||||
},
|
},
|
||||||
(err: HttpErrorResponse) => {
|
(err: HttpErrorResponse) => {
|
||||||
|
simple_notifier("danger",null,"Could not refresh DMPs");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +133,11 @@ newDMP(){
|
||||||
this.serverService.createDmpForCurrentUser(this.dmp)
|
this.serverService.createDmpForCurrentUser(this.dmp)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
response =>{
|
response =>{
|
||||||
|
simple_notifier("success",null,"DMP created");
|
||||||
this.getDmps();
|
this.getDmps();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
simple_notifier("danger",null,"Could not create the DMP");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("#newDmpModal").modal("hide");
|
$("#newDmpModal").modal("hide");
|
||||||
|
@ -150,7 +150,11 @@ updateDMP(){
|
||||||
this.serverService.updateDmp(this.dmp)
|
this.serverService.updateDmp(this.dmp)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
response =>{
|
response =>{
|
||||||
|
simple_notifier("success",null,"Edited the DMP");
|
||||||
this.getDmps();
|
this.getDmps();
|
||||||
|
},
|
||||||
|
error =>{
|
||||||
|
simple_notifier("danger",null,"Failed to edit the DMP");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("#newDmpModal").modal("hide");
|
$("#newDmpModal").modal("hide");
|
||||||
|
@ -162,10 +166,11 @@ cloneDMP(dmp){
|
||||||
dmp = {"id": dmp.id};
|
dmp = {"id": dmp.id};
|
||||||
this.serverService.cloneDmp(dmp).subscribe(
|
this.serverService.cloneDmp(dmp).subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
simple_notifier("success",null,"Successfully cloned the DMP");
|
||||||
this.getDmps();
|
this.getDmps();
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log("Failed to clone dmp");
|
simple_notifier("danger",null,"Failed to clone the DMP");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$("#newVersionDmpModal").modal("hide");
|
$("#newVersionDmpModal").modal("hide");
|
||||||
|
@ -235,19 +240,16 @@ newDmp(item){
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRow(dmp, $event){
|
deleteRow(dmp, $event){
|
||||||
console.log("delete row")
|
|
||||||
console.log(dmp);
|
|
||||||
console.log($event)
|
|
||||||
|
|
||||||
this.serverService.deleteDmp(dmp).subscribe(
|
this.serverService.deleteDmp(dmp).subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log("Deleted Successfully the dmp")
|
simple_notifier("success",null,"Successfully deleted the DMP");
|
||||||
|
this.getDmps();
|
||||||
},
|
},
|
||||||
(err: HttpErrorResponse) => {
|
(err: HttpErrorResponse) => {
|
||||||
console.log("Could not delete the dmp")
|
simple_notifier("danger",null,"Failed to delete the DMP");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.getDmps();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue