Added notifications on dataset table
This commit is contained in:
parent
a952cc529d
commit
ff856c6d14
|
@ -12,6 +12,10 @@ 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: 'datasets-table',
|
selector: 'datasets-table',
|
||||||
templateUrl: 'dataset.html',
|
templateUrl: 'dataset.html',
|
||||||
|
@ -87,11 +91,7 @@ export class DatasetsComponent implements OnInit {
|
||||||
//this.projects = this.serverService.getDummyProjects();
|
//this.projects = this.serverService.getDummyProjects();
|
||||||
this.datasets = [];
|
this.datasets = [];
|
||||||
console.log(this.dmpIdforDatasets);
|
console.log(this.dmpIdforDatasets);
|
||||||
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
this.getDatasets();
|
||||||
response => {
|
|
||||||
this.tableData = response;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
this.serverService.getAllDatsetsProfile().subscribe(
|
this.serverService.getAllDatsetsProfile().subscribe(
|
||||||
response => {
|
response => {
|
||||||
|
@ -100,7 +100,12 @@ export class DatasetsComponent implements OnInit {
|
||||||
params.key = datasetprofile.id;
|
params.key = datasetprofile.id;
|
||||||
params.value = datasetprofile.label;
|
params.value = datasetprofile.label;
|
||||||
this.datasetProfileDropDown.options.push(params);
|
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.dataset.profile = { "id": this.dataset.profile }
|
||||||
this.serverService.createDatasetForDmp(this.dataset).subscribe(
|
this.serverService.createDatasetForDmp(this.dataset).subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log(response);
|
simple_notifier("success",null,"Created dataset");
|
||||||
this.getDatasets();
|
this.getDatasets();
|
||||||
if (this.saveAndDescribe == true)
|
if (this.saveAndDescribe == true)
|
||||||
this.describeDataset(response);
|
this.describeDataset(response);
|
||||||
|
},
|
||||||
|
error=>{
|
||||||
|
simple_notifier("danger",null,"Could not create Dataset");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
$("#newDatasetModal").modal("hide");
|
$("#newDatasetModal").modal("hide");
|
||||||
|
@ -138,10 +146,13 @@ export class DatasetsComponent implements OnInit {
|
||||||
this.dataset.profile = { "id": this.dataset.profile }
|
this.dataset.profile = { "id": this.dataset.profile }
|
||||||
this.serverService.updateDatsetsProfile(this.dataset).subscribe(
|
this.serverService.updateDatsetsProfile(this.dataset).subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log(response);
|
simple_notifier("success",null,"Dataset edited");
|
||||||
this.getDatasets();
|
this.getDatasets();
|
||||||
if (this.saveAndDescribe == true)
|
if (this.saveAndDescribe == true)
|
||||||
this.describeDataset(response);
|
this.describeDataset(response);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
simple_notifier("danger",null,"Could not edit dataset");
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
$("#newDatasetModal").modal("hide");
|
$("#newDatasetModal").modal("hide");
|
||||||
|
@ -149,10 +160,15 @@ export class DatasetsComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDatasets(){
|
getDatasets(muted?: boolean){
|
||||||
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
this.serverService.getDatasetForDmp({ "id": this.dmpIdforDatasets }).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.tableData = 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(
|
this.serverService.getDatasetForDmp({ "id": dmpid }).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.tableData = 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){
|
deleteRow(dataset, $event){
|
||||||
this.serverService.deleteDataset(dataset).subscribe(
|
this.serverService.deleteDataset(dataset).subscribe(
|
||||||
response => {
|
response => {
|
||||||
console.log("Deleted Successfully the dataset")
|
simple_notifier("success",null,"Deleted dataset");
|
||||||
|
this.getDatasets();
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
console.log("Could not delete the dataset")
|
simple_notifier("danger",null,"Could not delete the dataset");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.getDatasets();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</select>
|
</select>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<button class="btn btn-default" (click)="getDatasets()">
|
<button class="btn btn-default" (click)="getDatasets('false')">
|
||||||
<span class="glyphicon glyphicon-refresh"></span>
|
<span class="glyphicon glyphicon-refresh"></span>
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
|
|
Loading…
Reference in New Issue