add loader when opening description for dataset and dmp

This commit is contained in:
annabakouli 2017-12-11 13:20:48 +02:00
parent e069a14b55
commit 5fdc5b6720
3 changed files with 24 additions and 17 deletions

View File

@ -217,7 +217,7 @@ public class DMPs {
DMP d = dMPDao.read(dmp.getId()); DMP d = dMPDao.read(dmp.getId());
d.setStatus(new Short("-1")); d.setStatus(new Short("-1"));
dMPDao.update(d); dMPDao.update(d);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not soft delete DMP!\""); return ResponseEntity.status(HttpStatus.OK).body("{\"msg\":\"deleted DMP!\"");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not soft delete DMP!\""); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not soft delete DMP!\"");

View File

@ -134,9 +134,9 @@ export class DatasetsComponent implements OnInit {
properties: '', properties: '',
profile: { "id": '' }, profile: { "id": '' },
dmp: { "id": '' }, dmp: { "id": '' },
services:[], services: [],
registries:[], registries: [],
dataRepositories:[] dataRepositories: []
} }
} }
@ -203,7 +203,6 @@ export class DatasetsComponent implements OnInit {
this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe( this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe(
response => { response => {
this.tableData = response; this.tableData = response;
}, },
error => { error => {
console.log("could not retrieve dataset for dpm: " + dmpid); console.log("could not retrieve dataset for dpm: " + dmpid);
@ -216,13 +215,14 @@ export class DatasetsComponent implements OnInit {
editRow(item, event) { editRow(item, event) {
if (event.toElement.id == "editDataset") { if (event.toElement.id == "editDataset") {
//this.dataset = item; this.spinnerService.show();
this.serverService.getDatasetByID(item.id).subscribe(item => {
this.serverService.getDatasetByID(item.id).subscribe(item=>{ this.dataset = item;
this.dataset = item; this.dataset.profile = item.profile.id;
this.dataset.profile = item.profile.id; $("#newDatasetModal").modal("show");
$("#newDatasetModal").modal("show"); },
} error => simple_notifier("danger", null, "Could not Open Dataset"),
() => this.spinnerService.hide()
) )
} }
else if (event.toElement.id == "describeDataset") { else if (event.toElement.id == "describeDataset") {

View File

@ -17,6 +17,7 @@ import { NgForm } from '@angular/forms';
import { DatasetsComponent } from '../datasets/dataset.component'; import { DatasetsComponent } from '../datasets/dataset.component';
import { StatusToString } from '../pipes/various/status-to-string'; import { StatusToString } from '../pipes/various/status-to-string';
import { MenuItem } from 'primeng/primeng'; import { MenuItem } from 'primeng/primeng';
import { Ng4LoadingSpinnerService } from 'ng4-loading-spinner';
declare var $: any; declare var $: any;
@ -59,7 +60,9 @@ export class DmpComponent implements OnInit {
constructor( constructor(
private serverService: ServerService, private serverService: ServerService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private spinnerService: Ng4LoadingSpinnerService
) {
this.projectsDropDown = new DropdownField(); this.projectsDropDown = new DropdownField();
this.projectsDropDown.options = []; this.projectsDropDown.options = [];
this.statusDropDown = new DropdownField(); this.statusDropDown = new DropdownField();
@ -190,11 +193,15 @@ export class DmpComponent implements OnInit {
editDmp(item) { editDmp(item) {
this.serverService.getDmp(item.id).subscribe(result=>{ this.spinnerService.show();
this.serverService.getDmp(item.id).subscribe(result => {
this.dmp = result; this.dmp = result;
this.dmp.project = result.project.id this.dmp.project = result.project.id
$("#newDmpModal").modal("show"); $("#newDmpModal").modal("show");
}) },
error => simple_notifier("danger", null, "Failed to Open DMP"),
() => this.spinnerService.hide()
)
} }