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