// XMLHttpRequest EVENTLISTENER: show banner with new dataset id
// XMLHttpRequest EVENTLISTENER: show banner with new dataset id
functionshowNewDatasetID(){
functionshowNewDatasetID(){
console.log("Response to create new Dataset POST: "+this.responseText);
console.log("Response to create new Dataset POST: "+this.responseText);
// TODO http status check
if (this.status>=400){
// some error occured while getting the data
// show an alert and don't do anything else
varalertHTML='<div class="alert alert-danger" role="alert">Invalid response from server! Either the API server is down, or the dataset creation failed. Response code: '+this.status+'<hr>Please try agagin later, and if the error persists, contact the server administrator.</div>';
$('#storageTypeChooser').after(alertHTML);
return;
}
vardata=JSON.parse(this.responseText);
vardata=JSON.parse(this.responseText);
varid=data[0];
varid=data[0];
varalertHTML='<div class="alert alert-success" role="alert">Dataset created! OID is: <a href="?type='+getType()+'&oid='+id+'">'+id+'</a></div>';
varalertHTML='<div class="alert alert-success" role="alert">Dataset created! OID is: <a href="?type='+getType()+'&oid='+id+'">'+id+'</a></div>';
...
@@ -153,7 +173,13 @@ function showNewDatasetID() {
...
@@ -153,7 +173,13 @@ function showNewDatasetID() {
// XMLHttpRequest EVENTLISTENER: show banner with success message for change
// XMLHttpRequest EVENTLISTENER: show banner with success message for change
functionshowSuccessfullyChangedDataset(){
functionshowSuccessfullyChangedDataset(){
console.log("Response to modify dataset PUT: "+this.responseText);
console.log("Response to modify dataset PUT: "+this.responseText);
// TODO http status check
if (this.status>=400){
// some error occured while getting the data
// show an alert and don't do anything else
varalertHTML='<div class="alert alert-danger" role="alert">Invalid response from server! Either the API server is down, or the dataset modification failed. Response code: '+this.status+'<hr>Please try agagin later, and if the error persists, contact the server administrator.</div>';
$('#storageTypeChooser').after(alertHTML);
return;
}
varalertHTML='<div class="alert alert-success" role="alert">Dataset was successfully changed!</div>';
varalertHTML='<div class="alert alert-success" role="alert">Dataset was successfully changed!</div>';
$('#storageTypeChooser').after(alertHTML);
$('#storageTypeChooser').after(alertHTML);
$('#spinner').remove();
$('#spinner').remove();
...
@@ -162,7 +188,13 @@ function showSuccessfullyChangedDataset() {
...
@@ -162,7 +188,13 @@ function showSuccessfullyChangedDataset() {
// XMLHttpRequest EVENTLISTENER: show banner with success message for deletion
// XMLHttpRequest EVENTLISTENER: show banner with success message for deletion
functionshowSuccessfullyDeletedDataset(){
functionshowSuccessfullyDeletedDataset(){
console.log("Response to DELETE dataset: "+this.responseText);
console.log("Response to DELETE dataset: "+this.responseText);
// TODO http status check
if (this.status>=400){
// some error occured while getting the data
// show an alert and don't do anything else
varalertHTML='<div class="alert alert-danger" role="alert">Invalid response from server! Either the API server is down, or the dataset deletion failed. Response code: '+this.status+'<hr>Please try agagin later, and if the error persists, contact the server administrator.</div>';
$('#storageTypeChooser').after(alertHTML);
return;
}
varalertHTML='<div class="alert alert-danger" role="alert">Dataset was successfully deleted!</div>';
varalertHTML='<div class="alert alert-danger" role="alert">Dataset was successfully deleted!</div>';